DEV Community

Balamanikandan S
Balamanikandan S

Posted on

Getting Started with AWS CLI: A Beginner-Friendly Guide

What is AWS CLI?
AWS CLI is a powerful command-line tool that allows you to interact with AWS services using simple text commands instead of clicking buttons in the AWS Console.

You can create and manage S3 buckets, launch EC2 instances, manage IAM users, and more β€” all from your terminal.

πŸ§‘β€πŸ’» Why Use AWS CLI?
⚑ Faster operations compared to UI

πŸ› οΈ Scriptable: Automate tasks with shell scripts

🌍 Manage AWS from any system (Windows, Mac, Linux)

πŸ€– Use it in CI/CD pipelines

πŸ”§ How to Install AWS CLI
βœ… For Windows:
Download the installer from here

Run the installer and follow the steps

After install, open Command Prompt and check:

bash
Copy
Edit
aws --version
βœ… For Mac:
If you have Homebrew installed:

bash
Copy
Edit
brew install awscli
βœ… For Linux:
bash
Copy
Edit
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install
After installation, verify it:

bash
Copy
Edit
aws --version
βš™οΈ AWS CLI Configuration
Once installed, you need to connect it to your AWS account:

bash
Copy
Edit
aws configure
It will ask for:

βœ… Access Key ID

βœ… Secret Access Key

βœ… Default Region (like ap-south-1 for Mumbai)

βœ… Output format (json, text, or table)

You can get the keys from your IAM user in the AWS Console (make sure to keep them secret!).

πŸ”₯ Most Useful AWS CLI Commands
Here are some beginner-friendly AWS CLI commands you can start using right away:

βœ… List all S3 buckets
bash
Copy
Edit
aws s3 ls
βœ… Upload a file to an S3 bucket
bash
Copy
Edit
aws s3 cp myfile.txt s3://your-bucket-name/
βœ… Download file from S3
bash
Copy
Edit
aws s3 cp s3://your-bucket-name/myfile.txt .
βœ… Launch a new EC2 instance (basic example)
bash
Copy
Edit
aws ec2 run-instances \
--image-id ami-0abcdef1234567890 \
--instance-type t2.micro \
--key-name MyKeyPair \
--security-groups MySecurityGroup
βœ… List IAM Users
bash
Copy
Edit
aws iam list-users
βœ… Describe EC2 instances
bash
Copy
Edit
aws ec2 describe-instances
πŸ“¦ Pro Tip: Store Profiles for Multiple Accounts
You can create multiple profiles like this:

bash
Copy
Edit
aws configure --profile my-second-account
And use it like this:

bash
Copy
Edit
aws s3 ls --profile my-second-account
🧠 Final Thoughts
AWS CLI is a must-learn tool for every cloud developer, engineer, and student who wants to level up their cloud skills. It might seem like a lot at first, but once you get used to it, you'll never go back to clicking around in the UI for everything.

Top comments (0)