How to Install AWS CLI on Ubuntu 24.04
The Amazon Web Services (AWS) Command Line Interface (CLI) is a powerful tool that allows you to manage AWS services from a terminal session on your Ubuntu system. With the AWS CLI, you can efficiently control multiple AWS services and automate tasks through scripts. This guide will walk you through the steps to install AWS CLI on Ubuntu, ensuring you have the tools needed to manage your cloud infrastructure seamlessly.
Step 1: Update Your System
Before you install any new software, it’s always a good idea to update your system to ensure all existing packages are up to date. Open your terminal and run the following commands:
sudo apt update && sudo apt upgrade -y
Step 2: Install AWS CLI Using APT
The AWS CLI can be installed using the apt
package manager. To do this, you need to add the AWS CLI repository to your system.
2.1. Install Prerequisites
First, install the prerequisites required to add the repository:
sudo apt install -y curl apt-transport-https lsb-release gpg
2.2. Add the AWS CLI Repository
Next, add the AWS CLI GPG key and repository to your system:
curl "https://d1vvhvl2y92vvt.cloudfront.net/awscli-exe-linux-x86_64.zip.sig" -o "awscliv2.sig" curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" gpg --import awscliv2.sig
2.3. Update the Package List
After adding the repository, update your package list:
sudo apt update
2.4. Install AWS CLI
Finally, install the AWS CLI:
sudo apt install -y awscli
Step 3: Verify the Installation
To confirm that the AWS CLI is installed correctly, run the following command:
aws --version
You should see output similar to:
aws-cli/2.x.x Python/3.x.x Linux/4.x.x botocore/2.x.x
Step 4: Configure AWS CLI
After installation, you need to configure the AWS CLI with your AWS credentials. You can do this using the aws configure
command:
aws configure
You will be prompted to enter your AWS Access Key ID, Secret Access Key, region, and output format. If you don’t have these credentials, you can generate them from the AWS Management Console.
AWS Access Key ID [None]: YOUR_ACCESS_KEY AWS Secret Access Key [None]: YOUR_SECRET_KEY Default region name [None]: us-east-1 Default output format [None]: json
Step 5: Verify Configuration
To verify that your configuration is correct, you can run a simple command such as listing your S3 buckets:
aws s3 ls
If everything is configured correctly, you should see a list of your S3 buckets.
Additional Tips
Updating AWS CLI
To keep your AWS CLI up to date, you can periodically run:
sudo apt update sudo apt upgrade awscli
Uninstalling AWS CLI
If you ever need to uninstall the AWS CLI, you can do so with:
sudo apt remove awscli
Conclusion
Installing the AWS CLI on Ubuntu is a straightforward process that can greatly enhance your ability to manage AWS services. By following the steps outlined in this guide, you can have the AWS CLI up and running in no time. With the AWS CLI, you can automate tasks, manage resources, and streamline your workflow directly from the command line.
If you have any questions or run into any issues, the AWS CLI Documentation is an excellent resource for further information and troubleshooting tips. Happy cloud computing!
Discover more from Patrick Domingues
Subscribe to get the latest posts sent to your email.