Installing and Updating AWS CLI on Linux

Installing and Updating AWS CLI on Linux

In this article we will look how we can install and update AWS CLI on Ubuntu distribution.

·

1 min read

Prerequisites

Create an Ubuntu 22.04 LTS instance.

$ cat /etc/issue
Ubuntu 22.04.3 LTS \n \l

Install some prerequisite packages. These packages are included by default in most major distributions of Linux.

$ sudo apt update

$ sudo apt install unzip glibc-source groff less

Installing the CLI

Download the latest AWS CLI zip file.

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

Extract the downloaded zip file.

$ unzip awscliv2.zip

Run the install program using elevated privileges.

$ sudo ./aws/install --bin-dir /usr/local/bin --install-dir /usr/local/aws-cli

Verify the version of CLI.

$ aws --version
aws-cli/2.13.32 Python/3.11.6 Linux/6.2.0-1012-aws exe/x86_64.ubuntu.22 prompt/off

Updating the CLI

Download the latest AWS CLI zip file. Here we are using the same zip file downloaded earlier.

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

Extract the downloaded zip file with -u flag. This will automatically update existing files and create new ones as needed.

$ unzip -u awscliv2.zip

Run the install program using elevated privileges with --update flag.

$ sudo ./aws/install --bin-dir /usr/local/bin --install-dir /usr/local/aws-cli --update

Verify the version of CLI.

$ sudo ./aws/install --bin-dir /usr/local/bin --install-dir /usr/local/aws-cli --update
Found same AWS CLI version: /usr/local/aws-cli/v2/2.13.32. Skipping install.

Reference

https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html