Part 8 of 12 — 12 Hands-On AWS Projects
Introduction
So far, we have done everything by clicking in the AWS Management Console. That is great for learning, but real engineers also work from the terminal. Today we will connect the AWS Command Line Interface — the AWS CLI — to your AWS account. Once it is set up, you can list buckets, launch instances and check your account with one-line commands, and everything you do in the terminal shows up in the console too.
If you can use both the console and the CLI, you can work the way professional cloud engineers work.
What you will build
- The AWS CLI installed and working on your laptop
- An IAM user with an access key for command-line access
- A configured CLI profile with your region and output format
- Verified access — the same account visible in both the terminal and the console
- Safe habits for handling access keys from the very first day
Architecture
Your laptop runs the AWS CLI. It signs every command with an access key from an IAM user in your AWS account. The request travels to AWS over the internet, and the service — EC2, S3, IAM — answers back. Open the Management Console in your browser and you will see the same account, the same user and the same resources the CLI sees.
Prerequisites
- An AWS account (free tier is fine)
- A laptop with a terminal — Command Prompt, PowerShell or any Linux/macOS terminal
- Access to the AWS Management Console in your browser
- Ten minutes, and a safe place to store a secret key
Steps
1. Install and configure the AWS CLI
Download the AWS CLI installer for your operating system from the official AWS website and run it. Then check the installation in your terminal:
aws --version You should see a version number printed back. If the command is not found, close the terminal, open a fresh one, and try again — the installer updates your system path.
2. Create and configure access keys in IAM
Sign in to the Management Console and open IAM, then Users. Create a new user for command-line access — call it cli-user. Attach the ReadOnlyAccess policy for learning: it lets you look at everything without the risk of changing or deleting anything. Then go to the user's Security credentials tab and create an access key. AWS will show you two values: an Access Key ID and a Secret Access Key. Copy both into a safe place right now — the secret is shown only once.
3. Run aws configure
Back in your terminal, run:
aws configure The CLI will ask you four questions. Answer them like this:
AWS Access Key ID: paste your Access Key ID
AWS Secret Access Key: paste your Secret Access Key
Default region name: ap-south-1
Default output format: json
Choose the region closest to you — ap-south-1 is Mumbai. The CLI stores these answers in a small configuration file on your laptop, so you only do this once.
4. Verify access from the CLI — and in the console
Now prove the connection works. This command asks AWS who you are:
aws sts get-caller-identity You should see your user name, account ID and the access key ID printed back. Then try listing your S3 buckets:
aws s3 ls Finally, open the Management Console in your browser and go to the IAM users page. You will see the same cli-user there, with the same access key you just created. The terminal and the console are looking at the same account — that is the connection working.
What you learned
- The AWS CLI lets you manage your account from the terminal with short commands
- IAM users and access keys are how the CLI proves who you are — there is no password involved
- aws configure stores your key, region and output format so every command just works
- aws sts get-caller-identity is the fastest way to check that your setup is correct
- The console and the CLI show the same account, because both talk to the same AWS services
Cleanup
If this was only a practice setup, delete the access key when you finish — in IAM, open the user, go to Security credentials and delete the key you created. If you plan to keep using the CLI, keep the key but store it safely. Never paste access keys into chat messages, screenshots, GitHub or any shared document. A leaked key is a real security risk, and AWS can charge your account for what others do with it.
Try next
In Project 9, we will connect a database to an application. You will launch an RDS database and connect it to an EC2 instance, so your web page can read and store real data.
About Cloud Messenger — Learn • Build • Visualize • Troubleshoot • Grow | cloudmessenger.in | linkedin.com/in/cloud-messenger | github.com/Cloud-Messenger | #buildwithCloudMessenger
