The Amazon command line interface tool is  called as in short  EC2 CLI tools that is composed in Java and included shell scripts for most of the linux and windows based machines. Before configuring EC2  API CLI tools , we need to install java JRE ( Java Runtime Environment) because tool are wrtten in Java Programming Language and also set Environment of Java .

Here we will follow below steps to setting up the cli on different Linux environment.

(1) Install of Java Latest Version

(2) Download the EC2 CLI tools

(3) Setting up CLI tool location

(4) Cinfigure Identity Location

(5) Verify EC2 Tools Setup

(1) Installation of Java Latest Version

Earlier we have already explain on our post to install , Update and configure Java Environment on linux, You can find below two links for java install and update.Follow below links for java invironment set.

Install and Upgrade Java Version 

Install Java on CentOs , RHEL etc…

Here is my system output :

[root@server jdk1.8.0_60]# java -version
java version "1.8.0_60"
Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)

(2) Download the EC2 CLI tools 

Here i have a download link from Amazon for EC2 API CLI Tools , You can simply download the tool and extract and configure some variables. Please find below download link for EC2 API tool.

Download  API Tools

Run below command to download and extract  API Tool.

# mkdir /opt/ec-tool

#cd /tmp

# wget

# unzip

# mv /tmp/ec2-api-tools-* /opt/ec-tool/tools

(3) Setting up CLI tool location

For Setting up Environment of EC2 tools We need some security credentials from AWS Console like AccessKey and SecretKey. You can get key from page security Credentials .

If you are using bash shell, you can set variables path in your ~/.bash_profile .Add the below line in ~/.bash_profile file and make changes according to you .

export EC2_BASE=/opt/ec-tool/
export EC2_HOME=$EC2_BASE/tools
export PATH=$PATH:$EC2_HOME/bin
export JAVA_HOME=/opt/jdk1.8.0_60
export EC2_URL=

Here i have set my default region us-east-1, You will make according to you , update your ACCESS_KEY and SECRET_KEY ID.

To update and set variable in ~/.bash_profile run below command.

# source ~/.bash_profile

(4)Verify  Set Up :

After set environment variable you can test through below command , Here is two basis command for check and verify setup . Run the below command , this will show a list of the aws instances which is currently connected to this account and whole information about instance like Id, DNS, ip etc  in your default region.

# ec2-describe-instances

Now run the below command.You will get all region which is currently associated with this account.

# ec2-describe-regions --aws-access-key=$AWS_ACCESS_KEY --aws-secret-key=$AWS_SECRET_KEY
REGION eu-west-1
REGION ap-southeast-1
REGION ap-southeast-2
REGION eu-central-1
REGION ap-northeast-1
REGION us-east-1
REGION sa-east-1
REGION us-west-1
REGION us-west-2

By Sachin G

I am a professional freelance contributor and founder of tech transit. Love to write and lover of education, culture, and community. I have been using it, setting, supporting, and maintaining it since 2009.Linux rocks! Sachin G Follow me on LinkedIn and x formerly twitter