How to Update AWS CLI via the Command Line
This guide is split into two sections: how to install AWS CLI via the command line and how to update AWS CLI via the command line. It explains how to do this for Linux, Windows, and macOS.
Part 1: Install CLI
Part 2: Update CLI
PART1: Install AWS CLI via Command Line
Install the AWS CLI via the Command Line on Linux (Ubuntu)
Step 1: Update Package Lists
sudo apt update -y
Step 2: Install pip and unzip
sudo apt install python3-pip unzip -y
Step 3: Download and Install the AWS CLI
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" && unzip awscliv2.zip && sudo ./aws/install
Step 4: Verify Installation
aws --version
Install the AWS CLI via the Command Line on Windows using PowerShell
Step 1: Download the Installer
Invoke-WebRequest -Uri https://awscli.amazonaws.com/AWSCLIV2.msi -OutFile .\AWSCLIV2.msi
Step 2: Run the Installer
Double-click the downloaded “AWSCLIV2.msi” file and follow the on-screen instructions.
Step 3: Verify Installation
Open a new PowerShell window and run:
aws --version
Install the AWS CLI via the Command Line on MacOS (Terminal):
Step 1: Install Homebrew (if not already installed)
bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Step 2: Install the AWS CLI
brew install awscli
Step 3: Verify Installation
aws --version
PART 2: Update AWS CLI via Command Line
The update process is generally the same across operating systems:
Update AWS CLI via the Command Line on Linux (Ubuntu)
Step 1: Remove Existing Version
pip3 install --upgrade awscli
Note: Use pip
instead of pip3
if your Python environment defaults to Python 2)
Step 2: Verify Update
aws --version
Update AWS CLI via the Command Line on Windows (PowerShell)
Step 1: Update with MSI Installer
If you originally installed the AWS CLI using the MSI installer, the recommended way to update is by downloading and running the latest MSI installer again from the official AWS website. This will overwrite the older version with the updated one.
msiexec.exe /i https://awscli.amazonaws.com/AWSCLIV2.msi
Step 2: Update with pip (Alternative)
You can also try updating using pip (if you have it installed):
pip install --upgrade awscli
Step 3: Verify Update
aws --version
Update AWS CLI via the Command Line on MacOS (Terminal)
Step 1: Update with brew
brew upgrade awscli
Step 2: Verify Update
aws --version
Important Notes:
- Administrative Privileges: You’ll likely need administrative rights (e.g.,
sudo
on Linux/MacOS or running PowerShell as Administrator) to install or update system-wide. - Alternative Update Methods:
- Windows: If you installed using the MSI installer, you might need to download and re-run the latest installer to get updates.
- Linux: Some package managers (like
apt
) might offer update mechanisms (sudo apt install --only-upgrade awscli
).
- Shell Restart: After updating, it’s a good practice to restart your terminal or command prompt.
Recent Comments