How to configure AWS CLI

This post explains how to configure AWS CLI to interact with AWS services using commands in command line shell. To configure AWS CLI AWS Access Key ID and AWS Secret Access Key is required, in this tutorial we will first create AWS IAM User along with AWS Access Key ID and AWS Secret Access Key.

1. Sign in to the AWS Management Console and open the IAM console at https://console.aws.amazon.com/iam/ .
2. In the navigation pane, choose Users.
3. Click on Add Users.
4. Enter username aws-cli-user and select Access key - Programmatic access.

5. Click on Next: Permissions
6. Click on Select Attach existing policies directly and add required permissions.

7. Click on Next: Tags, if you need to provide tags enter required tags or click on Next:Review.
8. Click on Create user.
9. Download the csv
11. Click on close
12. Open the command line shell
13. Enter aws configure in command line shell and provide below information from downloaded csv.
        

aws configure 
           
AWS Access Key ID [None]: Enter access key from downloaded csv
AWS Secret Access Key [None]: Enter secret access from downloaded csv
Default region name [None]: Enter the required region (e.g "us-east-1", "us-west-1")
Default output format [None]: json


14. Verify the configuration, run the below command and you should see list of S3 buckets from your account.
        

aws s3 ls



Category: AWS