Created
May 18, 2018 08:03
This file contains hidden or 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
aws-profiles() { | |
cat ~/.aws/credentials | grep '\[' | grep -v '#' | tr -d '[' | tr -d ']' | |
} | |
set-aws-profile() { | |
local aws_profile=$1 | |
set -x | |
export AWS_PROFILE=${aws_profile} | |
set +x | |
} | |
set-aws-keys() { | |
local aws_profile=$1 | |
profile_data=$(cat ~/.aws/credentials | grep "\[$aws_profile\]" -A4) | |
AWS_ACCESS_KEY_ID="$(echo $profile_data | grep aws_access_key_id | cut -f2 -d'=' | tr -d ' ')" | |
AWS_SECRET_ACCESS_KEY="$(echo $profile_data | grep aws_secret_access_key | cut -f2 -d'=' | tr -d ' ')" | |
set -x | |
export AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID | |
export AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY | |
set +x | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment