In this article we are going to cover Download the AWS CLI Version for Amazon Linux, How to Install AWS CLI on Amazon Linux, Update AWS CLI Version on Amazon Linux and Uninstall AWS CLI Version from Amazon Linux.
Table of Contents
Prerequisites
- Amazon Linux EC2 installed with 64 bit version
- ec2-user Access
Update the System Packages
sudo yum update -y
Download the AWS CLI Version for Amazon Linux
To download the latest 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 Amazon Linux using unzip
unzip awscliv2.zip
Install AWS CLI on Amazon Linux
once extracted Install AWS CLI on Amazon 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 Amazon 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 Amazon Linux
To update AWS CLI on Amazon 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
Uninstall AWS CLI Version from Amazon 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
Conclusion:
We have covered Download the AWS CLI Version for Amazon Linux, How to Install AWS CLI on Amazon Linux, Update AWS CLI Version on Amazon Linux and Uninstall AWS CLI Version from Amazon Linux.
Related Articles:
How to Create IAM User in AWS Step by Step
How to Attach IAM Role to EC2 Instance using CLI
How to Create Ubuntu Instance in AWS [7 Steps]
How to Create Linux EC2 Instance in AWS
AWS Create EC2 Instance from Snapshot
How to connect to AWS EC2 Instance using MobaXTerm
How to Enable Password Authentication for AWS EC2
How to Connect EC2 Instance using Putty
How to Transfer files to AWS Instance using WinSCP [2 Steps]
Lambda Function to Start and Stop RDS Instance
How to Create AWS DocumentDB and Connect [3 steps]
How to Install MySQL 5.7 on Amazon Linux 2
How to Create Postgres Database in AWS and connect
Monitoring EC2 Instances using CloudWatch
Reference