In this article we will see how to configure AWS CLI, by that I mean we configure basic settings/credentials that the AWS CLI will use to interact with AWS.
The easiest and fastest way to configure AWS CLI is to use the following command
aws configure
Once you run this command you will be prompted to enter the following 4 items
- Access Key ID
- Secret Access Key
- AWS Region
- Output format
It will look like the following
AWS CLI will store this information in a profile (a profile is collection of settings) named default
in the credentials
file. By default, AWS CLI will use the information in this profile when you run an AWS CLI command that doesn't explicitly specify which profile to use.
Note - You can rerun aws configure
to overwrite the existing values
Access Key ID and Secret Access key
Access keys consist of an Access Key ID
and Secret Access Key
, they are just like your username and password, which are used to sign programmatic requests that you make to AWS. If you don't already have access keys, you can easily create them from the AWS Management Console. You can go through the article
How to create AWS Access Keys to understand how to create access keys.
Region
We must specify an AWS Region when using the AWS CLI, either explicitly or by setting a default Region.
The Default region name
is the AWS Region whose servers you want to send your requests to by default. For example, you can type us-west-2 to use US West (Oregon). This is the Region that all later requests are sent to, unless you specify otherwise in an individual command.
Output format
The Default output format
specifies how the results are formatted. If not specified, json
is used as the default. Apart from json
format yaml
, yaml-stream
, text
, table
formats are also supported.
Verify
Just to confirm it all worked, let's list all the ec2 instances using the following command
aws ec2 describe-instances