How to Install AWS CLI on Linux - Complete Guide

How to Install AWS CLI on Linux

A Complete Step-by-Step Guide

📅 Published: October 21, 2025 | ⏱️ 5 min read | 🏷️ AWS, Linux, DevOps

The AWS Command Line Interface (CLI) is a powerful tool that allows you to interact with Amazon Web Services directly from your terminal. Whether you're managing EC2 instances, S3 buckets, or any other AWS service, the CLI provides a fast and efficient way to automate and manage your cloud infrastructure.

In this guide, we'll walk through the complete process of installing AWS CLI version 2 on a Linux system and configuring it for use.

Prerequisites

Before we begin, make sure you have:

  • A Linux system (Ubuntu, Debian, or any other distribution)
  • Terminal access with sudo privileges
  • An active AWS account
  • Your AWS Access Key ID and Secret Access Key
💡 Tip: You can obtain your AWS credentials from the AWS IAM console under "Security Credentials".

Installation Steps

Step 1: Download AWS CLI

First, we'll download the latest AWS CLI version 2 installation package for Linux x86_64 architecture:

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

This command uses curl to download the AWS CLI installer and saves it as awscliv2.zip in your current directory.

Step 2: Install Unzip Utility

If you don't already have the unzip utility installed, you'll need it to extract the downloaded file:

sudo apt install unzip

This command installs the unzip package using apt package manager. If you're using a different Linux distribution, use your package manager (yum, dnf, etc.).

Step 3: Extract the Installation Files

Now, extract the contents of the downloaded zip file:

unzip awscliv2.zip

This will create a directory called aws containing the installation files.

Step 4: Run the Installer

Execute the installation script with sudo privileges:

sudo ./aws/install

The installer will copy the AWS CLI files to /usr/local/aws-cli and create symbolic links in /usr/local/bin.

Step 5: Configure AWS CLI

After installation, you need to configure AWS CLI with your credentials:

aws configure

You'll be prompted to enter the following information:

  • AWS Access Key ID: Your AWS access key
  • AWS Secret Access Key: Your AWS secret key
  • Default region name: Your preferred AWS region (e.g., us-east-1)
  • Default output format: json, yaml, text, or table

Verify Installation

To confirm that AWS CLI has been installed successfully, run:

aws --version

You should see output similar to:

aws-cli/2.x.x Python/3.x.x Linux/x.x.x
⚠️ Security Warning: Never share your AWS credentials or commit them to version control. Always keep them secure and rotate them regularly.

Quick Test

Test your configuration by listing your S3 buckets:

aws s3 ls

If configured correctly, you'll see a list of your S3 buckets (or an empty list if you don't have any).

Complete Installation Script

Here's the complete script with all commands in sequence:

curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" sudo apt install unzip unzip awscliv2.zip sudo ./aws/install aws configure

Conclusion

Congratulations! You've successfully installed and configured AWS CLI on your Linux system. You can now manage your AWS resources directly from the command line, automate tasks with scripts, and integrate AWS services into your workflows.

For more information about AWS CLI commands and usage, check out the official AWS CLI Documentation.

💡 Next Steps: Explore AWS CLI commands, set up multiple profiles, and learn about AWS CLI configuration files for advanced usage.

© 2025 AWS CLI Installation Guide | Made with ❤️ for DevOps Engineers

Comments

Popular posts from this blog