-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathworkshop-env.sh
25 lines (20 loc) · 956 Bytes
/
workshop-env.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/bash
# Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: MIT-0
# Environment variables used in various scripts used in the workshop
# Update them for your environment
# In a bash shell terminal execute `. workshop-env.sh or source workshop-env.sh` to setup the environment
if [[ -z "${C9_PROJECT}" ]]; then
echo "Not in AWS Cloud9 environment"
export AWS_ACCOUNT_ID=#<AWS Account Number>
export AWS_DEFAULT_REGION=#<AWS_DEFAULT_REGION>
else
# In Cloud9
echo "In AWS Cloud9 environment"
export AWS_ACCOUNT_ID=`curl -s http://169.254.169.254/latest/dynamic/instance-identity/document|jq -r .accountId`
export AWS_DEFAULT_REGION=`curl -s http://169.254.169.254/latest/dynamic/instance-identity/document|jq -r .region`
fi
echo "AWS_ACCOUNT_ID set to $AWS_ACCOUNT_ID"
echo "AWS_DEFAULT_REGION set to $AWS_DEFAULT_REGION"
# set if other than "default"
#export AWS_PROFILE=#<AWS PROFILE>