Mastering tools like AWS CLI empower developers to develop, deploy, automate, test, scale, or maintain their applications remotely. Ubuntu 24.04 is a robust platform that offers seamless integration of workflows and automation of tasks via one-line commands and AWS CLI. This article is a practical walkthrough of installing AWS CLI on Ubuntu 24.04 to work with cloud services via commands.
How to Install AWS CLI on Ubuntu 24.04?
AWS CLI can be installed on Ubuntu 24.04 via two different methods that are given as follows:
- Snap Pakcet Manager
- tar.gz Source File
- Pip Installer
How to Install AWS CLI on Ubuntu 24.04 Using Snap Packet Manager?
The Snap package manager is a secure and reliable way to download, install, update, or remove multiple packages via one-line commands across multiple Linux distributions. This section will use Snap to install AWS CLI on Ubuntu 24.04.
Step 1: Install AWS CLI
Install the AWS CLI on Ubuntu 24.04 from the Snap package manager in the “classic” mode:
sudo snap install aws-cli --classic
Step 2: Verify the Installation
This command will verify if the AWS CLI has been installed on Ubuntu 24.04:
aws --version
How to Uninstall AWS CLI on Ubuntu 24.04 Using Snap Package Manager?
The AWS CLI can be removed via the Snap package manager via the given command in the terminal:
sudo snap remove aws-cli
How to Install AWS CLI on Ubuntu 24.04 From Tar.gz Source File?
Curl is a versatile command-line tool in Debian-based distribution that allows users to download and transfer data from different servers using protocols such as HTTP, HTTPS, etc. The curl utility is not pre-installed in the Ubuntu 24.04. However, you can install it by using this simple command:
sudo apt install curl
After installing the curl on Ubuntu 24.04, follow the below-mentioned steps to install the AWS CLI.
Step 1: Install AWS CLI Using Curl
The command given below downloads and installs the AWS CLI version 2 and stores it in the “awscliv2.zip”:
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
Step 2: Unzip AWS CLI
To unzip the content of the “awscliv2” archive file, type and enter this command in the terminal of Ubuntu 24.04:
unzip awscliv2.zip
Step 3: Install AWS CLI
This will execute the AWS CLI installer in the “aws/install” directory. Provide the password for the currently logged-in user to begin installation:
sudo ./aws/install
Step 4: Verify Installation
For verification purposes, provide the following command to the terminal and press the “Enter” button from the keyboard:
aws --version
Step 5: Setting AWS CLI to Global
Setting the AWS CLI to global setup will help the system to determine the location of AWS CLI executable file. For this purpose, open the “bashrc” file using the nano text editor and administrative privileges:
sudo nano ~/.bashrc
Append the following line in the bashrc file to configure environment variables. Press CTRL+X and Y (yes) for the prompt and hit the Enter button to save and apply changes:
export PATH = "$PATH:/usr/local/bin/aws"
Refresh the bashrc file using the following command:
source ~/.bashrc
You can now determine the version of AWS CLI installed on the system using the following command without requiring the superuser privilidedges:
aws --version
How to Uninstall AWS CLI on Ubuntu 24.04?
To uninstall the AWS CLI from Ubuntu 24.04, the following command will remove all the contents recursively located in the “usr/local/aws” directory:
sudo rm -rf /usr/local/aws
The following command will recursively remove the AWS CLI executable and all the contents related to it in the “usr/local/bin/aws” directory:
sudo rm -rf /usr/local/bin/aws
Here, the AWS CLI has been successfully uninstalled from the Ubuntu 24.04:
aws --version
How to Install AWS CLI on Ubuntu 24.04 Using Pip Installer?
Python provides a Pip installer which is useful for downloading and installing various packages. Such packages are not found inside the standard Python library.
Step 1: Update Apt Repository
For installing the AWS CLI on Ubuntu 24.04 using the pip installer, first update the Apt repository using the following command:
sudo apt-get update
Step 2: Install Pip Installer
The Python provides the pip installer that can be installed via the following command:
sudo apt-get install python3-pip
Step 3: Install AWS CLI
The following command will install the AWS CLI using the pip 3 installer. The “–break-system-packages” prevents the “externally managed environment” error and ensures the smooth installation:
pip3 install awscli --break-system-packages
Step 4: Verify Installation
Use the following command to determine which version of AWS CLI is installed on the system:
pip show awscli
How to Uninstall AWS CLI on Ubuntu 24.04 Using Pip Installer?
You can uninstall the AWS CLI on Ubuntu 24.04 using the following command:
pip3 uninstall awscli --break-system-packages
That is all from this guide to installing AWS CLI on Ubuntu 24.04.
Conclusion
AWS CLI is a command-line interface that enables developers to work with AWS services via single-line commands. Installing the AWS CLI on Ubuntu 24.04 empowers the users to access and manipulate the data on AWS with enhanced features. The AWS CLI can be installed on Ubuntu 24.04 using the Snap package manager or Curl command-line utility as implemented in this article. Following the steps mentioned in this article, you can install the AWS CLI on your Ubuntu 24.04 and begin working with AWS cloud services.