AWS CLI or Amazon Web Service Command Line Interface is a command-line tool for managing and administering your Amazon Web Services. AWS CLI provides direct access to the public API (Application Programming Interface) of Amazon Web Services. Since it’s a command-line tool, you can also use it to create scripts for automating your Amazon Web Services.

In this article, I will show you how to install the AWS CLI program on Ubuntu 22.04 LTS using the APT package manager. I will also show you how to install the latest version of the AWS CLI program on Ubuntu 22.04 LTS as a Python module using Python PIP. So, let’s get started.

Table of Contents

  1. Installing AWS CLI using APT Package Manager
  2. Installing AWS CLI using Python PIP
  3. Basics of AWS CLI
  4. Login to AWS Account using AWS CLI
  5. Getting Help with AWS CLI
  6. Conclusion

Installing AWS CLI Using APT Package Manager

AWS CLI is available in the official package repository of Ubuntu 22.04 LTS. So, it is very easy to install.

First, update the APT package repository cache with the following command:

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2022/05/echo/Install-AWS-1.png" data-lazy- height="86" src="data:image/svg xml,” width=”551″>

The APT package repository cache should be updated.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2022/05/echo/Install-AWS-2.png" data-lazy- height="533" src="data:image/svg xml,” width=”1130″>

To install AWS CLI on Ubuntu 22.04 LTS from the official package repository, run the following command:

$ sudo apt-get install awscli

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2022/05/echo/Install-AWS-3.png" data-lazy- height="84" src="data:image/svg xml,” width=”649″>

Press Y and then press to confirm the installation.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2022/05/echo/Install-AWS-4.png" data-lazy- height="535" src="data:image/svg xml,” width=”1125″>

The required packages are being downloaded from the internet. It will take a few seconds to complete.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2022/05/echo/Install-AWS-5.png" data-lazy- height="533" src="data:image/svg xml,” width=”1125″>

Once the packages are downloaded, the APT package manager will install them. It will take a few seconds to complete.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2022/05/echo/Install-AWS-6.png" data-lazy- height="530" src="data:image/svg xml,” width=”1121″>

AWS CLI should be installed at this point.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2022/05/echo/Install-AWS-7.png" data-lazy- height="535" src="data:image/svg xml,” width=”1128″>

To check whether AWS CLI is working correctly with the following command:

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2022/05/echo/Install-AWS-8.png" data-lazy- height="137" src="data:image/svg xml,” width=”814″>

As you can see, AWS CLI is working correctly.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2022/05/echo/Install-AWS-9.png" data-lazy- height="137" src="data:image/svg xml,” width=”814″>

Installing AWS CLI Using Python PIP

AWS CLI is also available as a Python module. The advantage of installing AWS CLI as a Python module is that you always get an up-to-date version of the AWS CLI program. If AWS CLI is installed as a Python module, it will be very easy to update AWS CLI once a new version of AWS CLI is available. You also don’t need superuser privileges to install AWS CLI as a Python module. AWS CLI can also be installed in a Python virtual environment.

AWS CLI is available for Python 2 and Python 3. You must have Python PIP installed on your computer for installing AWS CLI on Ubuntu 22.04 LTS as a Python module. Python PIP is not installed by default on Ubuntu 22.04 LTS. But you can install it easily from the official package repository of Ubuntu.

To install Python PIP on Ubuntu 22.04 LTS, run the following command:

For Python 2:

$ sudo apt install python-pip

For Python 3:

$ sudo apt install python3-pip

Press Y and then press to confirm the installation.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2022/05/echo/Install-AWS-10.png" data-lazy- height="528" src="data:image/svg xml,” width=”1127″>

Python PIP should be installed.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2022/05/echo/Install-AWS-11.png" data-lazy- height="539" src="data:image/svg xml,” width=”1138″>

To install AWS CLI on Ubuntu 22.04 LTS as a Python module using Python PIP, run the following command:

Python 2 PIP:

$ pip install awscli –upgrade –user

Python 3 PIP:

$ pip3 install awscli –upgrade –user

AWS CLI is being installed as a Python module. It will take a few seconds to complete.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2022/05/echo/Install-AWS-12.png" data-lazy- height="388" src="data:image/svg xml,” width=”929″>

The latest version of AWS CLI should be installed as a Python module.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2022/05/echo/Install-AWS-13.png" data-lazy- height="404" src="data:image/svg xml,” width=”926″>

Once AWS CLI is installed as a Python module, you can run AWS CLI as follows:

Python 2 Command:

$ python -m awscli –version

Python 3 Command:

$ python3 -m awscli –version

As you can see, AWS CLI is working correctly.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2022/05/echo/Install-AWS-14.png" data-lazy- height="142" src="data:image/svg xml,” width=”928″>

Basics of AWS CLI

I wanted to show you how to work with AWS CLI practically. But I don’t have a credit card, so I can’t verify my AWS account. But don’t worry; I will give you enough information so that you can get started with AWS CLI on Ubuntu 22.04 LTS.

In this section, I will be using the Ubuntu 22.04 LTS packaged version of the AWS CLI program, not the Python module version. So, make sure to adjust the command if you’re using the Python module version of the AWS CLI program.

Login to AWS Account Using AWS CLI

First, you have to use your AWS account credentials to configure the AWS CLI client. To do that, run the following command:

Ubuntu Packaged AWS CLI:

AWS CLI Python Module:

$ python -m awscli configure

Type in your AWS Access Key ID and press .

NOTE: An Access Key ID can be created from the AWS Management Console.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2022/05/echo/Install-AWS-15.png" data-lazy- height="117" src="data:image/svg xml,” width=”678″>

Type in your AWS Secret Access Key ID and press .

NOTE: A Secret Access Key ID can be created from the AWS Management Console.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2022/05/echo/Install-AWS-16.png" data-lazy- height="141" src="data:image/svg xml,” width=”681″>

Type in your default region name. It’s something like us-west-2. Once you’re done, press .

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2022/05/echo/Install-AWS-17.png" data-lazy- height="168" src="data:image/svg xml,” width=”833″>

Type in your default output format. If the output format does not matter much to you, just press to choose the default output format.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2022/05/echo/Install-AWS-18.png" data-lazy- height="189" src="data:image/svg xml,” width=”811″>

If you prefer to use the JSON (JavaScript Object Notation) output format, type in json and press .

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2022/05/echo/Install-AWS-19.png" data-lazy- height="180" src="data:image/svg xml,” width=”820″>

Once you’ve configured the AWS CLI program with your AWS account credentials, you should be able to manage your Amazon Web Services using AWS CLI.

The configuration files of the AWS CLI program are stored in the ~/.aws/config and ~/.aws/credentials files, as you can see in the screenshot below.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2022/05/echo/Install-AWS-20.png" data-lazy- height="278" src="data:image/svg xml,” width=”780″>

If you want to use different AWS account credentials, you have to delete the ~/.aws/config and ~/.aws/credentials files with the following command and run the aws configure command again.

$ rm -v ~/.aws/config ~/.aws/credentials

Getting Help With AWS CLI

To figure out how to use the AWS CLI program, you can read the AWS CLI man pages. AWS also has a great guide and online documentation on AWS CLI that you can read to learn more about AWS CLI.

To get help on the AWS CLI program from the terminal, you can run the following command:

Or,

Or,

AWS CLI man page is opened on the terminal. You can learn a lot of stuff from the AWS CLI man page.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2022/05/echo/Install-AWS-21.png" data-lazy- height="541" src="data:image/svg xml,” width=”1153″>

AWS has different services such as EC2, S3, etc. To get help on configuring specific AWS services using AWS CLI, you can read the respective man pages as follows:

$ aws <service-name> help

NOTE: Here, is the AWS service name that you want to learn how to configure using the AWS CLI program.

For example, to learn more about configuring the AWS S3 object storage service using AWS CLI, you can run the following command:

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2022/05/echo/Install-AWS-22.png" data-lazy- height="531" src="data:image/svg xml,” width=”1129″>

For more information, you can check the official online documentation of the AWS CLI program.

You can also download the official AWS CLI PDF manual.

Conclusion

This article shows you how to install the AWS CLI program on Ubuntu 22.04 LTS using the APT package manager. I have also shown you how to install the latest version of the AWS CLI program on Ubuntu 22.04 LTS as a Python module. I have shown you how to log in to your AWS account using the AWS CLI program as well. Finally, I have shown you how to get help on the AWS CLI program so that you can learn more about configuring different AWS services with it.