-
-
Save dfevre/354b1aeb9a526165dd88d78861d53f2b to your computer and use it in GitHub Desktop.
Get environment variables from AWS profile (for use with docker-machine)
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
# The following is a ~/.zshrc function that exports an aws cli profile from ~/.aws/credentials to environment variables. | |
aws_env() { | |
export AWS_ACCESS_KEY_ID=$(aws configure get aws_access_key_id --profile "$1"); | |
export AWS_SECRET_ACCESS_KEY=$(aws configure get aws_secret_access_key --profile "$1"); | |
export AWS_SESSION_TOKEN=$(aws configure get aws_session_token --profile "$1"); | |
export AWS_SECURITY_TOKEN=$(aws configure get aws_security_token --profile "$1"); | |
export AWS_DEFAULT_REGION=$(aws configure get region --profile "$1"); | |
echo "$1 environment variables exported"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment