How to Install AWS-CLI in Ubuntu 22.04

Amazon Web Services is known as AWS. It is the most thorough, adaptable, and secure service, providing cloud APIs and platforms to people, businesses, and governmental organizations. It’s inexpensive, only costs you for the services you use and offers a free tier after a specific level of usage. AWS-CLI is a freely available tool for managing your services of AWS by using the commands. Multiple AWS services can be managed using it. It enables direct access to open APIs as well as the ability to create scripts to automate these services.

After installing it on the terminal, we can use it on the command line shell. The various ways to install AWS-CLI in Ubuntu 22.04 LTS will be covered in this article. It is possible to upgrade to the most recent version of AWS if it is already installed in your PC. Or you can install both versions simultaneously.

How to Install AWS-CLI in Ubuntu 22.04

AWS-CLI V2, which covers all the most recent features, is the most recent version. Using Python PIP, the apt package manager, and the official AWS distribution points, it is possible to install the most recent version of AWS CLI. We will explain a few methods to install the AWS-CLI in Ubuntu 22.04.

Method #1: Installing AWS-CLI Using the Apt Package Manager

Ubuntu’s official package repository includes the AWS CLI. As a result, the installation is relatively simple. Launch the terminal using the “Ctrl + Alt + T” shortcut. Then, to update the repositories, run the following command so that you can install the AWS-CLI using the APT package manager:

To install the AWS-CLI, run the following script. When prompted, press Y or y to confirm. Or type -Y or -y to avoid the prompt.

After pressing Y, the installation process will start. Once the installation is done, execute the following command to determine whether the AWS-CLI is installed successfully and what version is installed.

Method #2: Installing AWS-CLI Using Python PIP

There is a Python module for the AWS CLI. You always obtain the most recent version of the AWS-CLI tool when installing it as a Python module. The AWS-CLI can be simply updated once a new update of AWS CLI is published. It is installed as a Python module. Additionally, you can install AWS-CLI without having the super user rights. The Python virtual environments also support the installation of AWS CLI.

Both Python (2 and 3) support AWS CLI. Installing the AWS-CLI as a Python module in Ubuntu requires that Python PIP be installed in your machine. Ubuntu 22.04 LTS does not come with Python PIP installed by default. However, the Ubuntu official package repository makes it simple to install. Use the following command in Ubuntu 22.04 LTS to install the Python PIP.

To install PIP on Python 2, use the following command:

To install PIP on Python 3, use the following command:

To confirm the installation, type y. And then, hit the enter key.

The installation of Python PIP is completed successfully. Now, use the following command for AWS-CLI installation using the Python PIP.

Install the AWS-CLI for Python 2 using the following command:

Install the AWS-CLI for Python 3 using the following command:

Wait until the installation is finished. Use the following command to determine whether the installation went successful and whether the AWS-CLI version is installed in our system.

As can be seen in the previous output, the latest version may not always be installed when installing AWS-CLI as a Python module. The previous method that we used installed the version 1.25 of the AWS CLI. However, the most recent version is 2.7. Therefore, it is advised to install it using the official method, which is explained in the following example.

Method #3: Installing AWS-CLI by the Official Distribution of AWS

The installation of the AWS-CLI is also possible through the official distribution of AWS. We prefer using this method because it is authorized and always installs the most recent AWS CLI version. Run the following command to download the file of the official AWS installation and install the AWS-CLI in Ubuntu:

Alternatively, you can access the installation file by visiting the website “https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip”.

If it isn’t already installed, curl call should be installed, as seen in the following:

Now, use the unzip command to extract the installation file that has been compressed:

The previous script/command will extract the file for AWS installation in the active directory and the new directory named aws will be created in the current directory. Then, execute the following command for AWS CLI installation:

Your system has been successfully configured to run the AWS-CLI. Use the following command to check the AWS-CLI’s current version:

How to Update the AWS-CLI to the Newest Version in Ubuntu 22.04

The following command can be used to upgrade the AWS-CLI if you already installed an older version on your system. The symbolic link will be created at a path in your system, e.g. “/user/local/bin”. And the files will be stored at “/user/local/aws-cli” when the AWS-CLI is installed. The following command is used to update the files in both locations:

Use the following command to verify the installed version to see if it has been updated to the most recent version:

Configuring the AWS-CLI

You are required with an AWS account, a user account of IAM, an access key, and a secret key for IAM to use the AWS-CLI. The method for AWS-CLI configuration is listed as follows:

  • This step can be skipped if you’ve already created an AWS account. If not, register for an AWS account. Complete the registration process. The process takes 24 hours. However, the profile will be created within minutes.
  • By signing in as the AWS root user in the IAM interface and registering a new user who isn’t the root user, an IAM user account can be created. If you want to keep your account secure when using the AWS-CLI, use this account rather than the root user.
  • Create a secret access key and access key ID that will be used to sign in using the IAM account that you made in step one. Since they cannot be restored after being created, store the keys at the time of creation.
  • You can also visit the official website of AWS to read the AWS guide for further details.


In this tutorial, we tried to teach you how you can install the AWS-CLI in Ubuntu 22.04. In the introduction section, we discussed what AWS-CLI is. Then, we discussed the different methods to install the AWS-CLI. First, we learned how we can install the AWS-CLI via the apt package manager. In the second method, we installed the AWS-CLI using Python PIP. And in the third method, we installed the AWS-CLI through the official distribution. We also explained how to update and configure the AWS-CLI.

Similar Posts