How to install AWS CLI on Ubuntu 24.04 LTS

This tutorial teaches you how to install AWS CLI on Ubuntu 24.04 LTS.

What is AWS CLI

AWS CLI is a command-line tool for managing Amazon Cloud services from the console. Infrastructure engineers use the AWS Command Line Interface to create S3 buckets, EC2 instances, Lambdas, etc.

Prerequisites

curl is required to download the AWS CLI installer. It’s not mandatory, but I recommend it.

Step 1: Update Ubuntu 24.04 LTS

To update Ubuntu 24.04 LTS type:

sudo apt update

Step 2: Install curl on Ubuntu 24.04 LTS

To install curl on Ubuntu 24.04 LTS type:

sudo apt install curl

Step 3: Download the AWS CLI Linux installer

Amazon Cloud provides a Linux installer for the AWS CLI tool. To download the AWS CLI Linux installer type:

curl --location https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip --output awscli.zip
how to install aws cli on ubuntu 24.04 lts
AWS CLI Linux installer

The –location option specifies the URL for the remote resources, while –output specifies the file’s name to be saved.

Step 4: Extract the AWS CLI installer zip archive

The AWS CLI installer is packed in a zip archive. To extract the AWS CLI installer type:

unzip awscli.zip

Step 5: Install AWS CLI on Ubuntu 24.04 LTS

The command in step 4 extracts the AWS CLI installer zip archive to a directory named aws.

Change the directory to aws.

cd aws

To view the content inside the aws directory type:

ls
aws cli linux installer
AWS CLI installer

To make the AWS CLI Linux installer executable type:

sudo chmod +x install

To install AWS CLI on Ubuntu 24.04 LTS type:

sudo ./installer

The above command installs the AWS CLI tool to /usr/local/bin/. To verify the AWS CLI installation type:

aws --version
how to installa aws cli on ubuntu 24.04 lts
AWS CLI on Ubuntu 24.04 LTS

Step 6: Configure AWS CLI with LocalStack

LocalStak helps to simulate Amazon Cloud resources on your local host. Follow this link to learn how to install LocalStack on Ubuntu 24.04 LTS.

To configure AWS CLI for LocalStack type:

aws configure
how to configure aws cli for localstack
AWS CLI configuration with LocalStack

For the AWS Access Key ID and AWS Secret Access Key, you can type anything you like. Make sure to provide the correct details for the default region and the default output format.

Step 7: Create an AWS S3 bucket with AWS CLI and LocalStack

To create an AWS S3 bucket on your localhost with AWS CLI and LocalStack type:

aws --endpoint-url=http://localhost:4566/ s3 mb s3://my-bucket
S3 bucket creation with aws

In the above command the –endpoint-url specifies the URL of the Amazon Cloud provider. In our case, it’s the LocalStack. mb stands for making a bucket, s3 stands for the type of bucket, and my-bucket is the custom name of the bucket you want to create.

To list available AWS S3 buckets with aws type:

aws --endpoint=http://localhost:4566 s3 ls

Step 8: Remove an AWS S3 bucket with AWS CLI and LocalStack

To remove an AWS S3 bucket with aws type:

aws --endpoint-url=http://localhost:4566/ s3 rb s3://my-bucket
how to remove an s3 bucket with aws
Remove AWS S3 bucket with aws

In the above command rb stands for remove bucket.

Final thoughts

Through this article, you learned how to install AWS CLI on Ubuntu 24.04 LTS through clear and easy-to-follow steps. You also learned how to use the aws command line tool by creating an Amazon S3 bucket on your local host with the help of LocalStack.

1 thought on “How to install AWS CLI on Ubuntu 24.04 LTS

Leave comment

Your email address will not be published. Required fields are marked with *.