Almost every AWS task on Linux, from checking an S3 bucket to automating EC2 backups, starts at the command line. To do that work properly you need to install aws cli on linux the right way, configure credentials safely, and verify that your identity and Region are correct before you run a single real command. This guide walks through installing AWS CLI version 2 on Ubuntu, verifying the installation, running aws configure, using named profiles, noting the SSO option, and troubleshooting the problems beginners hit most often. Once the CLI works, tasks such as the snapshots in our EC2 getting started guide and other guides in our AWS category become much easier.
Why Install AWS CLI on Linux? – How to Install and Configure the
The AWS Management Console is fine for exploring, but it is slow for repeated work. The AWS CLI gives you scriptable, repeatable access to AWS services from a terminal. You can list instances, copy files to S3, create snapshots, and inspect IAM identities with commands that you can save in shell scripts and reuse. Version 2 is the current major release. It is distributed as a standalone installer that bundles its own runtime, so you do not need Python installed, and it adds features such as improved installers, SSO support, and interactive prompts. When you install aws cli on linux using the official installer, you also get a cleaner upgrade path than distribution packages, which are often several versions behind.
Prerequisites to Install AWS CLI on Linux – How to Install and Configure the
- A 64-bit Linux system; this guide uses Ubuntu, and the same steps work on Debian and most other distributions.
- A user account with sudo access for the installation step.
- An internet connection to download the installer from AWS.
- The unzip and curl tools, which we install in the first step if they are missing.
- An AWS account and either IAM access keys or an IAM Identity Center (SSO) assignment for configuration.
A security note before you begin: access keys are long-lived credentials. Create a dedicated IAM user or role for CLI work, grant only the permissions you need, and never commit keys to Git, share them in chat, or paste them into screenshots. Prefer SSO or temporary credentials for team and production use.
Step 1: Download and Install AWS CLI v2 on Ubuntu
Update your package list and install the small tools the installer needs:
sudo apt update
sudo apt install -y curl unzip
Download the official AWS CLI v2 installer for Linux x86_64:
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
On ARM systems, such as Graviton instances or a Raspberry Pi, replace x86_64 with aarch64 in the file name. Unzip the archive and run the installer with sudo:
unzip awscliv2.zip
sudo ./aws/install
By default this installs the aws executable to /usr/local/bin/aws and supporting files to /usr/local/aws-cli. If you are updating an existing installation, add the update flag so the installer overwrites the previous version cleanly:
sudo ./aws/install --bin-dir /usr/local/bin --install-dir /usr/local/aws-cli --update
Step 2: Verify the Installation
Confirm that your shell finds the CLI and reports version 2:
which aws
aws --version
You should see output similar to aws-cli/2.x followed by your platform details. If the shell reports command not found, open a new terminal first, because your PATH cache may be stale, and see the troubleshooting section below. Keeping the exact version matters when you follow documentation, because some commands and options differ between version 1 and version 2.

Step 3: Run aws configure for the Default Profile
Installation alone does not connect the CLI to your account. Run the configuration wizard:
aws configure
The wizard asks for four values:
- AWS Access Key ID: the ID of the access key you created in IAM for CLI use.
- AWS Secret Access Key: the matching secret, shown only once when the key is created.
- Default region name: for example ap-southeast-1, us-east-1, or eu-west-1. Choose the Region closest to your resources.
- Default output format: json is the best default; you can also choose table for readable listings or text for scripting.
The wizard writes your settings to two files in your home directory, a credentials file and a config file. Protect them like passwords with restrictive permissions using chmod 600 on both files, and list the directory to confirm ownership. Choosing the right default Region matters. Commands without an explicit Region use this value, and resources in another Region will appear to be missing. When in doubt, pass –region on a command to override the default for a single call.
Step 4: Use Named Profiles for Multiple Accounts
Most engineers eventually work with more than one account or environment, such as dev, staging, and production. Named profiles keep those identities separate instead of overwriting one set of keys with another. Create an additional profile with:
aws configure --profile staging
aws configure --profile production
Then select a profile per command, or for a whole shell session:
aws s3 ls --profile staging
export AWS_PROFILE=production
aws ec2 describe-instances
Clear habits prevent expensive mistakes: name profiles after the environment, check your identity before destructive commands, and consider a shell prompt that shows the active AWS profile. Never point a production profile at an automated script until you have tested the same script with a safer profile.
Step 5: Note on aws configure sso
If your organization uses IAM Identity Center, you do not need long-lived access keys at all. The SSO wizard stores a profile that logs you in through a browser and uses temporary credentials:
aws configure sso
aws sso login --profile my-sso-profile
You will enter the SSO start URL and Region, sign in in your browser, and pick an account and permission set. Temporary credentials expire automatically, which is a major security advantage. For personal learning accounts, access keys are acceptable if protected carefully; for teams, SSO should be the default choice.
Step 6: Test with STS and S3 Commands
Now prove that everything works. The STS command shows exactly which identity your credentials represent:
aws sts get-caller-identity
The output includes your account ID, user or role ARN, and user ID. If this command succeeds, authentication, network access, and signing are all working. Next, test a real service call by listing your S3 buckets:
aws s3 ls
An empty result is still a success if you simply have no buckets yet; an error is not. Try a Region-sensitive command as a final check:
aws ec2 describe-regions --output table
When you can run these commands confidently, you have completed the core task: to install aws cli on linux, configure it, and verify it end to end.
Troubleshooting PATH, Permissions, and Common Errors
aws: command not found: The install directory is not on your PATH. The default /usr/local/bin is normally included; if you chose a custom bin directory, add it to PATH in your shell profile and open a new shell. Permission denied during install: Run the installer with sudo, or install to a user-owned directory with –install-dir and –bin-dir pointing inside your home directory. InvalidClientTokenId or SignatureDoesNotMatch: The access key or secret was copied incorrectly; re-run aws configure and paste carefully, checking for extra spaces. You must specify a region: Your default Region is empty; set it with aws configure or pass –region. SSL or connection errors: Check your internet connection, system clock, and any proxy settings, because request signing depends on accurate time. Old version still appears: Multiple installations exist; which aws shows which one your shell uses, so remove or update the older copy.
For the authoritative installation instructions for every platform, see the official AWS document on installing the AWS CLI.
Conclusion
You now know how to install aws cli on linux properly: download the official v2 installer on Ubuntu, verify the version, configure your default Region and output format, separate environments with named profiles, consider SSO instead of long-lived keys, and prove the setup with aws sts get-caller-identity and aws s3 ls. With this foundation in place, every other AWS guide on this site becomes a set of commands you can run, script, and repeat with confidence.