How to Access AWS Resources via AWS CLI

Photo by Neda Astani on Unsplash

How to Access AWS Resources via AWS CLI

There are 3 ways of accessing AWS resources:

  • AWS Management Console;

  • AWS CLI;

  • AWS SDK;

What is AWS CLI

AWS CLI (Command Line Interface) is a unified tool provided by Amazon Web Services (AWS) that allows developers, system administrators, and other users to interact with various AWS services from the command line. It provides a consistent and efficient way to interact with AWS services, allowing users to automate tasks, build scripts, and integrate AWS functionality into their workflows and applications. It supports features like authentication and access control, output formatting options, and extensive documentation for each command.

How to Configure the AWS CLI

To configure the AWS CLI, follow these steps:

  1. Install the AWS CLI:

    Follow the instructions provided in the official AWS CLI User Guide for your specific operating system:

  2. Create Access Keys:

    After installation, you will need to create an AWS Access Key ID, Secret Access Key, default region, and output format (optional) to configure your AWS credentials.

    • To create an "AWS Access Key ID", click on "Users" and go to the Users detailed page. Click on the "Security credentials" tab.

    • Click on the "Create access key" button, choose "Command Line Interface (CLI)" use case, and check the box to confirm you understand the recommendation:

  3. Configure the AWS CLI:

    Finally, when the Access Key is generated, copy the credentials and paste them into the AWS CLI.

     aws configure 
     AWS Access Key ID [None]: AKIA6PFCJ6FNMOXM2JQC 
     AWS Secret Access Key [None]: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY 
     Default region name [None]: us-west-2 
     Default output format [None]: json
  4. Verify AWS CLI installation:

    To ensure the AWS CLI is installed correctly, open a terminal or command prompt and run:

     aws --version
     // aws-cli/2.12.6 Python/3.11.4...

    It should display the version of the AWS CLI installed on your system.

  5. Use AWS CLI commands to interact with resources:

    Once the AWS CLI is installed and configured, you can use various AWS CLI commands to interact with AWS resources. Here are a few examples:

     aws iam list-users


  1. AWS CLI Command Reference

  2. AWS CLI User Guide