How To Install AWS CLI on Ubuntu 24.04 LTS
In this tutorial, we will show you how to install AWS CLI on Ubuntu 24.04 LTS. The Amazon Web Services Command Line Interface (AWS CLI) is an essential tool for developers, system administrators, and DevOps professionals who manage AWS services. It enables users to interact with various AWS services through a terminal, automating tasks and streamlining workflows.
This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo
‘ to the commands to get root privileges. I will show you the step-by-step installation of AWS CLI on Ubuntu 24.04 (Noble Numbat). You can follow the same instructions for Ubuntu 22.04 and any other Debian-based distribution like Linux Mint, Elementary OS, Pop!_OS, and more as well.
Prerequisites
- A server running one of the following operating systems: Ubuntu and any other Debian-based distribution like Linux Mint.
- It’s recommended that you use a fresh OS install to prevent any potential issues.
- SSH access to the server (or just open Terminal if you’re on a desktop).
- An active internet connection. You’ll need an internet connection to download the necessary packages and dependencies.
- An Ubuntu 24.04 system with root access or a user with sudo privileges.
Install AWS CLI on Ubuntu 24.04 LTS Noble Numbat
Step 1. Updating the Package Repository.
It’s crucial to keep your system up-to-date to avoid potential compatibility issues and security vulnerabilities. Open your terminal and run the following commands to update the package lists and upgrade installed packages:
sudo apt update
This command will fetch the latest package information from the Ubuntu repositories, allowing you to install the most recent version of AWS CLI and its dependencies. Updating the package repository is crucial to maintaining the security and stability of your system.
Step 2. Installing AWS CLI on Ubuntu 24.04.
There are three primary methods to install AWS CLI on Ubuntu 24.04 LTS: using the APT package manager, downloading from the official AWS website, or using the Snap package manager. Each method has its advantages, and we’ll explore them in detail.
- Method 1: Using APT Package Manager
The simplest way to install AWS CLI is through the APT package manager. Follow these steps:
sudo apt install awscli
Verify the installation:
aws --version
This method is straightforward and ensures that the AWS CLI is integrated with your system’s package manager, making updates and maintenance more convenient.
- Method 2: Installing from the Official AWS Website
Installing AWS CLI from the official website guarantees that you have the latest version and provides more control over the installation process. Here’s how to do it:
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
Unzip the package:
unzip awscliv2.zip
Now install AWS CLI using the following command below:
sudo ./aws/install
Verify the installation:
aws --version
By using the official package, you can be confident that you have the most recent features and bug fixes.
- Method 3: Using Snap Package Manager
Snap is a popular package manager that offers a containerized approach to software installation. To install AWS CLI using Snap:
sudo apt install snapd
Install AWS CLI:
sudo snap install aws-cli --classic
Verify the installation:
aws --version
The Snap installation provides an isolated environment for AWS CLI, which can be beneficial for managing multiple versions or avoiding conflicts with other system packages.
Step 3. Configuring AWS CLI.
After installing AWS CLI, you need to configure it with your AWS credentials. Run the following command:
aws configure
You will be prompted to enter your AWS Access Key, Secret Access Key, default region, and output format. If you don’t have your access keys, create them in the IAM Management Console.
For advanced configuration, you can set up multiple profiles to manage different AWS accounts or regions. To do this, use the --profile
flag:
aws configure --profile my-profile
To ensure that AWS CLI is installed correctly, run a simple command, such as listing your S3 buckets:
aws s3 ls
If the command executes without errors, your installation is successful.
Step 4. Troubleshooting Common Installation Issues.
If you encounter issues during the installation process, here are some common problems and their solutions:
- Dependency errors: Make sure you have the required dependencies installed, such as Python and pip. You can install them using
sudo apt install python3 python3-pip
. - AWS CLI not executing: Ensure that the AWS CLI binary is in your system’s PATH. You can add it by running
export PATH=$PATH:/usr/local/bin/aws
. - PATH issues: If you’re using the official package, make sure to run the installation script with
sudo
to ensure that the binary is placed in the correct location.
Congratulations! You have successfully installed AWS CLI. Thanks for using this tutorial for installing AWS CLI on the Ubuntu 24.04 LTS system. For additional help or useful information, we recommend you check the AWS CLI website.