The AWS CLI acts as a central hub for managing all of your AWS services directly from the command line. This one-stop solution simplifies things by letting you control and automate various AWS services through commands and scripts. If you are a system admin or a developer, then this article will help you get the AWS on your latest Ubuntu 24.04 machine.
Table of Contents:
- How to Install AWS CLI on Ubuntu 24.04
- How to Check AWS CLI Location on Your Linux Machine
- How to Uninstall AWS CLI From Ubuntu 24.04
- Conclusion
1. How to Install AWS CLI on Ubuntu 24.04
To install AWS CLI on Ubuntu 24.04 you can use the curl command to download its latest zip file. After that, you can use the unzip command to extract its package and install it later. AWS CLI is also available as a snap package, and you can also install it with the help of Python3.
Let’s take a look at all three AWS CLI installation methods in Ubuntu 24.04.
Installing AWS CLI Using apt and curl on Ubuntu 24.04
Most of the time, the third-party packages available in the Ubuntu repository are not the latest ones. Unfortunately, the AWS CLI is not supported in the Ubuntu 24.04 default apt repository. To get the latest version of AWS CLI, you can use the curl command to get its package from the official AWS website.
After the package download is completed, proceed to extract it using the unzip command. After that, AWS CLI is ready for installation.
First, install the curl and unzip on your Ubuntu 24.04 machine using the apt install command:
sudo apt install curl unzip
Now download the latest file for the AWS CLI using the curl command:
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
This command will download the AWS CLI installer for Linux systems specifically designed for 64-bit architecture. The downloaded file will be named as awscliv2.zip file.
Once the AWS CLI package is downloaded, the next step is to unzip it using the unzip command:
unzip awscliv2.zip
Finally, install the AWS CLI using this command:
sudo ./aws/install
To check the version of AWS installed, you can type this:
aws --version
Installing AWS CLI Using Snap on Ubuntu 24.04
AWS CLI is also available as a snap package. To download it, you can use the snap install command:
sudo snap install aws-cli --classic
Installing AWS CLI Using Python (Pip) on Ubuntu 24.04
The third method on the list for installation of AWS CLI is using the Python package manager Pip. To install AWS CLI using pip, first make sure Python is available.
Before you can proceed with AWS CLI installation, start by updating your system’s old packages:
sudo apt update
Now run this below command to install the Python:
sudo apt install python3-pip
The AWS CLI is an externally managed Python package, to install it we have to create a virtual environment for it. The better approach is to use the pipx install command. Unlike pip, which installs packages globally, pipx creates isolated virtual environments for each application. This prevents conflicts between dependencies of different applications.
Pipx focuses on installing Python packages that provide command-line interfaces (CLIs). These can be run directly from the terminal like regular programs.
Now proceed towards the pipx installation:
sudo apt install pipx
Now run the pipx command to install the AWS CLI package:
pipx install awscli
The above command will install AWS CLI system-wide. So, it can be available for all system users:
aws --version
2. How to Check AWS CLI Location on Your Linux Machine
There are multiple commands available to check the installed location of AWS CLI. Mainly, you can use the type or which command to get the AWS CLI location:
type awswhich awswhereis awssudo find / -type f -name "aws"
3. How to Uninstall AWS CLI From Ubuntu 24.04
Uninstallation of AWS CLI depends on which method you have used for the installation. If you have installed AWS CLI using the zip file, then you have to simply remove the AWS installation directory. On the other hand, if you have installed AWS CLI using the pipx command, then you can remove it using the pipx uninstall command.
To remove the AWS CLI installed using a zip file, first check its installed folder location using which command:
which aws
Now simply copy the path and use the rm command to remove it:
sudo rm -rf /usr/local/bin/aws
To confirm its removal, you can check its version:
If you used pipx to install the AWS CLI, you’ll need to uninstall it using pipx as well:
pipX uninstall awscli
Lastly, if you have installed AWS CLI using the snap command, to remove it run this:
sudo snap remove aws-cli
We have successfully removed the AWS CLI from the Ubuntu 24.04 system.
Conclusion
To manage all the AWS services directories from the terminal, you can use the AWS CLI. It is like a central hub for all your processing related to AWS services. To install AWS CLI on Ubuntu 24.04 you can use the curl command to download its package and after that unzip it and install it on your system. Another way to install AWS CLI is by using the pipx package manager. Pipx will install AWS CLI globally across your system and can be accessed by all users. Get more details of AWS CLI installation in this article.
Check our LinkedIn company page