Install AWS CLI Tutorial

How to Install AWS CLI

Install AWS Cli Tutorial

Check Video Tutorial Here

 

Check your python version:

python --version

If you don't have python installed or if you have 3.x then it needs to be '3.3' or  newer, if you have 2.x then it needs to be '2.6' or newer otherwise upgrade Python first.

First install PIP < Python Package Index >

  • curl -O https://bootstrap.pypa.io/get-pip.py
  • python get-pip.py --user
  • export PATH=~/.local/bin:$PATH
  • source ~/.bash_profile
Install AWS Cli
  • pip install awscli

 

Configure AWS Cli

Perquisite: you need to have your Access Key and Secret Access Key, if you don't have one follow the below steps otherwise skip that part.

Create Access Key [ Skip this step if you already have a key ]

  1. Login to AWS Console
  2. Under your IAM name choose 'My Security Credentials'
    My Security Credentials
  3. Click on Access Keys, create new one and save the Secret Access Key as you no longer going to have access to it anymore.

Configure AWS CLI

  1. Go to your EC2 again and run 'aws configure'

    AWS Configure

  2. Put both Access and Secret Key
  3. Choose your region or leave it empty for default
  4. You can run simple commands like 'aws ec2 describe-instances' for testing.
Troubleshooting

If you are getting errors like:

An error occurred (AuthFailure) when calling the DescribeInstances operation: AWS was not able to validate the provided access credentials

Or

An error occurred (UnrecognizedClientException) when calling the DetectLabels operation: The security token included in the request is invalid.

You can confirm the keys by checking the configuration in below path

vi ~/.aws/config

It should look similar to

[default]
region = us-west-2
aws_access_key_id = AKI************
aws_secret_access_key = Isx8***************

You can also try debug mode

aws ec2 describe-instances --debug

In some cases the server time should be synced, so be sure that you have ntp and it's on

yum install ntp
systemctl start ntpd
ntpstat

Lastly try again running 'aws configure' and see the output which shows the last 3 characters if matching your keys.

 


Subscribe to
for video tutorials updates