How to install AWS CLI on Ubuntu

Installing AWS CLI on Ubuntu adds the aws command to the shell for identity checks, profile-based work, and repeatable AWS service calls from local terminals, remote servers, and automation jobs.

Current AWS guidance for Ubuntu supports the vendor AWS CLI version 2 installer and the official snap package. The ZIP installer keeps the install consistent on standard Ubuntu shells without depending on snapd, and it avoids the release-specific lag or package absence that can still affect distro repositories.

AWS CLI version 1 and version 2 use the same aws command name. Older APT, snap, or pip installs can still shadow /usr/local/bin/aws after the new install, and ARM64 systems must use the Linux aarch64 archive instead of the x86_64 file shown in the default download step.

Steps to install AWS CLI on Ubuntu:

  1. Refresh the local APT package lists.
    $ sudo apt update
  2. Install curl and unzip.
    $ sudo apt install curl unzip

    curl downloads the installer archive, and unzip extracts it before the bundled installer runs.

  3. Check the Ubuntu CPU architecture.
    $ uname -m
    x86_64

    x86_64 uses the default download URL below, while aarch64 uses the Linux ARM archive in the next step.

  4. Download the current AWS CLI v2 archive.
    $ curl "https://awscli.amazonaws.com/\
    awscli-exe-linux-x86_64.zip" \
      -o "awscliv2.zip"

    If the previous step returned aarch64, replace x86_64 with aarch64 in the download URL.

  5. Extract the installer archive in the current working directory.
    $ unzip awscliv2.zip
  6. Run the bundled installer with sudo.
    $ sudo ./aws/install
    You can now run: aws --version

    The default install directory is /usr/local/aws-cli and the default symlink path is /usr/local/bin/aws. If those paths already contain a manual AWS CLI v2 install, rerun the installer later with sudo ./aws/install --update instead of creating a second copy.

  7. Confirm that the shell resolves the new aws binary.
    $ command -v aws
    /usr/local/bin/aws

    If the shell still resolves /usr/bin/aws, /snap/bin/aws, or ~/.local/bin/aws, the bundled install is not the active command yet.

  8. Confirm that the active command reports AWS CLI v2.
    $ aws --version
    aws-cli/2.34.32

    The exact version, bundled Python runtime, and platform string change over time. The decisive result is that the command returns an aws-cli/2.x version line. Related: How to check AWS CLI version

  9. Query the active account after credentials are configured.
    $ aws sts \
      get-caller-identity \
      --query Account \
      --output text
    123456789012

    Use aws configure, aws configure sso, or aws login before this step on a new host. Related: How to configure AWS CLI on Linux and macOS
    Related: How to log in to AWS CLI with IAM Identity Center
    Related: How to check the current caller identity in AWS CLI

  10. Remove the downloaded installer files after the CLI is working.
    $ rm -r aws awscliv2.zip

    Removing these files does not uninstall AWS CLI from /usr/local/aws-cli.