Access AWS from command line – quick reference
One of cool feature of Amazon AWS is ability to talk to AWS ecosystem thru command line. Why do i think that this is cool, because you can script it. Let’s take a look at setting it up.This is not a detailed guide, its just a quick reference.
We are gonna use the command line from a shell. Our goal right now is to get ‘values’ for the key listed below. Line starting with ‘#’ are to be ignored and meant for explanation.
#JAVA_HOME -> where you java installation, the below path works for Mac. For linux and Windows it would be different
export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Home/
# ec2-api-tools, this need to be downloaded from http://s3.amazonaws.com/ec2-downloads/ec2-api-tools.zip and place it where ever you want.
export EC2_HOME=/Applications/ec2/ec2-api-tools
# both the .pem has to be generated and download, and if you mis you will have to regenerate. I normally keep this is my dropbox.
export EC2_PRIVATE_KEY=~/.ec2/pk-xxxxx.pem
export EC2_CERT=~/.ec2/cert-xxxxx.pem
# available from the http://aws.amazon.com/account/
export EC2_ACCNO=1111-2222-3333
export ACCESS_KEY=BABBIO4XTFPTE6UYD3BQ
export SECRET_KEY=jcbsdsadcusjkh867HJk+897bnHygTQoEHj
# for easy access
export PATH=$PATH:$EC2_HOME/bin
Login to your account and click security credentials:
Get your Access and Secret Keys:
Generate your certificate and download pk***.pem and cert-***.pem
Get you ec2 account number:
Reference:
http://aws.amazon.com/documentation/
Detailed reference of commnad line
http://docs.amazonwebservices.com/AWSEC2/latest/CommandLineReference/



