DEV Community

Cover image for Installing and Updating AWS CLI on Linux
Unni P
Unni P

Posted on • Originally published at iamunnip.hashnode.dev

Installing and Updating AWS CLI on Linux

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

Prerequisites

Create an Ubuntu 22.04 LTS instance.

$ cat /etc/issue Ubuntu 22.04.3 LTS \n \l 
Enter fullscreen mode Exit fullscreen mode

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 
Enter fullscreen mode Exit fullscreen mode

Installing the CLI

Download the latest AWS CLI zip file.

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

Extract the downloaded zip file.

$ unzip awscliv2.zip 
Enter fullscreen mode Exit fullscreen mode

Run the install program using elevated privileges.

$ sudo ./aws/install --bin-dir /usr/local/bin --install-dir /usr/local/aws-cli 
Enter fullscreen mode Exit fullscreen mode

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 
Enter fullscreen mode Exit fullscreen mode

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" 
Enter fullscreen mode Exit fullscreen mode

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

$ unzip -u awscliv2.zip 
Enter fullscreen mode Exit fullscreen mode

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 
Enter fullscreen mode Exit fullscreen mode

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. 
Enter fullscreen mode Exit fullscreen mode

Reference

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

Top comments (0)