AWS CLI — Configure and connect

Hemant
2 min readSep 24, 2023

--

in this article we will setup AWS CLI and will list all IAM users using aws cli

AWS CLI

About AWS CLI

  • AWS CLI is a command line tool using which we can connect to AWS services.
  • It has direct access to public APIs of AWS Services
  • It is alternative of aws management console.
  • It is opensource — https://github.com/aws/aws-cli
  • AWS CLI needs Access Keys to connect with AWS resources
  • Access Keys can be generated through management console — steps are mentioned in this article

Install AWS CLI

  1. Go to AWS CLI install page -

2. Select your operating system and follow instructions.

In my case I installed aws cli in macOS.

Use AWS CLI

  1. configure aws cli by using below command

aws configure

It will prompt for Access Key ID and Secret Access Key, provide those details and enter region name.

  • if you don’t have access key id and secret key then follow steps mentioned in this article

Now CLI is configured to use.

2. Run your first command to list all iam users.

aws iam list-users

3. Explore other commands that can be used with mentioned in this reference list — https://docs.aws.amazon.com/cli/latest/reference/

4. Access Keys setup in AWS CLI can be seen using command

cat ~/.aws/credentials

In this article we learnt how to connect to AWS via CLI.

Happy Learning.

--

--

Hemant

Lead Software Engineer @JPMorgan & Chase. Writes about Java, AWS and System Design