Hills 🏔 and Skills, What's Common?

They both need you to be on top.

Cohort-1 just ended. You will get:

All yours, just at:

$99

How to use AWS CLI in Windows - Beginners guide

Updated on
AWS CLI windows setup thumb

Working with Command Line can be painful specially if you are on Windows.

It doesn’t have to be anymore.

You will learn:

Let’s start with installing the CLI

The easy way using chocolatey:

Install chocolatey if you don’t have it already:

Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))

Finally install AWS CLI using choco

choco install awscli
aws cli installed with choco

Install manually using the MSI installer

Click to show installation instructions

Simply download the msi from awscli.amazonaws.com/AWSCLIV2.msi

Open the installer.

AWS CLI setup screen

Click on Next, accept the license agreement, then click Next again.

Now all you need to do is click on Install.

AWS CLI Ready to Install

In few minutes your AWS CLI will be installed in your Windows operating system.

AWS CLI Installation Finished

Let’s create an IAM user for our AWS CLI!

Login to your AWS Console with admin access.

Go to your IAM User console.

Click on the Add Users button on the top-right of the Console.

aws iam add user

Enter a username, e.g. my-cli-user.

Don’t use your existing IAM user, creating a sepaarate IAM user for CLI will help you pinpoint your activity logs in CloudTrail. Another article will be what happens when you accidentally make your Access Key public.

aws create user page

Click Next.

On the next screen, from the three options, select “Attach Policies Directly”. From the “Permissions’ Policies” tab, check the option AdministratorAccess. Scroll down and click Next.

aws iam attach direct policy

To finish things off, on the Review and Create screen, simply click on Create User.

We see that our new user my-cli-user has been created successfully.

aws iam user created

Generating Access Key and Secret for the CLI user

Click on my-cli-user.

Visit the Security credentials tab.

Scroll down and go to the Access Keys section, and click on Create Access Key button.

aws iam create access key

Select the Command Line Interface (CLI) option.

Scroll down and check the box for I understand the above recommendation and want to proceed to create an access key and hit Next.

Setting description tag is optional. Go ahead and click on Create Access Key.

aws iam access key cli option

Your access key has been created. You can simply download the .CSV file if you want to reuse it.

It won’t be shown again.

aws iam retrieve access key

Configuring AWS CLI

To configure AWS CLI in our computer, run the following command.

aws configure --profile cli-user

INFO: You can omit the --profile cli-user part if you don’t plan on using multiple users.

It will ask for the following:

This is how it should look:

AWS Access Key ID [None]: AKIAS75KUR6WAVS3L3NE
AWS Secret Access Key [None]: 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
Default region name [None]: us-east-1
Default output format [None]: json

Now you are all set.

aws cli hard hard work meme

Testing your AWS CLI

Run the following command to know your IAM identity:

aws sts get-caller-identity --profile cli-user

You will see your user Id and ARN:

{
  "UserId": "AIDAS75KUR6WHT3V6PS25",
  "Account": "205979422636",
  "Arn": "arn:aws:iam::205979422636:user/my-cli-user"
}

This means you have set up everything properly and you can use AWS CLI to its full potential.

From here you can take your productivity to the next level.

Here are the list of things you can do with AWS CLI:

The possibilities are endless, you just have to think about it.

I hope you enjoyed reading this article and I solved your problem. If not, feel free to reach out to us, we’ll be happy to help.