The AWS Command Line Interface (AWS CLI) is how you create EC2 instances, upload to S3, manage IAM users, and automate cloud work from a terminal—without clicking through the AWS Management Console for every step. On Ubuntu you can install it from Amazon’s official v2 bundle, from apt in universe, or from the Snap store.
This guide shows how to install AWS CLI on Ubuntu the way I run it on cloud VMs and local workstations: official v2 installer when I want the newest build, apt install awscli when I want distribution packaging, and Snap when auto-updates matter. You will configure credentials with aws configure, verify with aws sts get-caller-identity, and learn what to do when which aws points at the wrong binary.
Tested on: Ubuntu 25.04 (Plucky Puffin); kernel 6.14.0-37-generic; amd64.
aws. Keep one primary install on your PATH. If you previously used pip install awscli (v1), remove it before installing v2, or expect confusing aws --version output—see AWS migration guide.
Quick command summary
| Task | Command |
|---|---|
Check if aws exists |
command -v aws |
| Inspect apt candidate | apt-cache policy awscli |
| Install v2 (official, recommended) | curl zip → unzip → sudo ./aws/install |
| Install from Ubuntu universe | sudo apt update && sudo apt install -y awscli |
| Install Snap (Amazon) | sudo snap install aws-cli --classic |
| Verify version | aws --version |
| Configure credentials | aws configure |
| Test identity | aws sts get-caller-identity |
| Update official v2 | Re-download zip → sudo ./aws/install … --update |
| Remove official v2 | sudo rm -rf /usr/local/aws-cli /usr/local/bin/aws |
Prerequisites
- Ubuntu 22.04 LTS, 24.04 LTS, or newer (25.04 tested here) on x86_64 for the commands below. ARM64 hosts need the aarch64 installer zip instead.
- sudo for system-wide installs.
- curl and unzip for the official bundle (
sudo apt install -y curl unzip). - Outbound HTTPS to
awscli.amazonaws.comand your AWS API endpoints. - For
aws configure: an IAM access key or SSO profile (see AWS CLI tutorial for creating keys and first EC2/S3 commands).
What you are installing
| Method | Binary location | Version line (tested) | Best for |
|---|---|---|---|
| Official v2 installer | /usr/local/bin/aws |
aws-cli/2.35.11 … exe/x86_64 |
Latest features, teams that pin upstream builds |
apt install awscli |
/usr/bin/aws |
aws-cli/2.23.6 … source/x86_64 |
Ubuntu-supported updates via apt |
Snap aws-cli |
/snap/bin/aws |
Tracks Amazon channels | Hands-off updates (--classic) |
On Ubuntu 25.04, awscli in universe is AWS CLI v2—not the old v1 Python package from a few years ago. The official bundle still ships newer point releases than apt at the time of writing.
Method 1: Official AWS CLI v2 installer (recommended)
Amazon’s supported path for AWS CLI v2 on Linux is a self-contained installer you download with curl. I use this on bastion hosts and CI images when I want the same version AWS documents in getting started install.
Install dependencies:
sudo apt update
sudo apt install -y curl unzipDownload, extract, and install:
cd /tmp
curl -fsSL "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o awscliv2.zip
unzip -q awscliv2.zip
sudo ./aws/installNear the end of the install you should see:
You can now run: /usr/local/bin/aws --versionConfirm:
aws --version
which awsOn my Ubuntu 25.04 host that printed:
aws-cli/2.35.11 Python/3.14.5 Linux/6.14.0-37-generic exe/x86_64.ubuntu.25
/usr/local/bin/awsThe exe/ segment means you are running the bundled v2 binary, not the distro Python build.
Update an existing official v2 install
Re-download the zip, extract, and pass --update:
cd /tmp
curl -fsSL "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o awscliv2.zip
unzip -qo awscliv2.zip
sudo ./aws/install --bin-dir /usr/local/bin --install-dir /usr/local/aws-cli --updateMethod 2: Install AWS CLI from apt (universe)
When you want Ubuntu-packaged AWS CLI and routine apt upgrade updates, install awscli from universe:
sudo apt update
sudo apt install -y awscliCheck the candidate before you install:
apt-cache policy awscliOn Ubuntu 25.04 I saw:
awscli:
Installed: (not installed)
Candidate: 2.23.6-1
Version table:
2.23.6-1 500
500 http://archive.ubuntu.com/ubuntu plucky/universe amd64 PackagesAfter apt install, verify:
/usr/bin/aws --versionaws-cli/2.23.6 Python/3.13.3 Linux/6.14.0-37-generic source/x86_64.ubuntu.25If you already installed the official bundle, which aws may still show /usr/local/bin/aws because that path sorts earlier on PATH. Use type -a aws to see every copy.
Method 3: Install AWS CLI from Snap
Amazon publishes aws-cli on Snapcraft. Classic confinement avoids sandbox issues with credential files and shell completion:
sudo snap install aws-cli --classicConfirm:
/snap/bin/aws --versionSnap refreshes automatically unless you pinned a channel. For v1 compatibility (legacy scripts only), Amazon documents snap install aws-cli --channel=v1/stable --classic—prefer v2 for new work.
PATH strategy. Automation and cron jobs often invoke the first aws on PATH, not the one you tested interactively.
Configure AWS CLI on Ubuntu
After install, wire credentials and a default Region. Interactive setup:
aws configureYou will be prompted for:
- AWS Access Key ID and Secret Access Key (from IAM → Users → Security credentials), or leave blank when using SSO profiles later.
- Default region name (for example
us-east-1orap-south-1). - Default output format (
json,yaml,text, ortable—press Enter for JSON).
Files are written under ~/.aws/credentials and ~/.aws/config.
Test that credentials work:
aws sts get-caller-identityWith valid keys you get JSON containing Account, UserId, and Arn. Without credentials you see Unable to locate credentials—install succeeded; configuration is the next step.
For hands-on EC2 and S3 examples after configure, continue with AWS CLI explained with practical examples. Building a cluster on EC2 also assumes a working CLI—see setup Kubernetes on AWS EC2.
Daily checks and shell completion
| Task | Command |
|---|---|
| List S3 buckets (smoke test) | aws s3 ls |
| Region in config | aws configure get region |
| CLI help | aws help |
| Service help | aws s3 help |
Enable bash completion for the official install (optional):
echo 'complete -C /usr/local/bin/aws_completer aws' >> ~/.bashrcAdjust the path if you installed only via apt (/usr/bin/aws_completer when present).
Uninstall
Official v2 bundle:
sudo rm -rf /usr/local/aws-cli /usr/local/bin/aws /usr/local/bin/aws_completer
hash -rAPT:
sudo apt purge -y awscli
sudo apt autoremove -ySnap:
sudo snap remove aws-cliRemove ~/.aws only when you no longer need stored profiles.
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
aws: command not found |
Not installed or PATH missing /usr/local/bin |
Install via Method 1 or 2; open a new shell; command -v aws |
aws --version shows old 1.x |
Legacy pip v1 or mixed installs | pip3 uninstall awscli; remove duplicate binaries; reinstall v2 only |
which aws ≠ expected path |
Multiple installs | type -a aws; remove one method or call full path |
Unable to locate credentials |
aws configure not run |
Run aws configure or set AWS_ACCESS_KEY_ID / AWS_SECRET_ACCESS_KEY / AWS_DEFAULT_REGION |
unzip: command not found |
Missing unzip | sudo apt install -y unzip |
curl: (6) Could not resolve host |
DNS or offline host | Fix networking; verify curl -fsSL https://awscli.amazonaws.com/… |
apt awscli not found |
Universe disabled | Enable universe in Software & Updates; sudo apt update |
Permission denied on ./aws/install |
Extract failed or wrong directory | cd into folder containing aws/install; chmod +x aws/install |
Snap aws vs /usr/local/bin/aws differ |
Parallel installs | Pick one package manager; adjust PATH for scripts |
References
- Installing or updating the latest version of the AWS CLI — official Linux x86_64 and aarch64 installers
- Getting started with the AWS CLI — configure, regions, output formats
- Migration guide for AWS CLI version 2 — v1 → v2
- AWS CLI v1 Linux install (legacy) — maintenance-mode v1 only
- aws/aws-cli on GitHub — source and changelog
- Ask Ubuntu: How to install AWS CLI
- AWS re:Post: installing AWS CLI on a server
- Install AWS CLI Snap
- On-site: install curl on Ubuntu, apt command, AWS CLI tutorial, AWS tutorial, Kubernetes on AWS EC2
Summary
The reliable way to install AWS CLI on Ubuntu for most production and dev machines is Amazon’s official v2 Linux installer: download awscli-exe-linux-x86_64.zip, run sudo ./aws/install, and confirm aws-cli/2.x with exe/ in aws --version. Use sudo apt install awscli when you want Ubuntu universe packaging (v2 on current releases, but often behind the official bundle). Snap aws-cli --classic is a valid choice when you want Amazon-maintained auto-updates.
After install, run aws configure, then aws sts get-caller-identity before you script against live accounts. If versions disagree, type -a aws almost always reveals a second install shadowing the one you thought you were using.

