Configuring AWS CLI on Windows and Linux: A Step-by-Step Guide

Aravind K V
4 min readSep 5, 2023

--

The AWS Command Line Interface (CLI) is a powerful tool enabling users to communicate with AWS services using command-line commands. It allows users to perform various tasks such as creating and managing AWS resources, deploying applications, automating workflows, and much more — all through simple commands.

But before we can use it, we need to set up the AWS CLI on our local machine. In this guide, we will walk through configuring the AWS CLI on both Windows and Linux operating systems.

Before we start, Create an AWS account and install Python on your machine.

To create an AWS account visit — https://aws.amazon.com/console/

To install Python in Windows — https://www.digitalocean.com/community/tutorials/install-python-windows-10

Let’s create an AWS Access Key

Step 1:

To create an AWS access key, go to the AWS console. Click on the profile, then select “Security Credentials.”

AWS Console

Step 2:

In the ‘My Security Credentials’ section, scroll down a bit until you find the Access Key section. Click on “Create Access Key.”

Access Key

Step 3:

In the use case, select “Command Line Interface (CLI),” click on the confirmation checkbox, and then click “Next.”

Step 4:

You can set an optional description tag, and then click on “Create Access Key.”

Step 5:

The access key has been created. Download the access and secret keys and store them in a safe place, such as a secure vault. Please note that if you lose or forget the secret access key, you won’t be able to retrieve it.

Access Key Created!!

Yayyyyy!!! You have successfully created an Access and Secret Key.

Let’s configure the AWS CLI on Windows.

Step 1:

Download and run the AWS CLI installer for Windows from the official AWS CLI website using this link: AWS CLI Installer.

Step 2:

Open the terminal (PowerShell or Command Prompt) and run the aws configurecommand in it.

Step 3:

Now, it will ask for the AWS Access Key ID and Secret Access Key. Enter the access key and secret key. Also, specify your preferred region. Here, I used us-east-1 as an example and set the default output format to JSON.

Enter the access and secret key

Step 4:

AWS CLI on Windows is now configured. To verify the configuration, run the command aws configure list.This command will display the AWS CLI configuration settings. If you see your configuration details listed, it means the configuration was successful.

You can verify the configuration using aws s3 ls to list of your buckets. or aws ec2 describer-instancesto list ec2 instances.

Configuration of AWS CLI on Linux

Step 1:

Open the terminal, and run the following command to install AWS CLI.

pip install awscli

Note: If you don’t have pip installed in your system. you can install it using your Linux distro package manager like apt, yum, etc.

Step 2:

After the installation is completed, run the aws configurein the terminal.

Step 3:

Just like we did on Windows, enter your AWS Access Key ID, AWS Secret Access Key, default region, and default output format when prompted.

Step 4:

AWS CLI on Linux is now configured. To verify use any of the following commands.

aws configure list # list AWS CLI configuration

aws s3 list # list s3 buckets

aws ec2 describe-instances # list EC2 Instances

AWS CLI configuration is a straightforward process. We can use AWS CLI to interact with AWS services, automate tasks, and manage the resources. To learn more about AWS CLI visit the AWS CLI documentation https://docs.aws.amazon.com/cli/

Hope you enjoyed the blog.

Happy Learning!!!!!

--

--