How to Install AWS CLI?

Description of the image

In general, a Command Line Interface (CLI) is a tool that enables you to contact your operating system. You might have become familiar with this when you use Windows Terminal. A CLI can be an easy way to issue commands to your system. 

Amazon Web Services (AWS) has its own CLI that serves a similar purpose. The AWS CLI is an open-source tool that you can use to interact with a wide range of AWS services. By issuing commands in the command-line shell, you can access all your AWS solutions in a few clicks.


Amazon Web Services has a CLI tool that developers can use to access as well as manage their various cloud services and solutions. 

You might wonder what is the need for a CLI tool when you can access the services directly on the AWS Console. This is a valid question, but why people prefer AWS CLI is that it is very simplified. Instead of taking multiple steps to access a particular AWS cloud solution, all it takes is a single line command in the tool. 

Not just simple commands, the AWS CLI can also handle full-length scripts that automate cloud infrastructure. Overall, the CLI is a very useful tool for developers to not just manage but also automate many cloud solutions in AWS.

Installing and Configuring of AWS CLI 

AWS CLI is very easy to install and configure on your computer. All you have to do is download the installer on your PC. To install CLI on your device, you need Python 2, version 2.6.5+, or Python 3, version 3.3+. You need Windows, Linux, macOS, or Unix OS to use AWS CLI. This section covers how to install CLI in Windows and Linux. 

How to Install AWS CLI for Windows?

Before you download AWS CLI, check the version that you need. AWS has version 1 and version 2 and different releases of each version. Based on the version, the prerequisites differ. This section addresses the latest version of AWS CLI. Here are the steps to download, install, and configure the tool on your Windows Operating System.

Step 1: Download the AWS CLI tool from the AWS website. Now, run the MSI installer to get started. 

Step 2: To confirm that the CLI tool has been installed, you can use Windows CMD - open a command prompt window and type “aws --version” there. When the version is displayed, you can ensure the tool has been installed.

AWS CLI for Windows

Now that the installation is done, let us move to the configuration part.

Step 3: To configure the interface, you need the AWS Console access key. You can download this by visiting your AWS Console.

Step 4: Visit your Console and navigate to the Identity and Access Management dashboard. Select the User in IAM.

Step 5: Now, click on the Security Credentials tab and click Create Access Key. You can note down the key and download a version of the .csv file as well.

Step 6: Now, launch the AWS CLI tool. Run the command “aws configure”.

Step 7: To configure, you have to enter the details prompted accordingly.

  • AWS Access Key ID
  • AWS Secret Access Key
  • Default Region Name

The interface will also require you to input the Default Output Format. Enter “JSON”.

With this, your AWS CLI will be configured. To check whether you have done the steps right, you can use the CLI tool to run a sample command like “aws ec2 describe-vpcs”.

How to Install AWS CLI for Linux?

To install and configure AWS CLI in Linux, you must have a zip utility installed, as you need to unzip the downloaded file. Here are the steps given below.

Step 1: First, download the AWS CLI files using curl. 

curl "" -o "”

Step 2: Once the files are downloaded, you need to unzip them. For this, you can use the command: unzip

Step 3: To install the CLI tool, use the following command: sudo ./aws/install. Once done, the AWS CLI executable is added to the use/local/aws-cli location.

Now, let's look at the steps you have to follow to configure AWS CLI on your Linux system.

Step 4: Open the AWS CLI tool and run the command “aws configure”.

Step 5: When prompted, provide the AWS Access Key ID, Secret Access Key, Default Region Name, and Default Output Format. To download the key, you can follow the same steps given in the previous section.

Step 6: Once the tool is configured, you can find a folder in the name “.aws” in the user's home directory. You can run commands and check how the CLI tool works.

How to Install AWS CLI for macOS?

Step 1: Download the AWS CLI Installer

curl "" -o "AWSCLIV2.pkg"

Step 2: Run the Installer

sudo installer -pkg AWSCLIV2.pkg -target /

Step 3: Verify the Installation

aws --version

Step 4: Configure AWS CLI

aws configure

Common Troubleshooting Tips

Installation Issues

Permission Denied:

  • Solution: Use sudo before the command.
  • Example: sudo installer -pkg AWSCLIV2.pkg -t

Command Not Found:

  • Solution: Ensure the CLI is in your PATH.
  • Add to PATH: export PATH=$PATH:/usr/local/bin/aws

Configuration Issues

Invalid Credentials:

  • Solution: Double-check your Access Key and Secret Key.
  • Run aws configure again to re-enter the correct details.

Region Errors:

  • Solution: Ensure the region is correctly set in the configuration.
  • Verify using: aws configure list

Benefits of Using AWS CLI

Many developers prefer AWS CLI to the AWS Console because the tool offers simple and easy access to almost all of AWS cloud solutions. Here are some of the major benefits of using AWS CLI for managing your AWS services.

  • Easy and Unified Access - Users can easily access multiple AWS services from the same interface using simple commands. 
  • Flexible Usage - Be it the operating system or the output method, AWS CLI offers you a handful of options, making it a flexible tool. 
  • Efficient and Quick - Since direct commands are all it takes to access AWS services, the CLI becomes an effective tool that delivers rapid deployment.
  • Potential for Automation - Batch operations and automating routine tasks are made easy with AWS CLI, as the tool can easily handle scripts.

Useful AWS CLI Commands

aws s3 ls
List S3 buckets
aws s3 cp <source> <destination>
Copy files to/from S3
aws s3 sync <source> <destination>
Sync directories to/from S3
aws ec2 describe-instances
List EC2 instances
aws ec2 start-instances --instance-ids <id>
Start an EC2 instance
aws ec2 stop-instances --instance-ids <id>
Stop an EC2 instance
aws iam list-users
List IAM users
aws iam create-user --user-name <name>
Create an IAM user
aws lambda list-functions
List Lambda functions
aws lambda invoke --function-name <name> output.json
Invoke a Lambda function
aws cloudformation deploy --template-file <file> --stack-name <name>
Deploy a CloudFormation stack
aws cloudwatch list-metrics
List CloudWatch metrics
aws rds describe-db-instances
List RDS instances
aws dynamodb list-tables
List DynamoDB tables
aws ecr create-repository --repository-name <name>
Create an ECR repository


A Command Line Interface is a tool using which you can deliver direct commands to your operating system for tasks to be done quickly and efficiently. AWS offers a handy Command Line Interface (CLI) tool that helps you access and manage the solutions and services in your AWS account. The AWS CLI can be used on Windows, macOS, Linux, and Ubuntu operating systems. Downloading the AWS CLI on your PC is easy, as all you have to do is download the package and install it using a simple command. By configuring the tool on your PC or your server, you can easily access your cloud solutions and even run scripts with it.

Read More

Follow us on

Table of Contents

    Subscribe to Us

    Always Get Notified