🪜 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!
