Last active
September 23, 2015 20:05
-
-
Save ErikHarmon/a9d23351e2340ebfb696 to your computer and use it in GitHub Desktop.
Keep encrypted AWS credentials for use in interactive BASH shell
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
# encrypted AWS credentials | |
# call this script via source command, such as: | |
# . awscreds.sh | |
# to include AWS environment credentials in your interactive shell to | |
# run AWS tools. | |
# | |
# ENCRYPTED_VARS is a base64-encoded, AES-encrypted set of exported | |
# AWS_ACCESS_KEY and AWS_SECRET_KEY. You can encode them this way: | |
# | |
# openssl aes-256-cbc -salt -a <<EOF | |
# export AWS_ACCESS_KEY=whatever | |
# export AWS_SECRET_KEY=whatever | |
# EOF | |
# | |
# and enter a passphrase twice. Then put the output into ENCRYPTED_VARS | |
ENCRYPTED_VARS="U2FsdGVkX18A/6f0Qe1T51cCbpoQ4GmCBs503QMQ+NMFSPHlRF2SaXbfaQpz0lH6 | |
4x37fC6fY9g0Xd+KvI5GV+gN8RNXbWPFZU371lYUb/k=" | |
eval $(openssl aes-256-cbc -d -a <<EOF | |
${ENCRYPTED_VARS} | |
EOF | |
) | |
export AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY} | |
export AWS_SECRET_ACCESS_KEY=${AWS_SECRET_KEY} | |
export EC2_URL=http://ec2.us-east-1.amazonaws.com | |
export EC2_REGION=us-east-1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment