DEV Community

Ahmet Akan
Ahmet Akan

Posted on

Setting Up AWS Command Line Interface (CLI)

Summary

The AWS Command Line Interface (CLI) is a unified tool to manage AWS services. This tutorial will guide you through the installation and configuration of this tool on Linux.

Installation Steps:

We will start with downloading the the zip file from AWS.

$ curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
Enter fullscreen mode Exit fullscreen mode

Next, we will unzip the file and run the installation.

$ unzip awscliv2.zip
Enter fullscreen mode Exit fullscreen mode
$ sudo ./aws/install
Enter fullscreen mode Exit fullscreen mode

To make sure the installation is successful, we will print out the version of the AWS CLI on the screen.

$ aws --version
aws-cli/2.2.29 Python/3.8.8 Linux/5.4.119-14943-gff839c7fedcc exe/x86_64.debian.10 prompt/off
Enter fullscreen mode Exit fullscreen mode

In the next few steps, we will log on to the AWS Management Console and set up a new AWS Identity and Access Management (IAM) user. This IAM user later will be used to configure the AWS CLI.

Choose IAM from the list of services and click on "Add User."
Alt Text

Choose your user name and check "Programmatic Access" and "AWS Management Console Access"

Alt Text

Attach "Administrator Access" permissions to the IAM user created.

Alt Text

Save your "Access Key ID" and "Secret Access Key" on your favorite password vault. These credentials are displayed only once, therefore it is essential to save them now.

image

$ aws configure
Enter fullscreen mode Exit fullscreen mode

Go back to the terminal and configure the AWS CLI. We will use the us-east-1 as the default region for this guide.

  • Access Key ID: "From the Previous Step"
  • Secret Access Key: "From the Previous Step"
  • Default Region Name: us-east-1
  • Default Output: "Leave Blank"

Execute a command using the AWS CLI. For this example, we are listing all the IAM users.

$ aws iam list-users
{
    "Users": [
        {
            "Path": "/",
            "UserName": "ahmet.akan",
            "UserId": "AIDASNOJDUC6SGCXK3MPJ",
            "Arn": "arn:aws:iam::********:user/ahmet.akan",
            "CreateDate": "2021-08-31T00:05:26+00:00"
        }
    ]
}
Enter fullscreen mode Exit fullscreen mode

Top comments (0)