AWS Command Line Interface (AWS CLI) is used to interact with different  AWS (Amazon Web Services) product and services in command-line shell. AWS CLI version 2 is the latest one. In this article, we'll see how to download and install AWS CLI on Windows Subsystem for Linux (WSL 2).

Video:

Update current packages and upgrade as a best practice.

abhijit@AwsJunkie:~$ sudo apt update -y && sudo apt upgrade -y

As per the AWS documentation, "The AWS CLI uses glibc, groff, and less. These are included by default in most major distributions of Linux.". AWS CLI installer is packaged as zip, so we need unzip too.  

For demo, I am using Ubuntu 22.04.2 LTS WSL Linux distribution.

abhijit@AwsJunkie:~$ sudo apt install glibc-source groff less unzip -y

Download the installer.

abhijit@AwsJunkie:~$ curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 46.9M  100 46.9M    0     0  8774k      0  0:00:05  0:00:05 --:--:-- 11.7M

abhijit@AwsJunkie:~$ ls -l
total 48048
-rw-r--r-- 1 abhijit abhijit 49199589 Feb 23 20:35 awscliv2.zip

Unzip the downloaded installer package (e.g. awscliv2.zip). It will be unzipped in aws directory.

abhijit@AwsJunkie:~$ unzip awscliv2.zip
abhijit@AwsJunkie:~$ ls -l
total 48056
drwxr-xr-x 3 abhijit abhijit     4096 Feb 22 20:05 aws
-rw-r--r-- 1 abhijit abhijit 49199589 Feb 23 20:35 awscliv2.zip

Run sudo ./aws/install to install AWS CLI.

abhijit@AwsJunkie:~$ sudo ./aws/install
You can now run: /usr/local/bin/aws --version

Check AWS CLI version to confirm the installation.

abhijit@AwsJunkie:~$ aws --version
aws-cli/2.10.2 Python/3.9.11 Linux/5.10.102.1-microsoft-standard-WSL2 exe/x86_64.ubuntu.22 prompt/off

Happy Learning!

References