top of page
Writer's pictureParag

Configure AWS CLI to interact with AWS services

Updated: Apr 22

Objective:-

1. Install and configure AWS CLI.

2. Test AWS CLI commands.


Step 1: Download the AWS CLI from the link below:

After download, install the downloaded file.


Step 2: Go to IAM service dashboard. In the left side panel, click on Users under Access management.

Click on Create User.

Step 3: In Set User Details, Give the name as New-S3-User.

1. Check the Provide user access to the AWS Management Console .

2. Check the I want to create an IAM user.

3. Uncheck Users must create a new password at next sign-in.

4. Click on Next in bottom right corner.


Step 4:- After clicking next you will be directed to a “Set Permissions” page.

1. Click on “Attach policies directly”.

2. Scroll down in Permission policies and in the search bar, search for S3fullaccess.

3. Under policy name check the AmazonS3FullAccess.

4. Click on Next in bottom right corner.

Step 5:- Download the .csv file.

Go back to Users and you can see a new user is created.

Step 6:- Click on New-S3-User.

1. Scroll down and click on Security Credentials.

2. Go to Access Keys and Click on “Create Access Keys”.

3. Check “Command Line Interface(CLI)” in use case.

4. Check the “Confirmation” and click on “Next”.

Click on “Create Access key”.

Click on “Download .csv file”.

Step 7:- After successfully creating your IAM user, sign out and log back in as “New-S3-User” which is created.


Note:-You have to use “New-S3-User credentials.csv” file for log back in.

Now you can see you have logged in as “New-S3-User”.

Step 8:- Open Command Prompt.

Type in the command: aws configure

Copy the Access key ID from .csv file and paste it here for AWS Access Key ID.

Similarly copy the Secret access key and paste it here for AWS Secret Access Key.

Give the Default region name that we stored in Step 8, ap-south-1 in this case.

Give Default output format as json.

Step 9: This step is to test whether the User can access S3 services through AWS CLI commands.

To create a bucket enter following command:

aws s3 mb s3://mybucket753159

Here mybucket753159 is a random name chosen for your bucket.

You may have to try this command again if your required bucket name is already being used by some other AWS user.

If you observe make_bucket: (name of your bucket) as output, your bucket has been successfully created for this particular s3 user using the access and policies you chose for the user.

Step 10: Go to S3 services from AWS console and click on Buckets to check that the bucket has been created.

Note: Delete the S3 bucket and the IAM user if you no longer need to use them.



Was this document helpful? How can we make this document better. Please provide your insights. You can download PDF version for reference.



For your aws certification needs or for aws learning contact us.



29 Comments


useful blog


Like

This is good. It has help me to learn AWS CLI.

Edited
Like

Very useful !

Like

useful blog

Like

Gokulnath
Gokulnath
Feb 05

Useful

Like
bottom of page