Using Amazon EC2 command line interface

You can easily manage your Amazon AWS resource like Amazon EC2 instances, EBS volumes & VPC, etc.. through command line tools.

Before you start using these tools, it needs dependency softwares to run.

In this example, I am going to show you AWS command line tool configuration on Linux.

Prerequisites:
This tools requires Java 1.6 or later. Also we need to make sure that JAVA_HOME is set. You can refer this link to install/configure JAVA on linux.

Download and Install AWS command line tools.

1. Download AWS tools using below URL.

wget http://s3.amazonaws.com/ec2-downloads/ec2-api-tools.zip

2. Extract it at some location. For example, I will extract these tools at /home/ec2 directory.

3. Once you extract zip file at /home/ec2 folder, you need to set EC2_HOME variable now. You can set this variable in bashrc or in /etc/profile file.

export EC2_HOME=/home/ec2
export PATH=$PATH:$EC2_HOME/bin

4. Now you should be able to use tools. But its good to configure access_key and secret_key before we use these tools. As these tools requires them to authenticate. So you can include them in bashrc or /etc/profile.

export AWS_ACCESS_KEY=your-aws-access-key-id
export AWS_SECRET_KEY=your-aws-secret-key

5. Once you are done with all above command, you can check "ec2-describe-regions". This command will show you one or more region which are available to you.

Note: You need to have proper privileges associated with Access key to perform action on resources.