DEV Community

Cover image for Install and Configure AWS CLI on Windows
Binat
Binat

Posted on

Install and Configure AWS CLI on Windows

Welcome to this guide on how to install and configure the AWS command line interface. The command line interface is a powerful tool for programmatically managing and configuring AWS services and automating processes for those resources using scripts.

Download and run the installer

Download the installer here

Image description|400

Follow the Installation Wizard to complete the installation.

Verify Installation

Open up a command prompt and run aws --version

You should see the version number in response.

Image description | 400

Configure Access

Firstly, we need to create a user with permissions for the AWS resources we want to access programmatically. In AWS permissions are explicitly set for users with the IAM (Identity Access Management) console.

-> Log into AWS console. Find the IAM dashboard by typing IAM into the search bar.

Image description

-> On the left hand panel, click users, and then click create user.

Image description

-> Give the user a name, and click next. Do not tick the console access button, we only want this user to have programmatic access.

Image description

-> For permissions, attach an existing policy, search for and add AmazonS3FullAccess.

Image description

-> Review and create user.

Image description

Create Access Key

-> From the users dashboard select the user we just created. Then click on create access key.

Image description

-> Select other and click next.

Image description

-> Tags are optional so leave as is and click create access key.

Image description

-> You should be on the retrieve access key page. Stay on this page for the next step. Please note the security warnings regarding access keys.

Image description

CLI configuration

Inside your command prompt run aws configure

As the command requests, copy and paste in your access key and secret access key. Type in your region, which is available in the top right corner of the AWS console.

It should look something like this

Image description

Click done on the retrieve access key page.

Test configuration

To ensure your permissions are working correctly, create an s3 bucket from the CLI with the following command. AWS S3 bucket names must be unique.

aws s3 mb s3://nat-blog-test-1

Image description

List the contents of the bucket, it is empty so nothing is listed.

aws s3 ls s3://nat-blog-test-1

Image description

Create a file to upload to the s3 bucket.

echo hello aws > testfile.txt

Use the cp (copy) command to upload it to the bucket.

aws s3 cp <path to file> s3://bucket-name

Image description

You can either list the contents of the bucket again or go to S3 on the AWS console and confirm the bucket has been created and the file has been uploaded. If the file is there, then the configuration has been successful.

Image description

Thanks for reading :)

Top comments (0)