Can I use the EC2 command line tools?

You can install the EC2 command-line tool with the following steps:


Download from that link “Download the Amazon EC2 API Tools from Amazon S3.” inDeveloper Tools: Amazon EC2 API Tools and copy it to the server.

Install runtime environment of Java and ec2-api-tools.

Connect to the server with SSH, and execute the following command:

# yum install -y java-1.7.0-openjdk.x86_64
# unzip
# mv ec2-api-tools-1.6.x.x /usr/local/bin/
# ln -s /usr/local/bin/ec2-api-tools-1.6.x.x /usr/local/bin/ec2-api-tools

Acquisition of private key and X.509 certificate

Download the X.509 certificate and private key from AWS Web site, and save to ~/ec2keys/ in the server.

Setting Environment Variables

Please add the following to ~/.bash_profile.

export JAVA_HOME="/usr/lib/jvm/jre"
export EC2_HOME="/usr/local/bin/ec2-api-tools"
export EC2_PRIVATE_KEY="~/ec2keys/pk-********************************.pem"
export EC2_CERT="~/ec2keys/cert-********************************.pem"


export PATH

Replace EC2_PRIVATE_KEY="~/ec2keys/pk-***.pem" and export EC2_CERT="~/ec2keys/cert-***.pem" with the file name of the private key and X.509 certificate that you have downloaded each.

Then, execute the following command to reflect the change:

# source ~/.bash_profile


Connect to the server with SSH and make sure you can execute the ec2-describe-regionscommand.

Have more questions? Submit a request


Please sign in to leave a comment.
Powered by Zendesk