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)