In this article, We are going to perform How to Install AWS CLI on Ubuntu 16.04/18.04/20.04 LTS, Installing AWS CLI using Bundled Installer, How to Install AWS CLI using APT on Ubuntu,How to Install AWS CLI using Python PIP and Uninstall AWS CLI from Ubuntu.
Introduction
AWS CLI (Command Line Interface) is a tool by AWS which is used to manage AWS Resources.
Prerequisites
- Ubuntu 18.04/18.04/20.04 LTS with minimal installation
- SSH Access with admin privileges
- Python 2+ OR Python 3+ Version
Method #1: Installing AWS CLI using Bundled Installer
Download the aws cli bundle using below command
sudo curl https://s3.amazonaws.com/aws-cli/awscli-bundle.zip -o awscli-bundle.zip
Install the unzip and python on Ubuntu if not installed
sudo apt install unzip python
Extract the aws cli bundle setup
sudo unzip awscli-bundle.zip
Configure the AWS CLI on Ubuntu
sudo ./awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws
Verify the AWS CLI version
aws --version
Output:
aws-cli/1.18.97 Python/2.7.18rc1 Linux/5.4.0-1015-aws botocore/1.17.20
Method #2: How to Install AWS CLI on Ubuntu using APT
First update the System packages
sudo apt-get update
Install the AWS CLI using below command, Press “Y” then “Enter“.
sudo apt-get install awscli
once installed check the AWS CLI version using below command
aws --version
Output:
aws-cli/1.18.69 Python/3.8.5 Linux/5.4.0-1037-aws botocore/1.16.19
Method #3: How to Install AWS CLI using Python PIP
We can Install AWS CLI using Python 2.x and Python 3.x.
Install AWS CLI using Python 2.x PIP
on Ubuntu 16.04/18.04 LTS
sudo apt-get install python-pip
on Ubuntu 20.04 LTS
on Ubuntu 20.04 Python 2 is not supported.
Install AWS CLI using using PIP
pip install awscli --upgrade --user
Check the AWS CLI using Python 2.x PIP
python -m awscli --version
Install AWS CLI using Python 3.x PIP on Ubuntu
Update the system packages
sudo apt update
Install Python 3 pip on Ubuntu 20.04 LTS
sudo apt -y install python3-pip
Upgrade the PIP to latest version
sudo pip3 install --upgrade pip
Install the AWS CLI using PIP
sudo pip3 install awscli
To check AWS CLI version using python 3
python3 -m awscli --version
Output:
aws-cli/1.19.12 Python/3.8.5 Linux/5.4.0-1037-aws botocore/1.20.12
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 from Ubuntu
Check the AWS CLI Installation path
which aws
Output:
/usr/local/bin/aws
Check the symlink and installation directory path
ls -l /usr/local/bin/aws
Output:
-rwxr-xr-x 1 root root 815 Feb 22 08:00 /usr/local/bin/aws
Remove the Installation directory
sudo rm -f /usr/local/bin/aws
Conclusion:
We have covered How to Install AWS CLI on Ubuntu, Installing AWS CLI using Bundled Installer, How to Install AWS CLI using APT on Ubuntu,How to Install AWS CLI using Python PIP and Uninstall AWS CLI from Ubuntu.
Related Articles:
9 Steps to Setup Kubernetes on AWS using KOPS
How to Install AWS CLI on Linux
Reference: