How To Install AWS CLI on Ubuntu 22.04 LTS
In this tutorial, we will show you how to install AWS CLI on Ubuntu 22.04 LTS. The AWS Command Line Interface (AWS CLI) is an essential tool for developers, system administrators, and DevOps professionals working with Amazon Web Services (AWS). It allows you to manage and interact with various AWS services directly from the command line, enabling efficient automation and scripting of cloud infrastructure tasks.
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 the AWS CLI on Ubuntu 22.04 (Jammy Jellyfish). 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 22.04, 20.04, and any other Debian-based distribution like Linux Mint.
- SSH access to the server (or just open Terminal if you’re on a desktop).
- Basic knowledge of the Linux command-line interface (CLI). This guide assumes you’re comfortable with executing commands in a terminal.
- An active internet connection. You’ll need an internet connection to download the necessary packages and dependencies for AWS CLI.
- A
non-root sudo user
or access to theroot user
. We recommend acting as anon-root sudo user
, however, as you can harm your system if you’re not careful when acting as the root.
Install AWS CLI on Ubuntu 22.04 LTS Jammy Jellyfish
Step 1. Before installing any package, it’s recommended to update the package lists by running:
sudo apt update sudo apt upgrade
These commands will fetch the list of available updates and then upgrade your system packages. This ensures that you have the latest security patches and performance improvements.
Step 2. Installing AWS CLI on Ubuntu 22.04.
Next, we will install AWS CLI using the APT package manager. Type the following command in your terminal:
sudo apt install awscli
During the installation process, you may be prompted to confirm the installation. Press ‘Y
‘ and then ‘Enter
‘ to continue. The APT package manager will handle the rest, downloading and installing the necessary packages.
After the installation is complete, it’s important to verify that AWS CLI has been installed correctly. You can do this by checking the version of AWS CLI. Type the following command in your terminal:
aws --version
The output should display the version number of AWS CLI. If you see the version number, it means AWS CLI has been installed successfully.
Step 3. Configure AWS CLI.
After successfully installing the AWS CLI on your Ubuntu 22.04 system, you’ll need to configure it with your AWS credentials to authenticate and authorize your interactions with AWS services. Follow these steps:
aws configure
You will be prompted to enter the following details:
- AWS Access Key ID and Secret Access Key: Provide your AWS Access Key ID and AWS Secret Access Key, which you can obtain from the AWS Management Console by creating an IAM user with the appropriate permissions.
- Default AWS Region: Specify the default AWS Region where you want to interact with AWS services. For example,
us-east-1
for the US East (N. Virginia) region. - Default Output Format: Choose the preferred output format for AWS CLI commands. Common options include
json
,text
, andtable
.
After completing the configuration, you can verify that the AWS CLI is properly configured by running a simple command, such as:
aws ec2 describe-regions
Step 4. Test AWS CLI.
After configuring AWS CLI, it’s a good idea to test it to ensure it’s working as expected. Here are a couple of simple commands you can use:
aws s3 ls aws ec2 describe-instances
The first command lists all your S3 buckets, and the second command describes your EC2 instances. If the output is as expected, it means AWS CLI is working correctly.
If for any reason you need to uninstall AWS CLI, you can do so using the following command:
sudo apt remove awscli
Congratulations! You have successfully installed AWS CLI. Thanks for using this tutorial for installing AWS CLI on the Ubuntu 22.04 LTS Jammy Jellyfish system. For additional help or useful information, we recommend you check the official AWS CLI website.