Created
August 4, 2020 14:49
-
-
Save gipsh/aa6ac34699fe225d6c7da9172cec913d to your computer and use it in GitHub Desktop.
set aws credentials into environment
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PROFILES=$(awk -F"\\\]|\\\[" '/^\[/{print $2}' ~/.aws/credentials) | |
select PROFILE in $PROFILES; do | |
export AWS_ACCESS_KEY_ID="$(aws configure get aws_access_key_id --profile $PROFILE)" | |
export AWS_SECRET_ACCESS_KEY="$(aws configure get aws_secret_access_key --profile $PROFILE)" | |
export AWS_DEFAULT_REGION="$(aws configure get region --profile $PROFILE)" | |
break | |
done | |
echo AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID | |
echo AWS_SECRET_ACCESS_KEY=$(echo $AWS_SECRET_ACCESS_KEY|tr '[:print:]' '*') | |
echo AWS_DEFAULT_REGION=$AWS_DEFAULT_REGION |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
remember to call it with source:
source ./set-aws-env.sh