how to install aws cli in linux

How to Install AWS CLI on Linux

AWS CLI is a command line tool that allows you to manage the different AWS services using command line. It also allows you to automate AWS management using scripts. Here is how to install AWS CLI on Linux. You can use these steps to install AWS CLI on Ubuntu, CentOS. We will also look at how to check if AWS CLI is installed and how to access AWS CLI.


How to Install AWS CLI on Linux

Here are the steps to install AWS CLI on different Linux systems.

Install AWS CLI on Ubuntu/ Debian Linux

$ sudo apt install awscli

Install AWS CLI on Fedora and CentOS 8

$ sudo dnf install awscli

Install AWS CLI on CentOS 7 and Red hat Linux

$ sudo yum install awscli

Next, we will look at how to configure AWS CLI.

Bonus Read : Top AWS Cost Optimization Best Practices


How to Configure AWS CLI

Here are the steps to access and configure AWS CLI for use.

1. Go to AWS Security Credentials

2. Expand Access keys (access key ID and secret access key)

3. Click Create New Access Key

4. Copy the access key ID and secret access key to a secure location.

5. Open terminal and run the following command

  $ aws configure

6. You will see the following prompt. Enter AWS Access Key ID and Secret Access Key. Also specify region name of your EC2 instances, and output format (text/json) of your commands.

  AWS Access Key ID [None]: ABCDEFXXXXXXXXDKKDFJ 
  AWS Secret Access Key [None]:       5jksdf9sdfjsdSKSDKSJDFskjf8KDfkfjkFKD 
  Default region name [None]: us-east-1 
  Default output format [None]:

That’s it! You have installed and configured AWS CLI on Linux.

Bonus Read : How to Enable GZIP Compression in NGINX


AWS CLI Commands

Here are some handy AWS CLI commands for your reference.

Here’s the command to get a list of all available commands with their use, in AWS CLI. You can also use this command to check if AWS is installed.

$aws help

List all EC2 instances in AWS

$ aws ec2 describe-instances

List EC2 instances from specific zone

$ aws ec2 describe-instances --region=us-east-1

Get status of specific EC2 instance (replace your_instance_id below with your instance ID)

$ aws ec2 describe-instances --instance-id your_instance_id

List S3 buckets

$ aws s3 list

Hopefully, this article will help you install, configure, and access AWS CLI to manage your Amazon Web Services account.

Ubiq makes it easy to visualize data and monitor in real-time dashboards. Try it for free.