This content originally appeared on DEV Community and was authored by Yash Sonawane
βImagine controlling all of AWS with just your keyboard.β
No endless clicking, no hunting through console tabs β just raw power, in your terminal.
Welcome to the AWS CLI (Command Line Interface) β your cloud command center. In this guide, weβll unlock its full potential with real-world examples, beginner-friendly tips, and the exact commands to get you automating like a DevOps pro.
What Is the AWS CLI?
The AWS Command Line Interface lets you interact with AWS services using simple commands from your terminal.
Itβs like talking directly to AWS without using the browser.
Real-world analogy: Think of the AWS Console as the iPhone app β nice UI. But AWS CLI is like using Siri for superpowers. Fast, precise, and fully scriptable.
Step 1: Install and Configure AWS CLI
Install AWS CLI (v2 recommended)
- On Mac:
brew install awscli
- On Ubuntu:
sudo apt install awscli -y
- On Windows: Use the installer
Configure It
Youβll need your AWS access keys:
aws configure
Youβll be prompted to enter:
- AWS Access Key ID
- AWS Secret Access Key
- Default region (e.g.,
us-east-1
) - Output format (choose
json
ortable
for readability)
Done? Youβre ready to fly.
Real-World AWS CLI Commands Youβll Use Daily
Check Your Identity
aws sts get-caller-identity
Great for validating your current credentials.
S3: Upload & Download Files
aws s3 cp mysite/index.html s3://my-bucket-name/
aws s3 sync ./website s3://my-bucket-name/
![]()
sync
is your best friend for automated static site updates.
EC2: Start, Stop, and Manage Instances
aws ec2 describe-instances
aws ec2 start-instances --instance-ids i-1234567890abcdef0
aws ec2 stop-instances --instance-ids i-1234567890abcdef0
RDS: Check Database Status
aws rds describe-db-instances
Deploy a Lambda Function
aws lambda create-function \
--function-name my-function \
--runtime nodejs18.x \
--handler index.handler \
--role arn:aws:iam::123456789012:role/my-lambda-role \
--zip-file fileb://function.zip
Pro Tip: Combine these with shell scripts or GitHub Actions to automate CI/CD pipelines!
Automate Like a Pro: Shell Scripts + AWS CLI
Hereβs an example script to stop all EC2 instances in a specific region:
#!/bin/bash
for id in $(aws ec2 describe-instances \
--query "Reservations[*].Instances[*].InstanceId" \
--output text); do
echo "Stopping instance $id..."
aws ec2 stop-instances --instance-ids $id
done
This is how you go from manual admin to DevOps automation master.
Why Learn AWS CLI?
Benefit | Why It Matters |
---|---|
![]() |
One command > 10 clicks |
![]() |
Script repeatable tasks |
![]() |
Perfect for DevOps pipelines |
![]() |
Combine with Bash, Python, or cron jobs |
![]() |
Under the hood of all AWS SDKs |
Security Tips
- Never hard-code credentials in scripts
- Use IAM roles with
aws sts assume-role
- Rotate access keys regularly
- Use AWS profiles for multi-account setups:
aws configure --profile dev
Try These Challenges
Upload your portfolio to S3 using the CLI
Write a script to back up logs to S3 every day
Start and stop EC2 based on time of day (cron + CLI)
Describe all Lambda functions in your region
Want the step-by-step for any of these? Just ask in the comments!
Join the CLI Movement!
The AWS CLI isnβt just a tool β itβs a superpower. Once you master it, you’ll never want to go back to the web console again.
Whatβs your favorite AWS CLI trick? Got a script that changed your workflow?
Drop it in the comments, smash if you learned something new, and share this with your terminal-loving friends!
Letβs automate the cloud β one command at a time.
This content originally appeared on DEV Community and was authored by Yash Sonawane