Last active
November 6, 2020 17:00
-
-
Save kwoods/5ceca1dc793270ea2790d043ef01800b to your computer and use it in GitHub Desktop.
ZSH Shell Function for populating ENV with AWS Keys from ~/.aws/credentials profiles
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
# Usage: aws_env_helper <profile-name-in-aws-credentials> | |
# add this to your ~/.zshrc | |
aws_env_helper () { | |
readonly profile=${1:?"The aws profile must be specified."} | |
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_SESSION_TOKEN="$(aws configure get aws_session_token --profile $profile)" | |
export AWS_PROFILE=$profile | |
export AWS_RETRY_MODE=adaptive | |
export AWS_MAX_ATTEMPTS=10 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment