Created
February 22, 2012 18:19
-
-
Save joshkraemer/1886460 to your computer and use it in GitHub Desktop.
AWS Local Machine Bash Configuration
This file contains hidden or 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
# Load Amazon EC2 API tools | |
source ~/.ec2/setup_env.sh |
This file contains hidden or 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
~/.ec2 | |
ec2 tools stored in /base, aws accounts stored in /accounts | |
Install ec2-ssh through PyPy tools: easy_install ec2-ssh | |
|-- accounts | |
| |-- awsaccount1 | |
| | |-- cert-*.pem | |
| | |-- pk-*.pem | |
| | |-- aws-key | |
| | |-- yourawssshkeys.pem | |
| |-- awsaccount2 | |
| | |-- cert-*.pem | |
| | |-- pk-*.pem | |
| | |-- aws-key | |
| | |-- yourawssshkeys.pem | |
|-- base | |
| |-- bin | |
| |-- lib | |
| |-- license.txt | |
| |-- notice.txt | |
| |-- THIRDPARTYLICENSE.TXT |
This file contains hidden or 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 | |
export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Home/ | |
export EC2_TOP=$( dirname $BASH_SOURCE ) | |
export EC2_HOME=$EC2_TOP/base | |
ALL_ACCOUNTS=$( ls $EC2_TOP/accounts ) | |
EC2_TOOLS=$( ls $EC2_HOME/bin | grep -v .cmd ) | |
THIS_KEY='' | |
THIS_CERT='' | |
for a in $ALL_ACCOUNTS; do | |
THIS_KEY=$( ls $EC2_TOP/accounts/$a/pk-*.pem ) | |
THIS_CERT=$( ls $EC2_TOP/accounts/$a/cert-*.pem ) | |
source $EC2_TOP/accounts/$a/aws-key | |
alias $a-ec2-ssh="ec2-ssh -k $key -s $secret" | |
alias $a-ec2-host="ec2-host -k $key -s $secret" | |
for e in $EC2_TOOLS; do | |
alias $a-$e="$EC2_HOME/bin/$e -K $THIS_KEY -C $THIS_CERT" | |
done | |
THIS_KEY='' | |
THIS_CERT='' | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment