Practical Linux, Windows Server and cloud guides for IT pros.

How to Install and Update the AWS CLI (Windows, macOS, & Linux Guide)

The AWS Command Line Interface (CLI) is an essential tool for any developer, sysadmin, or DevOps engineer working with Amazon Web Services. It allows you to control and automate hundreds of AWS services directly from your terminal, streamlining everything from resource management to complex deployment scripts.

Filed under

Published

Written by

Last updated

AWS-Vault secure credentials guide

TL;DR

  • AWS CLI v2 is the current supported version — v1 still works but is in maintenance mode.
  • Windows: MSI installer. macOS: Homebrew or PKG. Linux: bundled installer or package manager.
  • After install, run aws configure to set credentials — better, use aws configure sso for IAM Identity Center.
  • Update by re-running the installer; CLI v2 supports in-place updates without uninstalling first.

What is the AWS CLI?

The AWS Command Line Interface (AWS CLI) is the official Amazon-supported tool for managing AWS services from a terminal. It wraps the same APIs the AWS console uses, which means anything you can click in the console you can script in the CLI — and version-control, share, and rerun.

AWS CLI v2 is the current major release. It bundles its own Python runtime (no system Python dependency), supports IAM Identity Center single-sign-on, and ships with autocomplete out of the box. v1 is still maintained for security but no longer receives feature work — new installations should always be v2.

Prerequisites

  • Admin rights on Windows / macOS / Linux to install system software.
  • An AWS account and either an IAM access key or IAM Identity Center access for credentials.
  • Roughly 200 MB free disk for the CLI itself.

How to use this guide

The sections below walk through the practical commands and options. After the main content you’ll find a Verification block (sanity-check it actually worked), a Troubleshooting block (common error messages and what to do), and Related reading for follow-on topics.

The AWS Command Line Interface (CLI) is an essential tool for any developer, sysadmin, or DevOps engineer working with Amazon Web Services. It allows you to control and automate hundreds of AWS services directly from your terminal, streamlining everything from resource management to complex deployment scripts.

This guide provides clear, step-by-step instructions for installing and updating the latest version of AWS CLI (v2) on Windows, macOS, and Linux using only the command line. We’ll focus on the official, recommended methods to ensure a stable and reliable setup.

Install & Update AWS CLI on Windows

The recommended method for Windows is using the official MSI installer, which can be downloaded and run silently via PowerShell. You will need administrator privileges.

1. Check for an Existing Installation (Optional)

Open a new Command Prompt or PowerShell window and run:

aws --version

If the CLI is installed, this command will return the installed version. If not, you’ll see an error.

2. Install or Update the AWS CLI

This single set of commands works for both a fresh installation and for updating an existing one. The MSI installer automatically handles overwriting the old version with the new one.

  • Open PowerShell as Administrator.
  • Download the latest official AWS CLI MSI installer:
Invoke-WebRequest -Uri "https://awscli.amazonaws.com/AWSCLIV2.msi" -OutFile "AWSCLIV2.msi"

  • Run the installer silently: The /quiet flag installs the CLI for all users without showing a graphical interface.
msiexec.exe /i "AWSCLIV2.msi" /quiet 

3. Verify the Installation

Important: You must close and reopen your PowerShell or Command Prompt window for the new PATH to take effect.

aws --version

The output should now show the latest version, for example: aws-cli/2.22.0 Python/3.12.6 Windows/11 exe/AMD64.

Install & Update AWS CLI on macOS

For macOS, the most common and straightforward method is using the Homebrew package manager.

1. Check for an Existing Installation (Optional)

Open a new Terminal window and check if the CLI is already installed:

aws --version

2. Install or Update with Homebrew

If you don’t have Homebrew, you can install it with a single command from their official website:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

  • To install the AWS CLI, run the following brew command. Homebrew automatically taps the correct formula for the latest version of AWS CLI v2.

brew install awscli

  • To update an existing Homebrew installation, simply run the upgrade command:

brew upgrade awscli

3. Verify the Installation

Open a new terminal session to ensure you’re using the updated version and run:

aws --version

Install & Update AWS CLI on Linux

AWS recommends using the official bundled installer for all Linux distributions, including Ubuntu, Amazon Linux, and CentOS. This method avoids potential conflicts with system Python packages.

1. Check for an Existing Installation (Optional)

In your terminal, check for a pre-existing version of the CLI:

aws --version

2. Install or Update the AWS CLI

These steps download the official installer, unzip it, and run the installation script. The script automatically handles both new installs and updates.

  • Download the latest installer package. We use curl to fetch the 64-bit Linux package.

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

  • Unzip the installer. If you don’t have unzip, install it first with sudo apt install unzip or sudo yum install unzip.

unzip awscliv2.zip
  • Run the install script. Use sudo to install the CLI to the default location (/usr/local/aws-cli), which makes it available to all users. The --update flag will replace an existing installation with the version you just downloaded.

sudo ./aws/install --update

3. Verify the Installation

Check the version to confirm the process was successful.

aws --version

After installation or an update, you can safely remove the files you downloaded:

rm -f awscliv2.zip
rm -rf aws

Next Steps: Configure Your Credentials

Once the AWS CLI is installed, your next step is to configure it with your security credentials. Run the following command and follow the prompts:

aws configure

You will be asked for your:

  • AWS Access Key ID
  • AWS Secret Access Key
  • Default region name (e.g., us-east-1)
  • Default output format (e.g., json)

This creates a credentials file that the CLI uses to authenticate your requests to AWS services.

Verification

Sanity-check the install / change actually worked:

  • Run aws --version — confirms the CLI is installed and shows the major.minor.patch version.
  • Run aws sts get-caller-identity — confirms credentials are set and shows the AWS account, IAM user/role and ARN you’re authenticated as.
  • Run aws s3 ls — lists S3 buckets in the configured account/region; quick smoke-test for working IAM permissions.

Troubleshooting

aws: command not found — The install completed but the CLI isn’t on your PATH. Open a fresh terminal. On Linux/macOS, check echo $PATH includes /usr/local/bin. On Windows, restart the command prompt or sign out and back in.

Unable to locate credentials — No credentials configured. Run aws configure or, for SSO, aws configure sso. Confirm with aws configure list.

Multiple AWS profiles, wrong one used by default — Set AWS_PROFILE=<name> in your shell, or pass --profile <name> on each command.

Authoritative sources

The canonical reference is the AWS CLI v2 install guide and the aws-cli v2 changelog on GitHub for current release notes.

Related reading

Leave a Reply

Your email address will not be published. Required fields are marked *

Find more on the site

Keep reading by topic.

If this post was useful, the fastest way to keep going is to pick the topic you work in most often.

Want another useful post?

Browse the latest posts, or support TurboGeek if the site saves you time regularly.

Translate »