Skip to content

AWS Command Line Interface (CLI)

Syed Sayem edited this page Mar 29, 2019 · 1 revision

The AWS Command Line Interface (AWS CLI) is an Amazon Web Services tool that allow developers to control AWS from a terminal.

 

Table of contents

 

Install on macOS

Below are the steps to install awscli using homebrew on your Mac:

$ brew install awscli

Check if it is working

$ aws

top  

Configuring the AWS CLI

For general use, the aws configure command is the fastest way to set up your AWS CLI installation.

$ cd ~
$ aws configure
AWS Access Key ID [None]: AKIAIOSFODNN7EXAMPLE
AWS Secret Access Key [None]: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
Default region name [None]: us-east-1
Default output format [None]: json

AWS Credentials

To see your credentials, copy & paste the following command into your terminal:

$ cat .aws/credentials
[default]
aws_access_key_id = AKIAIOSFODNN7EXAMPLE
aws_secret_access_key = wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY

AWS Config

To see your AWS config, copy & paste the following command into your terminal:

$ cat .aws/config
[default]
region = us-east-1
output = json

Test AWS CLI Credentials

To test ability to connect to AWS with newly created Access Key ID and Secret Access Key you need to use the following command:

$ aws sts get-caller-identity

You will get the output in the following format if everything is OK:

{
    "Account": "123456789012", 
    "UserId": "AR#####:#####", 
    "Arn": "arn:aws:sts::123456789012:assumed-role/role-name/role-session-name"
}

top