Last active
August 29, 2015 14:14
-
-
Save dm/5ed77663c48a8e5c5f28 to your computer and use it in GitHub Desktop.
AWS CLI for multiple clients
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
# in ~/.dotfiles/zsh/alias.zsh | |
alias aws='client=$1 source ~/.dotfiles/bin/aws.zsh $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/zsh | |
# in ~/.dotfiles/bin/aws.zsh | |
export EC2_REGION='eu-west-1' | |
case "$1" in | |
"cl1") | |
export AWS_ACCESS_KEY='ACC1' | |
export AWS_SECRET_KEY='KEY1' | |
export AWS_ACCOUNT='Client 1' | |
;; | |
"cl2") | |
export AWS_ACCESS_KEY='ACC2' | |
export AWS_SECRET_KEY='KEY2' | |
export EC2_REGION='us-west-2' # Override default region | |
export AWS_ACCOUNT='Client 2' | |
;; | |
"cl3") | |
export AWS_ACCESS_KEY='ACC3' | |
export AWS_SECRET_KEY='KEY3' | |
export AWS_ACCOUNT='Client 3' | |
;; | |
*) | |
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