How to Install AWS CLI on Linux [2 Steps]

In this article, We are going to perform How to Install AWS CLI on Linux, Update AWS CLI Version on Linux, How to Install AWS CLI on Ubuntu 20.04 LTS using pip3, How to Install AWS CLI on Ubuntu 18.04/16.04 using pip, How to Install AWS CLI on CentOS 8/RHEL using pip3, How to Install AWS CLI on CentOS 7 using pip, Configure AWS CLI, Uninstall AWS CLI Version from Linux

Prerequisites

  • Linux OS with 64 bit version
  • SSH access with sudo privileges
  • Python 2.6.5+ or Python 3.3+

Method 1:

Download the AWS CLI Version for Linux using curl/wget

To download the latest AWS CLI version for 64 bit Linux using curl use below command

curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"

if you want download specific version of AWS CLI version then use below command

curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64-awscliversion.zip" -o "awscliv2.zip"

To download AWS CLI Version 2.0.30 use below command

curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64-2.0.30.zip" -o "awscliv2.zip"

Extract AWS CLI Setup on Linux using unzip

unzip awscliv2.zip

Install AWS CLI on Linux

once extracted Install AWS CLI on Linux using below command

sudo ./aws/install

Output:

sudo ./aws/install
You can now run: /usr/local/bin/aws --version

Check the AWS CLI version using command line on Linux

/usr/local/bin/aws --version

Output:

aws-cli/2.1.28 Python/3.8.8 Linux/4.14.214-160.339.amzn2.x86_64 exe/x86_64.amzn.2 prompt/off

OR

aws --version

Output:

aws-cli/2.1.28 Python/3.8.8 Linux/4.14.214-160.339.amzn2.x86_64 exe/x86_64.amzn.2 prompt/off

Update AWS CLI Version on Linux

To update AWS CLI on Linux first check installation path where AWS CLI installed

which aws

Output:

/usr/local/bin/aws

find the symlink of AWS CLI installation directory using ls

ls -l /usr/local/bin/aws

Output:

lrwxrwxrwx 1 root root 37 Feb 23 09:24 /usr/local/bin/aws -> /usr/local/aws-cli/v2/current/bin/aws

use symlink with install command with update parameter as shown below

sudo ./aws/install --bin-dir /usr/local/bin --install-dir /usr/local/aws-cli --update

check the AWS CLI version after updating

aws version

Method 2:

How to Install AWS CLI on Ubuntu 20.04 LTS using pip3

Install python3-pip on Ubuntu 20.04

sudo apt update
sudo apt -y install python3-pip

To upgrade the pip3 to latest version on Ubuntu 20.04

sudo pip3 install --upgrade pip

Install aws cli on Ubuntu 20.04 using pip3

sudo pip3 install awscli

Upgrade the aws cli using pip3

sudo pip3 install awscli --upgrade

How to Install AWS CLI on Ubuntu 18.04/16.04 using pip

Install python-pip on Ubuntu

sudo apt-get update
sudo apt-get -y install python-pip

To upgrade python pip version to latest version

sudo pip install --upgrade pip

Install aws cli on Ubuntu using pip

sudo pip install awscli

Upgrade the aws cli using pip3 to latest version

sudo pip install awscli --upgrade

How to Install AWS CLI on CentOS 8/RHEL using pip3

First install python3 and python3-pip using below command

sudo dnf install -y python3 python3-pip

Install aws cli on CentOS 8 using pip3

sudo pip3 install awscli

To install aws cli on CentOS 8 for current user

pip3 install awscli --upgrade --user

How to Install AWS CLI on CentOS 7 using pip

Install the epel repository on CentOS 7 if not already not installed

yum install epel-release

Install python-pip on CentOS using below command

sudo yum -y install python-pip

Upgrade the pip to latest version on CentOS 7

sudo pip install --upgrade pip

Install aws cli on CentOS 7 using pip

sudo pip install awscli

upgrade the aws cli on CentOS 7 using pip

sudo pip install awscli --upgrade

Configure AWS CLI

To connect AWS using CLI we have configure AWS user using below command

aws configure

it will ask AWS Access Key ID, AWS Secret Access Key, Default region name, Default output format

AWS Access Key ID [None]: *********7G
AWS Secret Access Key [None]: ***********************px
Default region name [None]: ap-south-1
Default output format [None]: json

Now you have connected your aws account using AWS CLI.

Uninstall AWS CLI Version from Linux

First find the symlink where AWS CLI version is installed

which aws

Output:

/usr/local/bin/aws

Find the installation directory using symlink

ls -l /usr/local/bin/aws

Output:

lrwxrwxrwx 1 root root 37 Feb 23 09:24 /usr/local/bin/aws -> /usr/local/aws-cli/v2/current/bin/aws

remove the below aws cli installed directories

sudo rm /usr/local/bin/aws
sudo rm /usr/local/bin/aws_completer

remove the AWS CLI installation directory

sudo rm -rf /usr/local/aws-cli

To uninstall aws cli using pip3

pip3 uninstall awscli

Conclusion:

We have covered How to Install AWS CLI on Linux, Update AWS CLI Version on Linux, How to Install AWS CLI on Ubuntu 20.04 LTS using pip3, How to Install AWS CLI on Ubuntu 18.04/16.04 using pip, How to Install AWS CLI on CentOS 8/RHEL using pip3, How to Install AWS CLI on CentOS 7 using pip, Configure AWS CLI, Uninstall AWS CLI Version from Linux

Related Articles:

How to Install AWS CLI on MAC OS

How to Install AWS CLI on Ubuntu 20.04/18.04/16.04 LTS

How to Install Azure CLI on Linux

Reference:

AWS CLI official page

FOSS TechNix

FOSS TechNix (Free,Open Source Software's and Technology Nix*) founded in 2019 is a community platform where you can find How-to Guides, articles for DevOps Tools,Linux and Databases.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Share via
Copy link