How to Install AWS CLI on Linux

Share on:

Table of Contents

The AWS Command Line Interface (AWS CLI) is a unified tool to manage your AWS services. With just one tool to download and configure, you can control multiple AWS services from the command line and automate them through scripts. The official documentation for AWS CLI is available at You can also read about its general usage at Below are some common scenarios where you may need to install AWS CLI on Linux operating system and their solutions:

How to Install AWS CLI on Linux

The AWS CLI version 2 packages are available under the default repositories. You can use the package manager for installing AWS CLI v2 on your Linux systems.

Choose one of the below commands to install:

  • Ubuntu and Debian Systems
    sudo apt install awscli 
  • Fedora and CentOS 8
    sudo dnf install awscli 
  • CentOS 7 and Scientific Linux
    sudo yum install awscli 
  • Other than the package manager, you can directly install using source code. This will install the latest awscli version on any Linux platform.
    curl "" -o "" 
    sudo ./aws/install 

Generate Access Credentials

To use AWS CLI with your AWS credentials, you need to set the credentials of your AWS account in the environment variables of your system. The credentials are used to authenticate your request in order to access the AWS APIs using AWS CLI. If you are accessing an Amazon Web Services (AWS) resource from a computer that is not registered with AWS, you need to authenticate as an AWS user.

To generate new credentials follow:

  • Head to AWS Security Credentials.
  • Expand option Access keys (access key ID and secret access key)
  • Click the button Create New Access Key
  • Copy the access key ID and secret access key and save to a safe place

Configure AWS CLI

You can authenticate with AWS and set your credentials for the number of AWS services from the command line. AWS credentials are managed using credentials profiles. Credentials profiles store your account name, access key ID, and secret access key. Credentials are selected when you issue the AWS CLI command. You can manage the credentials through the AWS console or from the command line.

To set credentials in the AWS CLI, you can use the following command:

aws configure 

This will prompt for AWS Access Key ID and Secret Access Key created in the above step.

AWS Secret Access Key [None]: 3SDFskjf8KDfjksdf9sdfjsdkfjkKSDKSJFKD
Default region name [None]: us-east-1
Default output format [None]:

That’s it. Your system is configured with the AWS CLI tools.

Working with AWS CLI Commands

AWS CLI tools provide your option to manage multiple services via the command line. To get help about uses type:

aws help 

Here are a few example commands to work with aws cli:

  • List all the instances
    aws ec2 describe-instances
  • List instances from other zone
    aws ec2 describe-instances --region=us-west-1
  • List S3 buckets
    aws s3 list

AWS CLI is a command line interface built on top of the AWS APIs. It makes it easy to manage and automate the usage of Amazon Web Services directly from your terminal without having to use a browser or third-party applications.