AWS

How to Update AWS CLI to its Latest Version in Windows, Linux, and MacOS?

Amazon Web Services has become the leader and the top innovator in the modern era. Today, AWS is a compact platform for the IT industry and businesses to grow and scale. From storing huge volumes of data to implementing complex algorithms for a better understanding of customer preferences; AWS allows organizations across the world to scale their applications and retrieve, manage and maintain their data over multiple servers, and much more.

Quick Outline

This article presents information about:

What is AWS CLI?

Being a leading platform, AWS is not only confined to the browsers but can be accessed via the terminal of your Operating Systems too. AWS CLI helps its users unleash the great potential of different services and resources by using simple commands. It is a unified tool that can access, managing, manipulating, downloading, or configuring various resources. Furthermore, AWS CLI is supported by Windows, Linux, and MacOS.

How to Update the AWS CLI to its Latest Version?

Currently, the latest version of AWS CLI is version 2. So if you want to update your AWS CLI, you are at the right place. In this article, we will discuss:

How to Update the AWS CLI to its Latest Version in Windows?

In Windows, AWS CLI can be updated by re-installing the AWS CLI. This will automatically fetch the latest version of AWS CLI and update it accordingly:

Read more: How to Configure AWS Credentials?

Case 1: Update AWS CLI Using Choco

Before proceeding with this implementation, ensure that AWS CLI is installed on your local machines.

Chocolatey is a package manager that offers 59 various AWS packages. To install AWS CLI via Chocolatey refer to this article: “How to Install AWS CLI Using Chocolatey Package Manager?

Users can also update the AWS CLI with a single command via the Chocolatey Package manager. For this purpose, open the CMD in the administrative mode:

Provide the following command to the CMD for updating the AWS CLI version:

choco upgrade awscli

The output of the command is as follows:

Case 2: Update AWS CLI Using MSI

Another way of updating the AWS CLI is by re-installing the AWS CLI via the MSI. To install and update the AWS CLI in Windows, open the CMD in administrative mode:

Provide the following command to the command prompt for installing the latest version:

msiexec.exe /i https://awscli.amazonaws.com/AWSCLIV2.msi

Bonus Tip: The user can also directly download the installer by clicking here. Double-tap the downloaded installer to start the installation.

This command will begin installing the AWS CLI on your local machines:

The installation has started:

Tap the “Next” button on the displayed interface:

Check the agreement option and click the “Next” button to proceed further:

This will install the latest version of the CLI in the same directory where the older version was installed. However, the user can change the location by clicking the “Browse” button. By keeping the settings as default, click the “Next” button for this demo:

Tap the “Install” on the next window to begin installation:

This will take some time to install the AWS CLI:

The installation has been completed successfully:

On the CMD, the user can verify the version of the CLI by providing the following command:

aws -version

This will display the following output:

That is all from this section of the post.

How to Update AWS CLI to its Latest Version in the Linux OS?

To update the AWS CLI on the Linux Operating System, download the AWS CLI installer via curl or a package manager. This will overwrite the existing version of the AWS CLI installed on the Linux OS. Below are the steps given:

Case 1: Re-install the AWS CLI

Before moving towards the practical implementation of updating the AWS CLI, first install the “curl” by using the below-mentioned command:

sudo apt install curl

The installation has been successful:

Step 1: Download the Installer

To update the current version of the AWS CLI, use the following command to download the latest AWS CLI version:

For Linux x86 (64-bit)

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

For Linux ARM

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

The download of the AWS CLI has been successful:

Step 2: Unzip the Installer

After the successful installation, unzip the folder containing the files for AWS CLI by using the following command:

unzip awscliv2.zip

The file has been successfully unzipped:

Step 3: Install and Update AWS CLI

To update the AWS CLI, we will first install the AWS CLI. Within the command, we have specified the “–update” parameter which will automatically update the AWS CLI:

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

This command will prompt the user to enter the password for this Ubuntu account. After providing the password, it will start installing the CLI and will display the following output:

This re-installation will install the latest version of the AWS CLI. That is all from this section.

Case 2: Update AWS CLI Using APT

If you have installed the AWS CLI on your Linux OS with APT Package Manager, use the below-mentioned command to update the AWS CLI:

sudo apt-get install --only-upgrade awscli

The output of the command is as follows:

Case 3: Update AWS CLI Using Pip

Similarly, users can also update their AWS CLI using the “pip” library from Python. This is useful for those users who installed AWS CLI via Python. For installing the AWS CLI via pip, refer to this article: “Install AWS Command Line Interface (CLI) on Ubuntu 22.04 LTS”.

To update the AWS CLI to its newest version via pip, use the following command:

pip install awscli --upgrade --user

This will update the AWS CLI in the Linux OS using pip:

That is all from this section.

How to Update AWS CLI to its Latest Version in the Mac OS?

For Mac users, AWS CLI can be updated by using the following “curl” command:

curl "https://awscli.amazonaws.com/AWSCLIV2.pkg" -o "AWSCLIV2.pkg"

Version 2 of the AWS CLI has been downloaded successfully:

The next step is to install this package. For this, use the following command:

sudo installer -pkg AWSCLIV2.pkg -target /

The installation has been successful:

To verify that the shell can find the path of the AWS installer, use the following command:

which aws

The output of the command is given below:

The command is given as follows for verifying which version of the AWS CLI has been installed:

aws --version

The AWS CLI version 2 has been installed on the system:

That is all from this guide.

Bonus Tip: Benefits of Using AWS CLI

AWS CLI is a powerful unified tool that is compatible with multiple operating systems. Below are a few advantages of using the AWS CLI:

Easy Installation

Before the launch of the AWS CLI, the users accessed AWS by installing the EC2 Application Programing kit. This installation often resulted in multiple errors, leaving the user unable to access the AWS programmatically. However, now AWS CLI can be installed on your steps in a few simple steps.

High Performance

AWS CLI is designed and developed to provide fast responses and high responses to users.

Reduced Steps

With simple one-line commands, AWS CLI reduces the overall effort and saves the user time by achieving the same functionality as previously available by the AWS Console.

No Repetitive Login

Once you have configured AWS CLI with credentials, there is no need to provide the Access Key or Secret Access Key every time to log into the account.

Extensive Support

AWS CLI supports multiple AWS services like S3, EC2, RDS, etc, via simple scripts or commands.

Bottom Line

To update the AWS CLI, users can re-install the AWS CLI installer, use package managers such as apt and pip, or use the mentioned curl command for different OS. By updating the AWS CLI, users can lay their hands on the latest and improved functionality of AWS. Similarly, there are certain commands that are no longer supported by the older versions of AWS CLI. Therefore, it is considered a best practice to always update the CLI. This article provides an in-depth demonstration of updating the AWS CLI in different Operating Systems.

About the author

Shameen Shahid

I am a self-motivated technical content writer. I hold a bachelor’s degree in computer science an have expertise in AWS and want to share my knowledge with the world.