AWS CLI Tutorial: How To Install AWS Command Line Interface
This “AWS Command Line Interface” video by Cloud Guru will help you understand how to access and manage AWS Services using AWS CLI. The below topics have been covered in this session:
1. Introduction to Amazon Web Services
2. What Is AWS CLI?
3. Getting started with AWS CLI
4. Demo on AWS CLI
Let’s see how can we set up and configure AWS Command Line Interface (CLI).
Step 1: Install AWS Cli Tool:
URL to install latest version of Python: https://www.python.org
Step 2: First install PIP
curl -O https://bootstrap.pypa.io/get-pip.py
python get-pip.py –user
Step 3: Install AWS Cli
pip install awscli
Step 4: 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.
Step 5: Create Access Key
Login to AWS Console
Under your IAM name choose ‘My Security Credentials’
My Security Credentials
Click on Access Keys, create new one and save the Secret Access Key as you no longer going to have access to it anymore.
Step 6: Create Access Key
Go to your EC2 again and run ‘awsconfigure’
Put both Access and Secret Key
Choose your region or leave it empty for default
You can run simple commands like ‘aws ec2 describe-instances’ for testing.
Step 7: (Additional Step for 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
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
It should look similar to
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
Lastly try again running ‘aws configure’ and see the output which shows the last 3 characters if matching your keys.
Written by admin