How to Install the EC2 API Command Line Tool for Windows

17. February 2011 01:38

Getting the EC2 Command Line API Tools to work on windows was beneficial for me so I thought I would share it with others. I found it to be beneficial because I was in a situation where I wanted to change the instance size one one of my Windows instances. You can't accomplish this from the amazon management console, but you can from their api command line tool.

This was installed on Windows 7 Ultimate 64-bit


First step is to download the tools from the following URL

http://aws.amazon.com/developertools/351?_encoding=UTF8&jiveRedirect=1


Once you have the tool downloaded, extract the file to a directory of your choosing.  I chose to extract the tool into C:\EC2\

Second step is that you will need your x.509 certs from your amazon account.

To accomplish this

  • I went to my "account" page within AWS Management Console
  • Clicked on Security Credentials
  • Under access credentials sections I clicked Create new certificate and downloaded the private key and certificate when prompted too.


Note: Keep track of where you downloaded them. I just put them in my C:\EC2\ directory to keep things in one place


Third, you will need to make sure you have the Java SDK installed.  I downloaded it here


http://www.oracle.com/technetwork/java/javase/downloads/index.html


Fourth, you will need to enter Environment Variables on your Windows system.

I entered in the following environment variables

Variable: EC2_CERT
Value: Path to your cert file name you got from amazon
Example: C:\EC2\cert-XYXYXYXXYXYXY.pem


Variable: EC2_HOME
Value:  C:\EC2\

This needs to be the location where the api tools are

Variable: EC2_PRIVATE_KEY
Value: Path to the file of your private key you got from amazon
Example: C:\EC2\pk-XYXYXYXYXYXXYXY.pem

Variable: JAVA_HOME
Value: C:\Program Files\Java\jdk1.6.0_23\

This needs to be the path where you installed the Java SDK


This should do it. You should now be able to run the following command to make sure it is working properly:

ec2-describe-regions

 

To change the instance type of an instance, first stop the instance, then run the following command

ec2-modify-instance-attribute yourInstanceID -t m1.xlarge

In the command above replace yourInstanceID with your actual instance id and then change m1.xlarge to the actual size you want it to be.

Then start your instance back up and you are good to go with the new size.


Here is a link to the API reference doc.

http://docs.amazonwebservices.com/AWSEC2/latest/CommandLineReference/

Tags:

Amazon Cloud

blog comments powered by Disqus



My Random Thought

I think the OCW is a great thing to have available to those who are in school, just finished school or just want to educate themself

http://ocwconsortium.org/

John On Twitter

Discounts