How to Install AWS CLI v2 on Ubuntu 22.04

Managing AWS resources through the command line becomes much easier when you have AWS Command Line Interface (CLI) v2 installed on your system. Here is a step-by-step guide to installing AWS CLI v2 on an Ubuntu 22.04 machine running on Windows Subsystem for Linux (WSL) 2.


  • AWS Account and Credentials: Have an AWS account and generate an access key ID and secret access key through the AWS Management Console. They are needed for configuring the CLI.
  • Ubuntu 22.04 Running on WSL: Your WSL should have Ubuntu 22.04 LTS installed.
  • Sudo Privileges: The ability to run commands as a superuser for installing software.

Step 1: Open WSL Terminal

Firstly, launch your WSL 2 terminal by searching for “WSL” in the Start menu or running wsl from the command prompt.

Ensure you have unzip installed to extract the downloaded archive. If not, install it using:

sudo apt update
sudo apt install unzip

Step 2: Download the AWS CLI v2 Package

Use curl to download the official AWS CLI v2 installation package:

curl "" -o ""

Step 3: Unzip the Installation Package

After downloading the package, extract its contents using:


This will create an aws directory.

Step 4: Install AWS CLI v2

Navigate into the aws directory and execute the installation script with superuser privileges:

sudo ./aws/install

Wait for the installation process to complete.

Step 5: Verify AWS CLI v2 Installation

Check if AWS CLI v2 has been installed correctly:

aws --version

You should see version information printed out similar to this:

aws-cli/2.x.xx Python/3.x.xx Linux/4.x.xx botocore/2.x.xx

Step 6: Configure AWS CLI

Once installed, you’ll need to configure it with your credentials:

aws configure

Enter your AWS Access Key ID, Secret Access Key, and other configuration settings as prompted:

  • AWS Secret Access Key [None]: YOUR_SECRET_ACCESS_KEY_HERE
  • Default region name [None]: YOUR_DEFAULT_REGION_HERE (e.g., us-west-2)
  • Default output format [None]: json

These credentials are used to authenticate your CLI sessions and determine which AWS account and region the CLI interacts with.


You’ve successfully installed AWS CLI v2 on your WSL 2 machine running Ubuntu 22.04 and configured it to connect to your AWS account. You can now manage your AWS resources through the command line efficiently and securely.

Happy cloud computing!

Leave a Comment

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