Tested April 2026 on Debian 13, Amazon Linux 2023, and macOS 26.3 with AWS CLI 2.34.27
AWS CLI v2 is the only version worth installing at this point. v1 is legacy, pip-based, and missing support for newer services like aws s3files (the S3 Files mount feature), SSO login, auto-pager, and the installer-based distribution that replaced the old pip workflow. If you’re still on v1, upgrade now.
This guide covers a clean install on any Linux distribution and macOS, plus configuration, shell autocompletion, named profiles, and common first commands to verify everything works.
Install AWS CLI v2 on Linux
AWS distributes a single zip installer that works across all x86_64 Linux distributions: Ubuntu, Debian, Rocky Linux, AlmaLinux, Fedora, Amazon Linux, SUSE, and anything else running a standard glibc. No distro-specific repos needed.
Prerequisites
You need curl and unzip. Most minimal server installs ship without unzip, so install it first.
On Debian and Ubuntu:
sudo apt install -y unzip curl
On Rocky Linux, Fedora, AlmaLinux, or Amazon Linux:
sudo dnf install -y unzip curl
Download and Install
Grab the installer zip and run it. The whole process takes about 30 seconds.
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o /tmp/awscliv2.zip
cd /tmp && unzip -q awscliv2.zip
sudo ./aws/install
The installer drops the binary into /usr/local/bin/aws and the full package into /usr/local/aws-cli/. You should see this confirmation:
You can now run: /usr/local/bin/aws --version
For ARM64 systems (AWS Graviton instances, Raspberry Pi, or any aarch64 host), use the ARM installer instead:
curl "https://awscli.amazonaws.com/awscli-exe-linux-aarch64.zip" -o /tmp/awscliv2.zip
cd /tmp && unzip -q awscliv2.zip
sudo ./aws/install
Confirm the installation by checking the version:
aws --version
On a Debian 13 x86_64 system, the output looks like this:
aws-cli/2.34.27 Python/3.14.3 Linux/6.12.57+deb13-amd64 exe/x86_64.debian.13
Install AWS CLI v2 on macOS
macOS gets a standard PKG installer. It’s a universal binary that works on both Intel and Apple Silicon Macs without Rosetta.
curl -o /tmp/AWSCLIV2.pkg "https://awscli.amazonaws.com/AWSCLIV2.pkg"
sudo installer -pkg /tmp/AWSCLIV2.pkg -target /
Check that it installed correctly:
aws --version
On an M-series Mac running macOS 26.3:
aws-cli/2.34.26 Python/3.14.3 Darwin/25.3.0 exe/arm64
If you prefer Homebrew, that works too:
brew install awscli
The PKG installer is the official route and what AWS recommends. Homebrew sometimes lags behind on new releases by a day or two.
Update AWS CLI v2
The update process is nearly identical to the initial install. The installer detects an existing installation and overwrites it.
On Linux, download the latest zip and pass the --update flag:
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o /tmp/awscliv2.zip
cd /tmp && unzip -q -o awscliv2.zip
sudo ./aws/install --update
The -o flag on unzip overwrites existing files without prompting.
On macOS, just re-run the PKG installer. It handles the upgrade automatically:
curl -o /tmp/AWSCLIV2.pkg "https://awscli.amazonaws.com/AWSCLIV2.pkg"
sudo installer -pkg /tmp/AWSCLIV2.pkg -target /
After updating, verify the new version with aws --version.
Configure AWS CLI
With the CLI installed, connect it to your AWS account. The interactive setup prompts for four values.
aws configure
You’ll be asked for:
- AWS Access Key ID (from IAM console)
- AWS Secret Access Key
- Default region (e.g.,
us-east-1,eu-west-1) - Default output format (
json,table, ortext)
These values get stored in ~/.aws/credentials and ~/.aws/config. Verify the stored configuration:
aws configure list
The output confirms which credentials are active and where they came from:
Name Value Type Location
---- ----- ---- --------
profile None None
access_key ****************XXXX shared-credentials-file
secret_key ****************YYYY shared-credentials-file
region us-east-1 config-file ~/.aws/config
Test that the credentials actually work by querying your account identity:
aws sts get-caller-identity
A successful response returns your account ID, user ARN, and user ID in JSON format. If you get an authentication error, double-check the access key and secret in ~/.aws/credentials.
Named Profiles
Most engineers work with multiple AWS accounts: dev, staging, production. Named profiles keep those credentials separate instead of constantly editing ~/.aws/credentials.
Create a named profile:
aws configure --profile production
Then target that profile on any command:
aws s3 ls --profile production
If you’re working in one account for a while, set it as the default for your shell session:
export AWS_PROFILE=production
Every aws command in that terminal session will use the production profile until you unset it or close the terminal.
Enable Shell Autocompletion
Tab completion for AWS CLI commands, subcommands, and resource names saves a surprising amount of time. The completer ships with the installer but needs to be wired into your shell.
For Bash:
echo 'complete -C /usr/local/bin/aws_completer aws' | tee -a ~/.bashrc
source ~/.bashrc
For Zsh:
echo 'autoload bashcompinit && bashcompinit' | tee -a ~/.zshrc
echo 'complete -C /usr/local/bin/aws_completer aws' | tee -a ~/.zshrc
source ~/.zshrc
After sourcing, type aws s3 and hit Tab to see all S3 subcommands.
Common First Commands
Once configured, here are a few commands worth running to confirm everything is wired up and to get familiar with the output formats.
List all S3 buckets in the account:
aws s3 ls
List EC2 instances with their state and type in a clean table:
aws ec2 describe-instances --query "Reservations[*].Instances[*].[InstanceId,State.Name,InstanceType]" --output table
Show your current account and IAM identity:
aws sts get-caller-identity
List all available AWS regions:
aws ec2 describe-regions --query "Regions[*].RegionName" --output table
The --query flag uses JMESPath syntax to filter JSON output. Combined with --output table, it produces readable results without piping through jq.
Uninstall AWS CLI v2
If you need to remove it completely from Linux, delete the installation directory and the symlinks:
sudo rm -rf /usr/local/aws-cli
sudo rm /usr/local/bin/aws
sudo rm /usr/local/bin/aws_completer
On macOS, the same removal works. If you installed via the PKG GUI, you can also remove it from Applications.
AWS CLI v2 is the foundation for all AWS automation, whether you’re scripting deployments, piping output into other tools, or building infrastructure with Ansible playbooks for AWS. For the full reference on every service and subcommand, see the official AWS CLI v2 documentation.