AWS

How to Install AWS CLI on CentOS 8

Amazon Web services, or AWS, provided by Amazon, is a comprehensive and ever-evolving cloud computing platform. It leads the cloud computing industry and is being used by many tech giants for cloud computing needs. The ease of use, security, and flexibility make AWS the best option among cloud computing platforms.

This post contains a profound guide on how to install AWS CLI on CentOS 8 Operating system. AWS CLI is the command-line interface that is used to configure and manage AWS. We can even automate many processes by using scripts. AWS CLI is available on all major operating systems, but we will only focus on how to install it on CentOS 8 machines, specifically in this article.

WHY AWS?

AWS is the most used cloud computing platform. Major tech giants use it for their IT infrastructure needs, such as storing databases and sharing computing power. AWS is still the best option, even when it comes to new businesses, as Amazon offers very affordable options. Amazon does not charge a fixed amount upfront; instead, they treat AWS services like utilities, and you pay as much as you use them.

AWS is the best platform for almost any cloud computing need, such as the warehousing of data, tools deployment, and so on.

As everyone knows now how security is important in cloud computing platforms. AWS offers a very secure cloud platform and has many features which ensure perfect solutions for any IT infrastructure need. AWS has many well-built security features such as strong data encryption, security certifications, hardware security modules, and robust physical security.

Now let’s learn how to install AWS CLI.

Installation of AWS CLI

To install AWS CLI and its tools, we will first need to install the pip package.

Fire up the terminal and run the command given below to install the pip package:

$ sudo dnf install python3-pip

As you can see in the terminal above, the pip package is already installed on my system.

Now we can use the “pip3” tool to install the AWS CLI tools:

$ pip3 install awscli --upgrade --user22

You can verify whether the AWS CLI was successfully installed by using the command provided below:

$ aws --version

Configuration of AWS CLI

To configure CLI execute the “aws configure” command:

$ aws configure

Here you will be asked for an AWS access key. After providing the key, you can begin to configure AWS CLI.

Uninstall CLI

You can use the command given below to remove/uninstall CLI:

$ pip3 uninstall awscli

Download and install AWS CLI version 2

AWS CLI version 2 is the latest version of AWS CLI, and in this version 2, Amazon has eliminated CLI’s dependency on python. It already has self-contained and embedded Python, so you no longer have to worry about the python version and conflicting python packages.

This section will discuss the steps we can use to download and install AWS CLI on CentOS 8. This method can work on most Linux distributions with a little bit of change.

Use the following command to download the zip file of the latest version of AWS CLI:

$ curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"

The command given above will download the zip file to the current directory with the name awscliv2.zip. If you want to change the local name of the zip file, please give a different name to the -o flag.

If you want to install a particular version, mention the version number along with the filename.

After downloading, unzip the AWS CLI ZIP file using the command:

$ unzip awscliv2.zip

The command given above will unzip the installer file into the current working directory.

Some Linux distributions might not have the built-in unzip command, so you might need to use an alternative.

Now execute the command given below to install the aws from the recently unzipped directory. The files will be installed to /usr/local/aws-cli by default.

$ sudo ./aws/install

Verify the installation by running the following command:

$ aws --version

Output

Now we will learn how to uninstall AWS CLI version 2.

Uninstall/Remove AWS CLI Version 2

First, use the which command to locate the symlink:

$ which aws

To find the directory symlink points to, use the ls command:

ls -l /usr/local/bin/aws

Now run the following command to remove the two symlinks:

$ sudo rm /usr/local/bin/aws

$ sudo rm /usr/local/bin/aws_completer

Now execute the following command to remove –install-dir directory.

$ sudo rm -rf /usr/local/aws-cli

Now, if I use the “$ aws –version” command, I will get the following error:

$ aws --version

The error represents that AWS CLI is not installed on the system.

Conclusion

In this article, we learned what AWS is and why it is leading the cloud computing industry. Then we moved on to the installation process of AWS CLI. Moreover, we touched a bit on configuration, management, and the uninstallation process of AWS CLI. Then we repeated the same steps for CLI version two.

About the author

Shehroz Azam

A Javascript Developer & Linux enthusiast with 4 years of industrial experience and proven know-how to combine creative and usability viewpoints resulting in world-class web applications. I have experience working with Vue, React & Node.js & currently working on article writing and video creation.