The AWS Command Line Interface (CLI) is a unified tool designed to manage and interact with Amazon Web Services (AWS) resources from the command line. It allows users to execute commands that can control multiple AWS services and automate tasks through scripts, making it a powerful tool for developers, system administrators, and DevOps professionals. With AWS CLI, users can perform a wide range of operations, such as launching instances, managing S3 buckets, configuring AWS services, and deploying applications. The CLI supports all AWS services, providing a versatile and efficient way to manage cloud infrastructure without needing to interact with the AWS Management Console. Its flexibility and the ability to integrate with other command-line tools make it an essential resource for those looking to streamline their cloud operations.

Below is a step-by-step guide to installing the AWS CLI on Ubuntu 24.04.

Update Your Package List

Before installing the AWS CLI, it’s good practice to update the package list to ensure you have the latest information on the newest versions of packages and their dependencies.

sudo apt update

Install Required Dependencies

The AWS CLI requires Python, so you’ll need to install Python and the unzip utility, which is used to extract the installation files.

sudo apt install -y python3 python3-pip unzip

Download the AWS CLI Installation File

Download the latest version of the AWS CLI directly from the official AWS website using curl. The command below downloads the ZIP file to your home directory.

curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"

After downloading the ZIP file, you need to unzip it using the unzip command.

unzip awscliv2.zip

This will extract the contents of the ZIP file into a directory named aws.

Install the AWS CLI

Once the files are extracted, run the install script to install the AWS CLI on your system.

sudo ./aws/install

Verify the Installation

To confirm that the AWS CLI has been installed successfully, check its version by running:

aws --version

You should see output similar to this:

aws-cli/2.x.x Python/3.x.x Linux/4.x.x-xx-generic exe/x86_64.ubuntu.24.04

This indicates that AWS CLI version 2.x.x is installed on your system.

Configure the AWS CLI

After installation, you need to configure the AWS CLI with your credentials and default settings. Run the following command:

aws configure

You’ll be prompted to enter the following details:

  1. AWS Access Key ID: Enter your access key ID here.
  2. AWS Secret Access Key: Enter your secret access key here.
  3. Default region name: Enter your preferred AWS region (e.g., us-west-2).
  4. Default output format: Specify the output format (json, text, or yaml). json is commonly used.

Clean Up Installation Files (Optional)

After installing and verifying the AWS CLI, you can clean up by removing the ZIP file and the extracted directory to free up space.

rm -rf awscliv2.zip aws

Conclusion

You have successfully installed the AWS CLI on Ubuntu 24.04. You can now use the CLI to manage your AWS services directly from the command line. Remember to refer to the AWS CLI documentation for more details on available commands and their usage.