Untitled
unknown
plain_text
4 years ago
739 B
5
Indexable
# AWS accounts functions function getaws() { credentialFileLocation=${AWS_SHARED_CREDENTIALS_FILE}; if [ -z $credentialFileLocation ]; then credentialFileLocation=~/.aws/credentials fi while read line; do if [[ $line == "["* ]]; then echo "$line"; fi; done < $credentialFileLocation; } function setaws() { if [ -z $1 ]; then echo "Usage: setaws profilename" return 1 fi exists="$(aws configure get aws_access_key_id --profile $1)" if [[ -n $exists ]]; then export AWS_DEFAULT_PROFILE=$1 export AWS_PROFILE=$1 export AWS_REGION=$(aws configure get region --profile $1) echo "Switched to AWS Profile: $1" aws configure list fi }
Editor is loading...