To install the EC2 API Tools for an older version of Ubuntu, please run the following steps:
sudo apt-get install sun-java5-jre
- Download the Amazon EC2 Command-Line Tools from the Amazon EC2 resource Center.
- Unzip the ec2-api-tools.
sudo apt-get install unzip unzip ec2-api-tools-1.3-34128.zip
- Make sure you have the following environment variables set up in your shell profile. This is accomplished by adding the following lines to your ~/.bashrc if you use bash as your shell:
export EC2_HOME=$HOME/ec2-api-tools-1.3-34128 export PATH=$PATH:$EC2_HOME/bin export EC2_PRIVATE_KEY=$HOME/<where your private key is>/pk-XXXXXXXXXXXXXXXXXXXXXXXXXXXX.pem export EC2_CERT=$HOME/<where your certificate is>/cert-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.pem export JAVA_HOME=/usr/lib/jvm/java-1.5.0-sun/
- Check to see if it's working by running the following command:
ec2-describe-images -o self -o amazon
Note: If this fails due to "Client.AuthFailure" then ensure you have signed up for both AWS and ec2 with amazon.com, and have provided valid payment details. Also double check that the EC2_PRIVATE_KEY and EC2_CERT point to the correct locations.
- To use public AMIs you have to generate an ssh key. Run the following command which will also save the private key returned to a local file called ec2-keypair:
ec2-add-keypair ec2-keypair > ec2-keypair.pem
- Make sure the permissions on the file is 600.
chmod 600 ec2-keypair.pem