How to Upgrade the AWS CLI to the Latest Version

How to Upgrade the AWS CLI to the Latest Version

Written on August 1st, 2023 by Danny Steenman.

Last updated: August 4th, 2023.


Upgrading your AWS CLI V2 to the latest version is a crucial part of maintaining your AWS environment. An updated AWS CLI ensures optimal performance, access to new features, and better security.

This guide will walk you through the process of upgrading your AWS CLI to the latest version, without using Python pip for the installation and update.

Check the Installed AWS CLI Version

Before we begin with the upgrade process, it's essential to check the currently installed AWS CLI version on your machine. Currently AWS actively maintains two versions of the AWS CLI, which is Version 1 and Version 2.

On the long term version 1 will be deprecated, so it's recommended to start using version 2. You can check which version you are currently running by using the following command in your terminal:

aws --version

This will return the current AWS CLI version installed on your machine, along with some additional information such as the Python version and the operating system.

 aws --version
aws-cli/2.11.1 Python/3.11.4 Darwin/22.5.0 source/x86_64 prompt/off

Note: If you haven't installed the AWS CLI v2 yet and you're a Linux or Windows user. Then you can do this by visiting the official AWS CLI user guide and install the appropriate version for your operating system.

For MacOS users I would recommend to install the AWS CLI v2 via homebrew.

Install the Latest AWS CLI Version

1. Update the AWS CLI v2 version on Linux

To install the latest version of AWS CLI v2 on Linux you need to download the official installer and the run the following command to update the executable on your machine.

# Download 64 bit linux installer
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
 
# Or download ARM linux installer
curl "https://awscli.amazonaws.com/awscli-exe-linux-aarch64.zip" -o "awscliv2.zip"
 
# Next unzip the contents and update your awscliv2 version
unzip awscliv2.zip
sudo ./aws/install --bin-dir /usr/local/bin --install-dir /usr/local/aws-cli --update

The --upgrade flag ensures that the installer updates the current executable and installation dir with the newly updated files. Note: make sure to use the correct --bin-dir and --install-dir location.

2. Update the AWS CLI v2 version on MacOS

To install the latest version of AWS CLI v2 on MacOS you can make use of Homebrew to easily update the awscli on your machine via a simple command:

 brew upgrade awscli
 
==> Fetching awscli
==> Downloading https://ghcr.io/v2/homebrew/core/awscli/manifests/2.13.5
Already downloaded: /Users/dsteenman/Library/Caches/Homebrew/downloads/32200fd8ea1a8ded93dbf2f0413ea2e272e8f245d1ded3507f8904bf2772d53b--awscli-2.13.5.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/awscli/blobs/sha256:d3e35b6367578f872136051ed54274f3d27832aa3395d1e9910952c9966b007b
Already downloaded: /Users/dsteenman/Library/Caches/Homebrew/downloads/09caa67e5e61cabc71e05bdb090e024fbd01d5194f13e5cda54903c0949bbeb2--awscli--2.13.5.ventura.bottle.tar.gz
==> Pouring awscli--2.13.5.ventura.bottle.tar.gz
==> Caveats
The "examples" directory has been installed to:
  /usr/local/share/awscli/examples
 
zsh completions and functions have been installed to:
  /usr/local/share/zsh/site-functions
==> Summary
🍺  /usr/local/Cellar/awscli/2.13.5: 13,649 files, 119.9MB
==> Running `brew cleanup awscli`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).

3. Update the AWS CLI v2 version on Windows

To update your current installation of AWS CLI on Windows, download a new installer each time you update to overwrite previous versions.

The official AWS CLI MSI installer for Windows can be downloaded from here:

https://awscli.amazonaws.com/AWSCLIV2.msi

Verify the newly updated version

After successfully installing the latest AWS CLI version, you should verify the installation.

You can do this by checking the installed AWS CLI version. Run the aws --version command again:

 aws --version
aws-cli/2.13.5 Python/3.11.4 Darwin/22.5.0 source/x86_64 prompt/off

The version displayed should be the new version you just installed.

Troubleshooting common issues

Upgrading the AWS CLI should typically be a smooth process, but you might encounter some issues.

If the installation fails or the new version doesn't show up after installation, ensure that the AWS CLI binaries are in your PATH environment variable.

Conclusion

Upgrading the AWS CLI to the latest version involves checking your current version, downloading the installer package and using that to update the current installation executable on your system.

It's a good practice to keep your AWS CLI updated to the latest version to leverage the newest features, bug fixes, and security patches.

With the steps provided in this guide, you can now easily upgrade your AWS CLI.

Share this article on ↓

Subscribe to our Newsletter

If you're interested in AWS Cloud, Infrastructure as Code, DevOps, and getting certified in AWS then subscribe to my newsletter to get exclusive tips and tricks on becoming a successful Cloud Engineer.

Loading subscribers...