AI Reading
Quick summary of this article
The article provides a step-by-step guide on configuring the AWS Command Line Interface (CLI) with access keys and a default region. This setup is necessary before you can use the CLI to push Docker images to Amazon ECR or manage other AWS resources from your terminal. The process involves running the aws configure command and entering four specific pieces of information obtained from your AWS Management Console.
- You need an AWS Access Key ID and a Secret Access Key. Create these in the IAM service under your user's "Security credentials" tab. Copy the secret key immediately, as it will not be shown again.
- The Default Region Name sets the AWS data center for your commands. For example, use
ap-south-1for Mumbai, India, orus-east-1for North Virginia, USA. - For the Default Output Format, it is recommended to type
jsonfor machine-readable results. - After configuration, your credentials are saved securely in the
~/.aws/credentialsfile on your system.
🪜 Step 8: Configure AWS CLI (Get and Set Up Your Access Keys)
Before pushing your Docker image to AWS (like Amazon ECR), you must configure the AWS CLI on your Ubuntu or WSL terminal.
When you run:
aws configure
You’ll be prompted to enter four details — here’s what each one means and how to get them 👇
🧩 1️⃣ AWS Access Key ID
- This is your public key that identifies your AWS account.
- You can find or create it from your AWS Management Console:
Steps:
- Log in to your AWS Console.
- Go to the IAM (Identity and Access Management) service.
- Click Users → select your username.
- Under the Security credentials tab, find the section named Access keys.
- Click Create access key.
- You’ll get:
- Access key ID (looks like
AKIAxxxxxxxxxxxxxx) - Secret access key (keep it private!)
- Access key ID (looks like
⚠️ Important: Copy and store both keys securely (e.g., in a password manager). You won’t be able to see the secret key again later.
🧩 2️⃣ AWS Secret Access Key
- This is your private key used to authenticate commands.
- You’ll get it only once when you create the key in IAM.
- Never share it publicly or commit it to GitHub!
When prompted in your terminal, paste it carefully.
🧭 3️⃣ Default Region Name
This tells AWS which data center region you’ll use by default.
For example:
ap-south-1→ Mumbai (India)us-east-1→ North Virginia (USA)eu-west-1→ Ireland
✅ If you’re in India, type:
ap-south-1
📦 4️⃣ Default Output Format
This defines how AWS CLI shows results in your terminal.
You can choose:
json→ machine-readable format (recommended)text→ plain texttable→ table-style output
✅ Type:
json
✅ Example
Here’s what a complete setup looks like:
$ aws configure
AWS Access Key ID [None]: AKIAEXAMPLE12345
AWS Secret Access Key [None]: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
Default region name [None]: ap-south-1
Default output format [None]: json
After this, your credentials are saved in:
~/.aws/credentials
🎯 That’s It!
Your AWS CLI is now configured and ready to:
- Push Docker images to Amazon ECR
- Deploy apps to EC2
- Manage AWS resources directly from your terminal!
