How To Install AWS CLI on Ubuntu 26.04 LTS

Install AWS CLI on Ubuntu 26.04

If you manage AWS resources often, the browser console can slow you down. A proper Install AWS CLI on Ubuntu 26.04 workflow saves time, reduces mistakes, and makes your day-to-day Linux server tutorial tasks much easier.

Ubuntu 26.04 is a strong match for AWS workflows because it is a current LTS release and is already available on AWS EC2. That makes this guide useful for local laptops, virtual machines, and cloud instances alike.

In the sections below, you will learn how to install AWS CLI version 2, verify the binary, configure credentials, enable shell completion, and fix the common errors that show up during a real configure AWS CLI on Ubuntu 26.04 setup. The steps are written from a senior Linux sysadmin point of view, but the language stays simple and practical.

Prerequisites

Before you begin, make sure you have the following:

  • Ubuntu 26.04 LTS installed and updated. AWS CLI v2 supports modern Linux systems, and Ubuntu 26.04 is a current production target.
  • A user with sudo access. The official installer writes into system paths like /usr/local/bin, so normal users cannot complete the install.
  • Internet access to download the AWS CLI installer from the official AWS domain.
  • AWS credentials such as access keys or IAM Identity Center access. AWS requires credentials before CLI commands can talk to services.
  • Basic terminal tools like curl and unzip. The installer comes as a ZIP file, so those tools are required.

Step 1: Update Your System

Refresh package indexes

Run this first:

sudo apt update

This command refreshes Ubuntu’s package list. You want fresh package metadata before installing anything, because old indexes can point to outdated or missing packages.

Install required tools

Now install the tools the AWS CLI installer needs:

sudo apt install -y curl unzip

curl downloads the installer, and unzip extracts it. Without these packages, the next steps will fail before you even reach the AWS CLI binary.

Step 2: Check Your CPU Architecture

Detect the machine type

Run:

uname -m

This shows whether your system uses x86_64 or aarch64. That matters because AWS publishes separate installers for Intel and ARM systems, and the wrong one will not run correctly.

Pick the correct installer

Use one of these downloads based on your architecture:

For x86_64 systems:

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

For ARM64/Graviton systems:

curl "https://awscli.amazonaws.com/awscli-exe-linux-aarch64.zip" -o "awscliv2.zip"

This is the safest way to install AWS CLI on Ubuntu 26.04 because you get the official package directly from AWS. That reduces supply chain risk and avoids stale third-party packages.

Step 3: Download the AWS CLI Installer

Use the official AWS source

If you are on a standard desktop or server, download the installer with curl as shown above. The file is a ZIP archive that contains the installer and the bundled runtime AWS CLI v2 needs.

Why this method is preferred

The official installer gives you a clean, self-contained AWS CLI installation. It does not depend on your system Python, which keeps your Ubuntu environment stable and avoids package conflicts.

Step 4: Extract the Archive

Unzip the installer

Run:

unzip awscliv2.zip

This extracts the installer files into an aws directory in your current location. You need this directory because the install script lives inside it.

Why extraction matters

The AWS CLI install script uses the extracted files to place the binary in the correct location. If you skip this step, there is no installer script to run.

Step 5: Install AWS CLI on Ubuntu 26.04

Run the install script

Now install AWS CLI:

sudo ./aws/install --bin-dir /usr/local/bin --install-dir /usr/local/aws-cli

This places the aws command in /usr/local/bin, which makes it available to all users on the system. It stores the main files in /usr/local/aws-cli, which keeps the installation tidy and easy to update later.

Why these paths matter

/usr/local/bin is normally on the system PATH, so you can run aws from any terminal session. Using a dedicated install directory also keeps the CLI separate from Ubuntu’s package-managed files, which helps avoid conflicts.

Expected output

You should see something like this:

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

That message means the install script finished successfully and the binary was linked properly.

Step 6: Verify the Installation

Check the version

Run:

aws --version

A successful result looks similar to:

aws-cli/2.x.x Python/3.x.x Linux/x86_64

This confirms the CLI is installed and reachable from your shell. It also tells you which major version you installed, which matters because AWS CLI v2 has features and behavior that differ from v1.

Why verification comes first

Version checks catch path problems before you spend time on configuration. If the shell cannot find aws, the issue is usually the install path or a missing new shell session, not the AWS account itself.

Step 7: Configure AWS CLI on Ubuntu 26.04

Run the setup wizard

Now configure your credentials:

aws configure

The command asks for your Access Key ID, Secret Access Key, default region, and output format. This is the basic AWS CLI on Ubuntu 26.04 setup step that makes the tool usable for real AWS commands.

What each field does

  • Access Key ID identifies the IAM identity.
  • Secret Access Key signs your requests.
  • Default region tells AWS where to send most API calls.
  • Output format controls how results appear in the terminal.

These settings let the CLI talk to AWS correctly and return data in a format you can read or script against.

Example configuration

AWS Access Key ID [None]: AKIAEXAMPLE123
AWS Secret Access Key [None]: ****************************************
Default region name [None]: ap-southeast-1
Default output format [None]: json

Use json if you plan to automate commands, because scripts usually work better with structured output.

Why this step matters

The AWS CLI binary alone does nothing useful until you give it credentials and a region. Without configuration, most commands fail with credential or region errors.

Step 8: Use Named Profiles

Create separate profiles

If you work with more than one AWS account, use profiles:

aws configure --profile staging
aws configure --profile production

This creates separate credential sets for each environment. It is safer than overwriting one default profile when you manage dev, staging, and production from the same machine.

Use a profile in a command

aws s3 ls --profile staging

This makes the target account clear in the command itself. That clarity helps prevent expensive mistakes, especially on systems that manage multiple environments.

Why profiles are important

Profiles support separation of duties. That matters in real sysadmin work because a single wrong command against the wrong account can create outages or data loss.

Step 9: Enable Shell Autocompletion

Add completion for Bash

Run:

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

This enables tab completion for AWS CLI commands in Bash. It speeds up daily work and reduces typing errors, especially when you work with large service names and long subcommands.

Why completion helps

AWS CLI includes many services and command groups. Completion makes the shell suggest valid commands before you hit Enter, which is a simple but effective way to avoid mistakes.

Step 10: Test with a Live AWS Call

Confirm identity access

Run:

aws sts get-caller-identity

This command returns your account ID, user ARN, and user ID. It is one of the best ways to confirm that your CLI installation and credentials both work.

Why this test is useful

aws --version only proves the binary exists. sts get-caller-identity proves the CLI can authenticate and communicate with AWS successfully. That makes it a better real-world validation step.

Example output

{
    "UserId": "AIDAEXAMPLE123",
    "Account": "123456789012",
    "Arn": "arn:aws:iam::123456789012:user/admin"
}

If you see output like this, your Install AWS CLI on Ubuntu 26.04 process is complete and working.

Troubleshooting Common Errors

1. aws: command not found

This usually means the shell cannot find the binary. Re-open the terminal, or check whether /usr/local/bin is on your PATH. If needed, reinstall with the --bin-dir /usr/local/bin option.

2. Unable to locate credentials

This means the CLI is installed, but you have not configured credentials yet. Run aws configure or aws sso login if you use IAM Identity Center.

3. Exec format error

This often happens when you download the wrong installer for your CPU type. Check uname -m again and use the matching x86_64 or aarch64 package.

4. Unable to locate package awscli

This usually appears when someone tries to use the wrong package source. The official v2 install method uses AWS’s installer, not Ubuntu’s default package name.

5. Shell completion does not work

If tab completion fails, check that aws_completer exists and that your shell profile loaded the completion line. The path can differ depending on whether you used the official installer or Snap.

Update or Remove AWS CLI

Update the official install

Use this when you need the latest release:

curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install --update

This refreshes the existing installation without forcing you to remove the old one first. Updating matters because AWS CLI releases often add service support and fix bugs.

Remove AWS CLI

If you need to uninstall it:

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

This removes the command and the installed files cleanly. A clean uninstall avoids version conflicts later if you switch install methods.

[su_box title=”VPS Manage Service Offer” style=”bubbles” box_color=”#000000″ radius=”10″]If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal![/su_box]

r00t is a Linux Systems Administrator and open-source advocate with over ten years of hands-on experience in server infrastructure, system hardening, and performance tuning. Having worked across distributions such as Debian, Arch, RHEL, and Ubuntu, he brings real-world depth to every article published on this blog. r00t writes to bridge the gap between complex sysadmin concepts and practical, everyday application — whether you are configuring your first server or optimizing a production environment. Based in New York, US, he is a firm believer that knowledge, like open-source software, is best when shared freely.

Related Posts