Configuring the AWS Command Line Interface (CLI)
AWS Command Line Interface (AWS CLI) is a unified tool to manage your AWS services. With just one tool to download and configure, you can control multiple AWS services from the command line and automate them through scripts.
The AWS CLI provides direct access to the public APIs of AWS services. You can explore a service’s capabilities with the AWS CLI, and develop shell scripts to manage your resources. In addition to the low-level, API-equivalent commands, several AWS services provide customizations for the AWS CLI.
Overview:
By the end of this tutorial, you’ll have a fully operational AWS CLI, allowing you to manage AWS resources efficiently, automate tasks, and integrate AWS services into your workflows with ease. The AWS CLI is an invaluable tool for developers, system administrators, and AWS users looking to harness the power of AWS from their command line interface.
Objectives:
- Configure your Access Key ID, Secret Access Key, Default Region, and Output Format.
- Confirm that your AWS CLI configuration is correct by running a simple command to check your IAM user’s identity.
- Explore basic AWS CLI commands and discover how to interact with various AWS services directly from your terminal.
Prerequisite:
- An AWS account: You’ll need an AWS account to access AWS services. If you don’t have one, you can sign up for AWS.
- AWS Access Key ID and Secret Access Key: To configure the AWS CLI, you’ll need your Access Key ID and Secret Access Key. You can generate these in the AWS Management Console under IAM (Identity and Access Management).
- AWS CLI: Ensure that you have the AWS CLI installed on your local machine. You can download and install it from the official AWS CLI page.

Configuration Steps
Follow these steps to configure the AWS CLI:
Step 1: Open a Terminal
Open a terminal or command prompt on your local machine. You’ll use this terminal to enter AWS CLI commands.
Step 2: Run aws configure
To configure the AWS CLI, use the aws configure
command. This command will prompt you to enter your AWS Access Key ID, Secret Access Key, default region, and output format.
aws configure

You will be prompted to enter the following information:
- AWS Access Key ID: Enter your Access Key ID.
- AWS Secret Access Key: Enter your Secret Access Key.
- Default region name: This is the AWS region where you want to execute your commands. For example,
us-east-1
. - Default output format: You can choose
json
,text
,table
, oryaml
. JSON is the most common choice.
After entering this information, it will be stored in a configuration file located in your home directory (~/.aws/credentials
and ~/.aws/config
).
Step 3: Verify the Configuration
To verify that your AWS CLI is correctly configured, you can use the aws sts get-caller-identity
command, which will return information about the IAM user associated with your access key.
aws sts get-caller-identity
You should see output similar to the following:
{
"UserId": "ABCDEFGHIJKLMNOPQRSTU:your-username",
"Account": "123456789012",
"Arn": "arn:aws:iam::123456789012:user/your-username"
}
If you see this output, your configuration is correct, and the AWS CLI is ready to use.
Step 4: Using the AWS CLI
You can now start using the AWS CLI to interact with AWS services. For example, to list your Amazon S3 buckets, use the following command:
aws s3 ls

Remember to check the AWS documentation for specific CLI commands and their usage for various AWS services.
Success!!!!
Conclusion!
In this tutorial, you learned how to configure the AWS Command Line Interface on your local machine. With the AWS CLI, you can interact with AWS services from the command line, making it a powerful tool for managing your AWS resources. Be sure to keep your AWS Access Key ID and Secret Access Key secure and do not share them with others. Hopefully this tutorial was fun and informative. Thank you for following along, happy coding!