个人工具

UbuntuHelp:EC2APITools

来自Ubuntu中文

跳转至: 导航, 搜索

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

  1. Install the sun-java5-jre package. <<FootNote(This is not an open source version of Java.)>> <<FootNote(You will need to have multiverse enabled in apt sources.)>> Use <Tab> <Enter> to accept license agreement.
   sudo apt-get install sun-java5-jre
 
  1. 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
  1. Unzip the ec2-api-tools.
   sudo apt-get install unzip
   unzip ec2-api-tools-1.3-34128.zip
 
  1. 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/ 
  1. 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.

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

Footnotes