I find looking up IP/key combos in order to SSH into Linux EC2 hosts pretty annoying. Managing multiple AWS accounts takes this to another level. 'aws' (it might expand beyond EC2) seeks to mitigate this. Clone it into your home directory, add your accounts and SSH keys, and fetch the EC2 API tools.
Usage and account list:
# aws
usage: /Users/astrostl/aws/bin/aws [account|account/instance|all] [command|-i]
example1 example2
Displaying "account/nametag: ssh string" for a given account:
# aws example1
example1/example1-web01: ssh -i ~/aws/keys/example1.pem [email protected]
example1/example1-web02: ssh -i ~/aws/keys/example1.pem [email protected]
Displaying "account/nametag: ssh string" for ALL accounts:
# aws all
example1/example1-web01: ssh -i ~/aws/keys/example1.pem [email protected]
example1/example1-web02: ssh -i ~/aws/keys/example1.pem [email protected]
example2/example2-db01: ssh -i ~/aws/keys/example2.pem [email protected]
example2/example2-db02: ssh -i ~/aws/keys/example2.pem [email protected]
Running a command on all instances for a given account (danger!) (this works for the "all" target too):
# aws example2 uname -m
example2/example2-db01: x86_64
example2/example2-db02: x86_64
Running a command on a specific instance in a given account (danger!):
# aws example2/example2-db01 uname -m
example2/example2-db01: x86_64
INTERACTIVE login to a specific instance in a given account:
# aws example2/example2-db01 -i
[ec2-user@domU-00-11-22-33-44-55 ~]$
BONUS: source the script and it will set up a direct API account tool usage env in your current shell
# . ~/aws/bin/aws example1
# ec2-describe-instances