Learn how to install AWS CLI on Linux system with this step-by-step guide. Simplify your AWS management tasks using command-line tools. #centlinux #linux #awscli
Table of Contents
1. Introduction
The AWS Command Line Interface (CLI) is an open-source tool that allows users to interact with AWS services through a terminal. Whether you are deploying infrastructure, managing S3 buckets, or configuring EC2 instances, the AWS CLI simplifies these operations by providing a unified command structure. This guide will focus on how to install AWS CLI on a Linux system and verify its installation, allowing you to harness the full power of AWS services directly from your Linux terminal.
2. What is AWS CLI?
AWS CLI is a command-line tool developed by Amazon Web Services that allows users to manage AWS resources and services from the terminal. Instead of navigating the AWS Management Console, you can issue commands that make it easier to automate tasks and integrate AWS services with your scripts and development environment.
3. Why Use AWS CLI on Linux?
Linux provides a robust and versatile environment for developers, making it an excellent platform for using AWS CLI. Whether you’re managing cloud infrastructure, deploying applications, or working with data, the AWS CLI on Linux offers:
- Easy integration with scripts for automation.
- The ability to execute commands directly from the terminal without switching to the browser-based console.
- Access to the latest AWS services and features.
4. Prerequisites for Installing AWS CLI on Linux
Before proceeding, ensure that you have the following:
- A Linux distribution (Red Hat-based, Fedora, CentOS, or any other Linux distro that uses
dnf
). - Administrator (root) privileges on your system.
- An internet connection to download the necessary packages.
Recommended Online Training: Learn Bash Shell in Linux for Beginners
5. How to install AWS CLI on Linux
This section walks you through the process of how to install AWS CLI on Linux system.
5.1. Checking the Linux Distribution Information
The first step in any installation is to check the details of your operating system. This helps ensure you follow instructions that are compatible with your system.
cat /etc/os-release
This command will output details about your Linux distribution, such as its name and version. This is useful in confirming that your distribution is supported by the commands we are going to run.
5.2. Verifying the Kernel Version
Next, it’s essential to check the kernel version your system is running. The AWS CLI installer requires compatibility with certain kernel versions.
uname -r
This command will print the kernel version of your Linux OS. Make sure it’s updated and meets the requirements of AWS CLI.
5.3. Updating Your Linux System
Before installing any new software, it’s best practice to update your system to ensure all dependencies are up-to-date.
dnf update -y
This command uses dnf
, the package manager for Fedora, Red Hat, and CentOS systems, to update your entire system. The -y
flag automatically confirms the update process, so you won’t need to manually approve each step.
5.4. Installing the Required Unzip Utility
The AWS CLI installer comes in a compressed file format, so you need the unzip
tool to extract it. If unzip
is not already installed on your system, use the following command:
dnf install -y unzip
This will install the unzip
utility, which is required to extract the downloaded AWS CLI package.
5.5. Downloading the AWS CLI Installer
Now, let’s download the AWS CLI installer from the official AWS website using curl
. This utility helps you fetch content from a URL.
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
This command downloads the latest version of AWS CLI (version 2) as a zip file and saves it with the name awscliv2.zip
. The -o
flag specifies the output filename.
5.6. Unzipping the Installer Package
Once the download is complete, use the unzip
command to extract the contents of the downloaded zip file.
unzip awscliv2.zip
This will create a new directory named aws
containing the installer files needed to set up AWS CLI on your Linux system.
5.7. Running the AWS CLI Installer
With the package extracted, you can now proceed to install AWS CLI by running the following command:
./aws/install
This command executes the AWS CLI installer. It will automatically place the necessary files in the correct system directories. Once the installation is complete, AWS CLI will be available globally on your system.
5.8. Verifying the AWS CLI Installation
After the installation, it’s always a good idea to verify that everything went smoothly and the AWS CLI is correctly set up.
aws --version
If the installation was successful, this command will output the installed version of AWS CLI, like so:
aws-cli/2.0.30 Python/3.8.3 Linux/4.19.128
This output confirms that AWS CLI version 2 is installed and ready for use on your system.
If you are new to Linux and facing difficulty in working at Linux Bash prompt. We recommend that, you should read The Linux Command Line, 2nd Edition: A Complete Introduction by William Shotts.
6. Video Tutorial: How to install AWS CLI on Linux
7. Conclusion
By following the above steps, you have successfully installed the AWS CLI on your Linux system. Now you can start managing your AWS resources directly from the terminal. Whether you’re working on automation tasks, deploying infrastructure, or handling data, AWS CLI offers a powerful way to streamline your cloud operations on Linux.
If you are Looking for a reliable Linux system admin? I offer expert management, optimization, and support for all your Linux server needs, ensuring smooth and secure operations. Have a look at my Fiverr Profile.
8. FAQs
1. How do I update AWS CLI once it’s installed?
You can update AWS CLI by running the installation steps again, starting from downloading the latest version of the installer. The new version will replace the old one.
2. Is AWS CLI available for other operating systems?
Yes, AWS CLI is available for Windows and macOS in addition to Linux.
3. Can I install AWS CLI using a package manager like apt
or yum
?
Yes, AWS CLI can be installed using package managers like yum
or apt
on certain Linux distributions. However, using the method provided in this guide ensures you get the latest version directly from AWS.
4. How can I configure AWS CLI after installation?
You can configure AWS CLI by running the command aws configure
, which will prompt you for your AWS Access Key ID, Secret Access Key, default region, and output format.
5. How do I uninstall AWS CLI?
To uninstall AWS CLI, simply run the following command from the installation directory:
sudo ./aws/install --uninstall