How to Install AWS CLI on Ubuntu
The AWS CLI (Amazon Web Services Command Line Interface) lets you manage cloud servers, file storage and other AWS services from your Ubuntu terminal, without opening a web browser. Version 2 is the current release for running commands against your Amazon Web Services accounts from a Linux computer.
This guide covers three ways to install it , how to check that it worked, and how to connect it to your account. You need a few minutes, an open terminal, a user account with sudo rights, and an internet connection. Each method is independent, so pick one and skip the others.
You install the AWS CLI on Ubuntu by downloading the official installer package from Amazon and running it with unzip and the install script. Alternatively, you can use apt install awscli or pip3 install awscli. Verify the installation with aws –version.
Install AWS CLI from Ubuntu’s repository
Installing the AWS CLI from Ubuntu’s Universe repository (a community-maintained collection of software packages) is the fastest way to get set up. It is one command, and apt handles updates along with the rest of your system packages. The trade-off is that the version in the repository can be older than the one Amazon publishes. If you need the newest release, use the direct download method further down.
The Universe repository is enabled on a standard Ubuntu install. If apt says it cannot find the package, check that Universe is turned on in your software sources.
- Open a terminal window. On most Ubuntu desktops you can press Ctrl+Alt+T.
- Run the command below: sudo apt install awscli
- Enter your password when asked. The terminal shows nothing while you type it, which is normal.
- If apt asks Do you want to continue? [Y/n], type y and press Enter.
You should see apt download and unpack the package, then return to the prompt without errors. No restart is needed.
sudo snap install aws-cli --classic
- Run the command below to check that the AWS CLI is installed: aws –version
The terminal should print a line starting with aws-cli/ followed by the version number. If you get command not found, the install did not finish. Run the install command again and read the output for errors.
aws --version
Install AWS CLI from Amazon
Downloading the official installer directly from Amazon is the best way to get the newest version of the AWS CLI. It does not depend on what Ubuntu's repository carries, and you can run the same steps on any supported Ubuntu release.
- Install the two helper tools you need by running: sudo apt install curl unzip. curl downloads the file and unzip extracts it.
- Download the official package by running: curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
You should see a progress table while the file downloads, and a file named awscliv2.zip will appear in your current folder. This link is for 64-bit Intel and AMD machines. If your computer uses an ARM processor, Amazon publishes a separate ARM download on its AWS CLI install page, so use that file instead.
sudo apt install curl unzip curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
- Run the commands below to extract the zip file and install what it contains.
- Enter your password if sudo asks for it.
The extract step prints a long list of files. The install step finishes with a short message saying the AWS CLI was installed. Once it is done you can delete awscliv2.zip and the extracted folder to free up space. To upgrade later, download a fresh zip and run the installer again, using the update option described in Amazon's documentation.
- Run aws --version in your terminal.
This command displays the installed version number, confirming the software is ready for use with your AWS services. A direct install should report a version 2 release. If you also installed the Ubuntu package earlier, the two can conflict, so remove one of them if the version looks wrong.
aws --version
Install AWS CLI via Python PiP
Using PIP (Python's package manager) is an alternative if Python is already on your machine. Be aware of two things. First, the commands in this section go through apt, so they install the Ubuntu-packaged AWS CLI, the same package as Method 1. Second, on Ubuntu 23.04 and later, Python protects the system environment and refuses to let pip install packages system-wide. Because of that, the apt route here is the safest way to get a working install.
- Run sudo apt update to refresh your package lists so your system is ready for new software.
sudo apt update
This command updates the package lists, preparing the system for upgrades and new installations. You should see a list of repositories being checked, ending with a message about how many packages can be upgraded. It does not upgrade anything by itself.
Install Python and PIP
This method needs Python and PIP (Python Package Installer) on the system. You can install the prerequisites, along with the AWS CLI package, in one go.
- Run the command below: sudo apt update && sudo apt install python3-pip awscli -y
- Enter your password if asked.
The -y flag answers yes to the confirmation prompt for you. The && means the install only runs if the update succeeded. When it finishes, you are returned to the prompt.
sudo apt install python3 python3-pip -y
Install AWS CLI using PIP
The next command installs or refreshes the AWS CLI on the Ubuntu system.
- Run the command below: sudo apt install awscli
- If the package is already installed, apt tells you it is already the newest version available, or it upgrades it if a newer one exists.
The version you get is whatever Ubuntu's repositories carry for your release. It may not be the very latest from Amazon.
pip3 install --upgrade awscli --break-system-packages
This command places the AWS CLI globally across the system, so every user account on the machine can run it.
Verify the Installation
Checking the version verifies whether the AWS CLI is installed correctly.
- Run the command below: aws --version
aws --version
A successful installation prints the active version information directly in the terminal, starting with aws-cli/ and the version number. If you see command not found instead, the package did not install, so go back and read the output of the install command for errors.
Configuring AWS CLI
Linking your AWS account means running the aws configure command once the installation finishes. You need an access key pair for this. You create it in the AWS console, under your IAM user's security credentials. If you do not have one, ask whoever manages your AWS account.
- Type aws configure in your terminal and press Enter.
- Paste your AWS Access Key ID and press Enter.
- Paste your AWS Secret Access Key and press Enter.
- Enter your Default region name, for example us-east-1, and press Enter.
- Enter your Default output format, for example json, and press Enter.
After the last answer, you are returned to the normal prompt.
aws configure
The prompt asks for the AWS Access Key ID, Secret Access Key, default region, and default output format. Providing accurate credentials aligns the tool with the correct cloud account. The CLI saves your answers in a hidden .aws folder in your home directory, so keep that folder private and never share your secret key. To change a value later, run aws configure again. Press Enter at a prompt to keep the current value.
Conclusion
- The AWS CLI is a powerful tool that allows you to manage AWS services from the command line
- You can install the AWS CLI on Ubuntu Linux using various methods such as Ubuntu's Universe repository, direct download from AWS, or via Python PIP
- After installation, verify the installation and configure the AWS CLI with your AWS account access keys
- With the AWS CLI successfully installed and configured, you can begin efficiently managing various AWS services directly from your terminal
Was this guide helpful?
About the Author
Richard
Tech Writer, IT Professional
Richard is a writer at Geek Rewind who turns complex IT tasks into clear, step-by-step guides. He draws on years of hands-on experience in system administration and enterprise IT operations, focusing on Windows, Linux and WordPress: the problems people actually run into, and the fixes that work. His server and WordPress guides come from systems he runs himself. Richard builds and maintains the platform behind Geek Rewind, from its Ubuntu servers and Nginx configuration to its custom WordPress plugins. Many new tutorials start with readers' questions, and he's always glad to answer them in the comments.
No comments yet — be the first to share your thoughts!