To install the EC2 API Tools for an older version of Ubuntu, please run the following steps:

  1. Install the sun-java5-jre package. 1 2 Use <Tab> <Enter> to accept license agreement.

       sudo apt-get install sun-java5-jre
  2. Download the Amazon EC2 Command-Line Tools from the Amazon EC2 resource Center.
    wget http://s3.amazonaws.com/ec2-downloads/ec2-api-tools-1.3-34128.zip
  3. Unzip the ec2-api-tools.
       sudo apt-get install unzip
       unzip ec2-api-tools-1.3-34128.zip
  4. 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/ 
  5. 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.

  6. 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
  7. Make sure the permissions on the file is 600.
       chmod 600 ec2-keypair.pem

Footnotes

  1. This is not an open source version of Java. (1)

  2. You will need to have multiverse enabled in apt sources. (2)

EC2APITools (last edited 2009-04-25 15:48:39 by 130)