How to Install AWS CLI v2 on Ubuntu

ยท

1 min read

Update Your System

Before installing AWS CLI, ensure your system is up to date:

sudo apt update && sudo apt upgrade -y

Download AWS CLI v2 Installer

AWS provides an official installation package for Linux. Download it using curl:

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

If you donโ€™t have curl, install it first:

sudo apt install curl -y

Unzip the Installer

Use unzip to extract the package:

sudo apt install unzip -y  # Install unzip if not available
unzip awscliv2.zip

Install AWS CLI v2

Run the installer script:

sudo ./aws/install

This installs AWS CLI globally in /usr/local/bin/aws.

Verify Installation

Check if AWS CLI is installed correctly:

aws --version // will display the install version of aws cli

Configure AWS CLI (Optional)

To start using AWS CLI, configure it with your credentials:

aws configure

You'll need to enter:

  • AWS Access Key ID

  • AWS Secret Access Key

  • Default Region (e.g., us-east-1)

  • Output Format (json, table, or text)

  • ~/.aws folder contains credentials and config file which has the aws cli config data


Uninstall AWS CLI v2 (If Needed)

To remove AWS CLI v2, run:

sudo /usr/local/bin/aws/uninstall
ย