How to Install AWS CLI on Linux Systems

AWS (Amazon Web Services) is becoming a popular and growing trend in the Linux community. It is the perfect cloud infrastructure for any Linux user that wants to scale the productivity potential of their acquired Linux administration skills.

Whether you are looking for technological solutions related to Analytics & Data Lakes, Machine Learning, Serverless Computing, Storage, or Linux-centered products related to Analytics, Databases, Containers, and Front-End Web & Mobile, AWS has enough piece of the pie for all users.

Understanding the AWS CLI

The AWS CLI (Command Line Interface) makes it possible to access all the AWS services you might need in the comfort of your Linux command-line environment.

The AWS tool disregards the need for the browser-based AWS management console since it mimics the implementation of equivalent functionalities. Its features that can be accessed via the AWS CLI include AWS Management Console access functions and all Infrastructure as a Service (IaaS) AWS management & Administration functions.

AWS CLI makes it possible to not only have direct access to AWS services via the Linux terminal environment, but also public APIs. This tool also makes resources management possible through user-developed shell scripts.

Step 1: Installing Python PIP in Linux

Python PIP needs to be installed on your Linux system to provide the Python module associated with the installation of the AWS CLI. Installing the AWS CLI via a Python module ensures that your Linux system will continuously be up-to-date with the latest AWS CLI release every time you execute a system update command.

$ sudo apt install python3-pip      [On Debian, Ubuntu and Mint]
$ sudo yum install python3-pip      [On RHEL/CentOS/Fedora and Rocky Linux/AlmaLinux]
$ sudo emerge -a dev-python/pip     [On Gentoo Linux]
$ sudo pacman -S python-pip         [On Arch Linux]
$ sudo zypper install python3-pip   [On OpenSUSE]    

Check on the installed version of the Python package manager.

$ pip3 --version
Check Python PIP Version
Check Python PIP Version

Step 2: Installing AWS CLI in Linux

Our Linux systems are now ready for the AWS CLI installation via Python’s package manager by running the following command:

$ pip3 install awscli --upgrade --user 

Do not run the above command as a sudoer/root user to be safe from future package conflicts during their installation or configuration.

Install AWS CLI in Linux
Install AWS CLI in Linux

Confirm the successful installation of AWS CLI.

$ python3 -m awscli --version
Check AWS CLI in Linux
Check AWS CLI in Linux

Step 3: Configuring AWS CLI in Linux

We need to configure some AWS CLI with your AWS credentials by running the awscli configure command.

$ python3 -m awscli configure 

You will be asked for AWS Access Key ID, AWS Secret Access Key, Default region name, and Default output format.

Configure AWS CLI in Linux
Configure AWS CLI in Linux

For AWS Access Key ID and Secret Access, Log into AWS from the Web Interface and navigate to the Security credentials section on the account username drop menu.

AWS Security Credentials
AWS Security Credentials

You should be redirected to the Access Keys region. Click on Create New Access Key if you do not have one.

AWS Access Keys
AWS Access Keys

You will be met with the following prompt. Here, you can download and save the Key File.

Download AWS Access Keys
Download AWS Access Keys

To view them, click on Show Access Key.

View AWS Access Keys
View AWS Access Keys

You can now use these keys to finalize AWS CLI configuration.

$ python3 -m awscli configure 
Configure AWS CLI in Linux
Configure AWS CLI in Linux

The files ~/.aws/credentials and ~/.aws/config store the AWS CLI program’s configurations.

$ ls -l ~/.aws/config
$ ls -l ~/.aws/credentials
Store AWS CLI Configuration
Store AWS CLI Configuration

To start interacting with your AWS CLI, use the command:

$ pythom3 -m awscli s3 ls

For more help with using AWS CLI, run:

$ python3 -m awscli help

Your AWS CLI journey on Linux is now ready to begin. Hope you enjoyed the article.

Tutorial Feedback...
Was this article helpful? If you don't find this article helpful or found some outdated info, issue or a typo, do post your valuable feedback or suggestions in the comments to help improve this article...

Got something to say? Join the discussion.

Have a question or suggestion? Please leave a comment to start the discussion. Please keep in mind that all comments are moderated and your email address will NOT be published.