AWS CLI Installation

The easiest way to install the AWS CLI is using pip, it is a package manager for Python that provides an easy way to install, upgrade, and remove Python packages and their dependencies.

Install Python pip

CentOS :
sudo yum update -y
sudo yum install -y python-pip
Ubuntu :
sudo apt-get update -y
sudo apt-get install -y python-pip

Install AWS CLI using pip

pip install awscli --upgrade --user

–upgrade option tells pip to upgrade any requirements that are already installed.
–user option tells pip to install the program to a subdirectory of your user directory to avoid modifying libraries used by your operating system.

Add the executable path to your PATH variable: ~/.local/bin
export PATH=$PATH:~/.local/bin
Load the profile into your current session
source ~/.bash_profile
Verify that the AWS CLI installed correctly by running aws --version.
aws --version
aws-cli/1.16.19 Python/2.7.5 Linux/3.10.0-862.11.6.el7.x86_64  botocore/1.12.9

Configure AWS CLI

To access aws services using cli, we need to provide the access key and secret key along with a default region. This can be done using a subcommand provided by aws cli.

$ aws configure
Default region name [None]: us-east-1
Default output format [None]: json

 I have used us-east-1 as default region and default output format is JSON. We can format the output as text and table formats as well.

aws configure command creates two configuration files located under .aws in user home directory.

ls ~/.aws/
config credentials
cat config 
output = json
region = us-east-1
cat credentials 
aws_access_key_id = XXXXXXXXXXXXXXXXXXXX

Verify if AWS CLI configuration

 Describe your regions
aws ec2 describe-regions
    "Regions": [
            "Endpoint": "", 
            "RegionName": "ap-south-1"
            "Endpoint": "", 
            "RegionName": "eu-west-3"
            "Endpoint": "",
            "RegionName": "eu-west-2"
        {   "Endpoint": "", 
            "RegionName": "us-west-2" 

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s