How to Install AWS CLI on Ubuntu

Deepak Prasad
Tested on Ubuntu 26.04 LTS (Resolute Raccoon)
Package Official install script / ZIP aws-cli/2.38.1
awscli 2.31.35-1 (apt, universe)
Snap aws-cli (Amazon channel; version varies with refresh)
Applies to Ubuntu 22.04 LTS, 24.04 LTS, and 26.04 LTS (APT availability differs by release)
Privilege sudo for system-wide install, Snap, and apt; user-local install script needs no root
Scope Install AWS CLI v2 on Ubuntu with AWS install script (recommended), optional official ZIP for pinning or GPG verification, Snap, or Ubuntu awscli APT; verify the binary, authenticate with aws login, IAM Identity Center, or access keys when required, update official installs with aws update, uninstall per method, and resolve PATH conflicts. Does not cover AWS service tutorials beyond sts get-caller-identity.
Related guides AWS CLI tutorial
curl command
which command
apt command
check Ubuntu version
Short on time?Beta Get the gist of this 16-minute read in seconds, then ask follow-up questions

The AWS Command Line Interface (AWS CLI) is how you manage EC2, S3, IAM, and the rest of AWS from a terminal. On Ubuntu you can install current AWS CLI v2 from Amazon's install script or ZIP bundle, from the aws-cli Snap AWS publishes, or from Ubuntu's awscli APT package. Each method has a different updater and package maintainer.

This guide compares AWS's officially supported install script, ZIP installer, and Snap package with Ubuntu's awscli APT package on Ubuntu 26.04, with real aws --version output from each path tested independently. You will verify the binary, authenticate, and confirm identity with aws sts get-caller-identity.

IMPORTANT
AWS CLI v1 and v2 both install a command named aws. Keep one primary install on your PATH. pip install awscli installs v1—do not use it for a new v2 setup. Remove legacy pip installs before installing v2, or expect confusing aws --version output.

Before you start

  • Install only: aws --version works without an AWS account. Sign-in and API calls need access to an AWS account through console credentials, IAM Identity Center, an EC2 instance role, or another credential provider.
  • Install script and ZIP need curl and outbound HTTPS. Minimal images may not ship curl yet.
  • User-local installs put the CLI under ~/.local for your Linux account only. System-wide installs put it under /usr/local so every local user can run the same binary.

Quick Answer

AWS recommends its official install script for AWS CLI v2.

If curl is not installed yet:

bash
sudo apt update && sudo apt install -y curl

Install AWS CLI for your current Ubuntu user (no sudo):

bash
curl -fsSL https://awscli.amazonaws.com/v2/install.sh | bash

If aws is not found, put the user-local binary directory on PATH for this shell:

bash
export PATH="$HOME/.local/bin:$PATH"

Open a new terminal after you add that line to ~/.bashrc if you want it in every session. Then verify:

bash
aws --version

For a system-wide installation instead:

bash
curl -fsSL https://awscli.amazonaws.com/v2/install.sh | sudo bash -s -- --system

Ubuntu 26.04 also provides an awscli package through APT, and AWS publishes an official Snap. Ubuntu's APT package and AWS's Snap use different versions and update commands, as explained below.


Does sudo apt install awscli Work on Ubuntu?

It depends on the Ubuntu release. Many readers assume apt install awscli works the same on every LTS—it does not.

Ubuntu release sudo apt install awscli Typical package
26.04 LTS Yes (universe) AWS CLI v2 (aws-cli/2.x, source/ build)
24.04 LTS No awscli package candidate in the default Ubuntu 24.04 archive Use install script, ZIP, or Snap
22.04 LTS Yes (universe) Legacy AWS CLI v1 (aws-cli/1.x)

On 26.04, inspect the candidate before you install:

bash
apt-cache policy awscli
output
awscli:
  Installed: (none)
  Candidate: 2.31.35-1
  Version table:
     2.31.35-1 500
        500 http://in.archive.ubuntu.com/ubuntu resolute/universe amd64 Packages

The 2.31.35-1 candidate confirms universe ships v2 on this release. Amazon does not maintain third-party APT repositories; Ubuntu's package is Ubuntu-maintained, not an AWS-supported distribution point like the install script, ZIP, or Snap.


Choose an AWS CLI installation method

The outputs in the install sections below were collected while testing each method independently. Choose one primary installation on your own system—do not install every method unless you are deliberately comparing builds.

Method Best for Updates Maintained by aws login (needs CLI 2.32.0+)
AWS install script Most users; latest AWS CLI v2 aws update or sudo aws update AWS Supported on current 2.x installs
Official ZIP Pinning a version; GPG verification Same as install script AWS Supported on current 2.x installs
Snap aws-cli Hands-off refreshes from Amazon Snap auto-refresh; sudo snap refresh aws-cli to force AWS (Snap package) Supported on current v2 channel
Ubuntu APT awscli (26.04: 2.31.35) Ubuntu package lifecycle and apt upgrade sudo apt install --only-upgrade awscli Ubuntu Not available—package is older than 2.32.0; use SSO, keys, a role, or an official newer build

For most laptops and servers, use the install script. Use the ZIP when you must verify signatures or install a specific build. Choose Snap if you want automatic updates. Choose APT if you specifically want Ubuntu to manage the package version.

A user-local install serves only your account under ~/.local. A system-wide install under /usr/local is shared by all users on the host.

AWS CLI versions on Ubuntu 26.04, 24.04, and 22.04

Install path Binary (typical) Version line (tested on 26.04) Notes
Install script / official ZIP /usr/local/bin/aws or ~/.local/bin/aws aws-cli/2.38.1 … exe/ or script-exe/ Matches current upstream 2.x
apt install awscli (26.04) /usr/bin/aws aws-cli/2.31.35 … source/ Older point release than official 2.x
Snap aws-cli /snap/bin/aws aws-cli/2.x … exe/ Channel version moves with Snap refresh

The exe/, script-exe/, or update-exe/ segment in aws --version marks Amazon's bundled binary. source/ marks Ubuntu's Python-packaged build.


Install AWS CLI v2 with the AWS install script

Amazon's install script downloads the same bundle as the ZIP installer, picks x86_64 or aarch64 automatically, and can install without root for a single user.

Install for the current user

User-local layout (default):

  • CLI files: $HOME/.local/share/aws-cli
  • Binary: $HOME/.local/bin/aws

Download and run the script with curl (-fsSL fails on HTTP errors and follows redirects):

bash
curl -fsSL https://awscli.amazonaws.com/v2/install.sh | bash

The script prints the install path and reminds you to put ~/.local/bin on PATH when needed:

output
You can now run: /home/user/.local/bin/aws --version
AWS CLI 2.38.1 installed to /home/user/.local/share/aws-cli
Ensure /home/user/.local/bin is on your PATH.

Call the binary directly until PATH includes ~/.local/bin:

bash
~/.local/bin/aws --version
output
aws-cli/2.38.1 Python/3.14.6 Linux/7.0.0-34-generic script-exe/x86_64.ubuntu.26

Install AWS CLI system-wide

System-wide layout matches the ZIP installer:

  • Install dir: /usr/local/aws-cli
  • Binary: /usr/local/bin/aws

Run the script with --system when you have sudo:

bash
curl -fsSL https://awscli.amazonaws.com/v2/install.sh | sudo bash -s -- --system

After it finishes, verify:

bash
aws --version
output
aws-cli/2.38.1 Python/3.14.6 Linux/7.0.0-34-generic exe/x86_64.ubuntu.26

Verify the installation

Confirm which binary your shell resolves first:

bash
command -v aws
output
/usr/local/bin/aws

On a user-local install, command -v aws shows ~/.local/bin/aws only after that directory precedes other copies on PATH. If a new shell still cannot find aws, run export PATH="$HOME/.local/bin:$PATH" before you retry.


Optional: Install AWS CLI v2 with the official ZIP

Use the ZIP when you need GPG signature verification before install or when you want to stage a specific bundle without piping a script. AWS documents verification steps in its install guide (linked in References).

Install curl and unzip if your image is minimal:

Refresh package indexes before you install helpers:

bash
sudo apt update

Install curl and unzip when the ZIP workflow needs them:

bash
sudo apt install -y curl unzip

The install script picks architecture for you; the ZIP does not. Check the machine architecture first:

bash
uname -m

Use awscli-exe-linux-x86_64.zip when the output is x86_64, or awscli-exe-linux-aarch64.zip when it is aarch64.

Download the bundle into /tmp:

bash
cd /tmp

Fetch the official x86_64 zip into the current directory (swap the URL for aarch64 on ARM hosts):

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

Extract the bundle and run the installer from the same directory:

bash
unzip -q awscliv2.zip && sudo ./aws/install

The installer prints the path you can call next:

output
You can now run: /usr/local/bin/aws --version

Confirm the bundled v2 build:

bash
aws --version
output
aws-cli/2.38.1 Python/3.14.6 Linux/7.0.0-34-generic exe/x86_64.ubuntu.26

Install AWS CLI with Snap

Amazon publishes aws-cli on Snapcraft. Classic confinement avoids sandbox issues with credential files under ~/.aws:

bash
sudo snap install aws-cli --classic

Snap reports the channel and publisher when the install completes:

output
aws-cli (v2/stable) 2.35.21 from Amazon Web Services (aws**) installed

Your build may show a newer 2.x after automatic refresh. Verify the Snap binary explicitly:

bash
/snap/bin/aws --version
output
aws-cli/2.35.21 Python/3.14.6 Linux/7.0.0-34-generic exe/x86_64.ubuntu.26

Install AWS CLI from Ubuntu APT

When you want an Ubuntu-managed package and routine apt upgrades, install awscli from universe on releases that ship a candidate (26.04 in this test).

Refresh indexes and install the universe package in one step:

bash
sudo apt update && sudo apt install -y awscli

Call the packaged binary directly so you know which build you are testing:

bash
/usr/bin/aws --version
output
aws-cli/2.31.35 Python/3.14.4 Linux/7.0.0-34-generic source/x86_64.ubuntu.26

On 26.04 this universe build is 2.31.35, which is below 2.32.0, so it does not include aws login. Use IAM Identity Center (aws configure sso), access keys, an instance profile, or install a newer AWS-managed build if you need aws login.

If you already installed the official bundle, which may still show /usr/local/bin/aws because that path sorts earlier on PATH:

bash
type -a aws
output
aws is /usr/local/bin/aws
aws is /usr/bin/aws
aws is /bin/aws

On merged /usr Ubuntu systems, /bin/aws may be the same packaged binary as /usr/bin/aws, not a second independent install.

WARNING
Do not install official + apt + Snap on one machine without a deliberate PATH strategy. Cron jobs and CI scripts invoke the first aws on PATH, not necessarily the one you tested in an interactive shell.

Verify and authenticate AWS CLI on Ubuntu

Check the active AWS binary

Before you configure credentials, confirm the CLI responds:

bash
command -v aws
output
/usr/local/bin/aws

List every copy when versions disagree:

bash
type -a aws
output
aws is /usr/local/bin/aws
aws is /usr/bin/aws
aws is /bin/aws
aws is /snap/bin/aws

The sample above shows what appears when each method was tested separately—not a recommended combined setup.

         How will this machine authenticate?
                          |
        +-----------------+------------------+
        |                 |                  |
   Console / IAM      IAM Identity Center     EC2
   aws login          aws configure sso       instance profile
                      aws sso login           (automatic)

Sign in with aws login

On AWS CLI 2.32.0 and newer, aws login uses AWS Management Console sign-in (root, IAM user, or federated IAM) to obtain short-lived credentials. It is not the IAM Identity Center workflow—if your organization uses Identity Center, use the SSO section below instead.

Requires network access to AWS sign-in endpoints. For IAM users, roles, or groups (not the root user), an administrator must allow local development sign-in, typically by attaching the SignInLocalDevelopmentAccess managed policy.

bash
aws login

On a headless server or over SSH with no local browser, use remote sign-in and complete authentication on another device:

bash
aws login --remote

Configure IAM Identity Center

For workforce access through IAM Identity Center (SSO), use a profile backed by SSO:

bash
aws configure sso

Sign in when the CLI prompts you:

bash
aws sso login --profile my-profile

Export AWS_PROFILE=my-profile (or pass --profile) before you run service commands.

Configure access keys when required

Static IAM access keys still work for labs, legacy automation, or environments that require them:

bash
aws configure

You will be prompted for Access Key ID, Secret Access Key, default region, and output format. Files land under ~/.aws/credentials and ~/.aws/config. Prefer short-lived authentication for normal development; AWS discourages long-term IAM user keys for everyday work on real accounts.

List what the CLI sees before any credentials are set:

bash
aws configure list
output
NAME       : VALUE                    : TYPE             : LOCATION
profile    : <not set>                : None             : None
access_key : <not set>                : None             : None
secret_key : <not set>                : None             : None
region     : <not set>                : None             : None

EC2 instance profiles

If the AWS CLI runs on EC2 with an attached IAM instance profile, you normally do not run aws configure with access keys. The CLI loads temporary role credentials from the instance metadata service automatically.

Verify with STS

Prove the binary and credentials work together:

bash
aws sts get-caller-identity

Without credentials the CLI still runs but cannot call AWS APIs:

output
aws: [ERROR]: An error occurred (NoCredentials): Unable to locate credentials. You can configure credentials by running "aws login".

Install succeeded—the next step is sign-in, SSO, an instance profile, or keys. For EC2 and S3 walkthroughs after install, continue with the AWS CLI tutorial.


Update AWS CLI on Ubuntu

Update an official AWS installation with aws update

If your AWS-managed install (install script or ZIP) provides the aws update subcommand, use it to refresh the same layout in place. It does not upgrade apt or Snap packages.

User-local install (~/.local/share/aws-cli):

bash
aws update

System-wide install (/usr/local/aws-cli):

bash
sudo aws update

When you already have the current release, the command exits without reinstalling:

output
Downloading https://awscli.amazonaws.com/v2/install.sh
Running install script...
AWS CLI 2.38.1 is already installed at /usr/local/aws-cli; nothing to do.

Confirm afterward:

bash
aws --version

Older AWS CLI v2 builds that do not list aws update can be refreshed by re-running the install script or ZIP installer with --update.

Fallback: re-download the ZIP and run sudo ./aws/install --bin-dir /usr/local/bin --install-dir /usr/local/aws-cli --update when you need an offline bundle.

Update the Snap package

Snap normally refreshes the aws-cli package automatically. To check or apply the latest channel build immediately:

bash
sudo snap refresh aws-cli

Update the Ubuntu APT package

Refresh metadata and upgrade only awscli when a newer universe build exists:

bash
sudo apt update && sudo apt install --only-upgrade awscli

Optional: Enable AWS CLI tab completion

If you use Bash, locate the completer that matches your active install:

bash
command -v aws_completer

Enable completion with the path that command prints (example for a system-wide official install):

bash
echo 'complete -C /usr/local/bin/aws_completer aws' >> ~/.bashrc

Replace /usr/local/bin/aws_completer with ~/.local/bin/aws_completer, /usr/bin/aws_completer, or another path when command -v returns something different.


Uninstall AWS CLI

Remove one method at a time.

Official install script or ZIP (system-wide):

bash
sudo rm -rf /usr/local/aws-cli /usr/local/bin/aws /usr/local/bin/aws_completer

User-local install script:

bash
rm -rf ~/.local/share/aws-cli ~/.local/bin/aws ~/.local/bin/aws_completer

Clear the shell hash table after removal:

bash
hash -r

APT:

bash
sudo apt purge -y awscli

Preview packages apt would remove as unused dependencies:

bash
sudo apt-get -s autoremove

If that list contains only packages you no longer need, remove them:

bash
sudo apt autoremove

Snap:

bash
sudo snap remove aws-cli

Remove ~/.aws only when you no longer need stored profiles. See how to remove software on Ubuntu when you are unsure which package manager installed the CLI.


Troubleshooting

Symptom Likely cause Fix
aws: command not found Not installed or PATH missing ~/.local/bin or /usr/local/bin Re-run install script; export PATH="$HOME/.local/bin:$PATH"; add that line to ~/.bashrc for new shells
curl: command not found Minimal image without curl sudo apt update && sudo apt install -y curl
aws login unknown command APT 2.31.35 or other CLI below 2.32.0 Install script, Snap, or ZIP; or use aws configure sso / keys / instance role
aws --version shows old 1.x Legacy pip v1 or mixed installs pip3 uninstall awscli; remove duplicate binaries; install v2 only
which aws ≠ expected path Multiple installs type -a aws; remove extras or call full path in scripts
Unable to locate credentials No login, SSO session, role, or keys aws login, aws sso login, instance profile, or aws configure
aws update not supported apt/Snap build or older official install Use snap refresh, apt upgrade, or re-run install script / ZIP --update
unzip: command not found Missing unzip for ZIP path sudo apt install -y unzip
apt awscli not found Universe disabled or unsupported release Enable universe; use install script or Snap on 24.04
Snap vs /usr/local/bin/aws differ Parallel installs Pick one method; adjust PATH for automation

Confirm your release with check Ubuntu version when a step names codenames or archive components.


Summary

On Ubuntu 26.04, the practical default is Amazon's install script: curl -fsSL https://awscli.amazonaws.com/v2/install.sh | bash for your user, or sudo bash -s -- --system for /usr/local/bin/aws. The script handles architecture selection and matches what AWS documents as the recommended Linux path.

Keep the ZIP installer for signature verification or pinned bundles. Snap and apt install awscli use different updaters than aws update; remember 26.04 apt 2.31.35 does not ship aws login. After install, prefer aws login (on 2.32.0+ builds), IAM Identity Center, or an instance role over long-lived keys, then confirm with aws sts get-caller-identity.

When versions disagree, type -a aws shows which copy wins on PATH. Keep one primary installation in scripts, cron jobs, and CI, or call the full binary path explicitly.


References


Frequently Asked Questions

How do I install AWS CLI on Ubuntu?

Run curl -fsSL https://awscli.amazonaws.com/v2/install.sh | bash for a user-local AWS CLI v2 install, or pipe the same URL to sudo bash -s -- --system for /usr/local/bin/aws. Alternatives are the official ZIP installer, sudo snap install aws-cli --classic, and sudo apt install awscli on releases that ship the package.

What is the difference between AWS CLI v1 and v2 on Ubuntu?

AWS CLI v2 is the current line with bundled binaries, improved pagination, and modern authentication. v1 from pip install awscli is in maintenance mode toward end of support. Both use the aws command name—keep only one on your PATH. aws --version shows aws-cli/2.x or aws-cli/1.x.

Should I use apt or the AWS install script for AWS CLI on Ubuntu?

Use the install script or ZIP when you want the current upstream 2.x release and aws update. Use apt install awscli on 26.04 when you want Ubuntu-managed updates through apt—the universe build can lag the official installer. Amazon does not maintain Ubuntu's apt package.

How do I install AWS CLI v2 on Ubuntu 22.04 or 24.04 LTS?

The same install script and ZIP work on 22.04, 24.04, and 26.04 on amd64 and arm64. On 22.04, apt may still offer legacy v1—prefer the install script for v2. On 24.04, apt often has no awscli candidate; use the script, ZIP, or Snap.

How do I configure AWS CLI after installing on Ubuntu?

For local development on CLI 2.32.0 or newer, use aws login (not available on Ubuntu 26.04's current apt package 2.31.35—use the install script, Snap, or SSO instead). For IAM Identity Center, run aws configure sso and aws sso login. Use aws configure with access keys only when short-lived methods are not available. Test with aws sts get-caller-identity.

How do I update AWS CLI v2 on Ubuntu?

On AWS-managed installs that support it, run aws update (user-local) or sudo aws update (system-wide). Snap users can run sudo snap refresh aws-cli to force a refresh. Apt users run sudo apt update and sudo apt install --only-upgrade awscli. Re-run the ZIP installer with --update when aws update is not available.

How do I uninstall AWS CLI from Ubuntu?

Remove /usr/local/aws-cli and /usr/local/bin/aws for system-wide official installs, or ~/.local/share/aws-cli and ~/.local/bin/aws for user-local installs. Apt: sudo apt purge -y awscli. Snap: sudo snap remove aws-cli.

Why does aws --version show the wrong version on Ubuntu?

Multiple installs share the aws name. Run type -a aws—/usr/local/bin/aws often precedes /usr/bin/aws (apt) and /snap/bin/aws. Remove the copy you do not want or call the full path in scripts.

Is AWS CLI available as a Snap on Ubuntu?

Yes. Amazon publishes aws-cli on Snapcraft. Install with sudo snap install aws-cli --classic for v2. Classic confinement helps the CLI reach credential files under your home directory.

How do I fix aws command not found on Ubuntu?

The CLI is not installed or ~/.local/bin or /usr/local/bin is missing from PATH. Complete the install script step, export PATH if you used a user-local install, run hash -r, and open a new shell. Confirm with command -v aws.

Finished reading?Beta Get the key takeaways in seconds, then ask follow-up questions
Omer Cakmak

Linux Administrator

Highly skilled at managing Debian, Ubuntu, CentOS, Oracle Linux, and Red Hat servers. Proficient in bash scripting, Ansible, and AWX central server management, he handles server operations on OpenStack, KVM, Proxmox, and VMware.

  • Debian
  • Ubuntu
  • Linux
  • Red Hat Enterprise Linux
  • Shell Script
  • System Administration