Created
January 17, 2013 14:26
-
-
Save jamiebegin/4556263 to your computer and use it in GitHub Desktop.
Simple Bash script and alias used to manage multiple access credentials for Amazon Web Services from the command line.
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
# Place this command in your .bashrc (or whatever is appropriate for your shell of choice). | |
alias aws='client=$1 source ~/bin/aws.sh $client' |
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
#!/bin/bash | |
# Create this file as "~/bin/aws.sh" | |
export EC2_REGION='us-east-1' # Set default region | |
case "$1" in | |
"rbn") | |
export AWS_ACCESS_KEY='AKKDHH2HVQSHVQ32A' | |
export AWS_SECRET_KEY='vizCQvkKhmMioAP/BXSe4HANGh47azvAF' | |
export AWS_ACCOUNT='RBN' | |
;; | |
"gl") | |
export AWS_ACCESS_KEY='AKIADFGDFHHTP7ELQ' | |
export AWS_SECRET_KEY='Ty+mNit235235235ETiJY/rEfxJwbQ2h+b' | |
export EC2_REGION='us-west-1' # Override default region | |
export AWS_ACCOUNT='AnotherCompanyA' | |
;; | |
"mcg") | |
export AWS_ACCESS_KEY='AKIAJKA2F5KRZQDBZS7A' | |
export AWS_SECRET_KEY='tuQIiXgHY0B3nTEy6WaUzTsZwHUg1DiJtlAb' | |
export AWS_ACCOUNT='AnotherCompanyB' | |
;; | |
*) | |
export AWS_ACCOUNT="No account" | |
;; | |
esac | |
echo "$AWS_ACCOUNT is active." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Tnx!