Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
AWS Local Machine Bash Configuration
# Load Amazon EC2 API tools
source ~/.ec2/setup_env.sh
~/.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
#!/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
You can’t perform that action at this time.