Whether you're managing S3 buckets, spinning up EC2 instances, or deploying Lambda functions, the AWS CLI is your best friend for automation and control. Here's a complete cheat sheet to help you navigate AWS from the command line like a pro.
🔧 Basics
aws configure
aws configure list
aws sts get-caller-identity
☁️ S3 (Simple Storage Service)
aws s3 ls
aws s3 ls s3://my-bucket-name/
aws s3 cp localfile.txt s3://my-bucket-name/
aws s3 cp s3://my-bucket-name/file.txt .
aws s3 sync ./local-folder s3://my-bucket-name/
aws s3api put-bucket-acl --bucket my-bucket-name --acl public-read
🖥️ EC2 (Elastic Compute Cloud)
aws ec2 describe-instances
aws ec2 start-instances --instance-ids i-xxxxxxxxxxxxx
aws ec2 stop-instances --instance-ids i-xxxxxxxxxxxxx
aws ec2 terminate-instances --instance-ids i-xxxxxxxxxxxxx
aws ec2 create-key-pair --key-name MyKeyPair
aws ec2 describe-security-groups
🧮 Lambda
aws lambda list-functions
aws lambda invoke \
--function-name MyFunction \
--payload '{"key": "value"}' \
output.json
aws lambda create-function \
--function-name MyFunction \
--zip-file fileb://function.zip \
--handler lambda_function.lambda_handler \
--runtime python3.9 \
--role arn:aws:iam::123456789012:role/execution_role
🛂 IAM (Identity & Access Management)
aws iam list-users
aws iam create-user --user-name NewUser
aws iam attach-user-policy \
--user-name NewUser \
--policy-arn arn:aws:iam::aws:policy/AmazonS3FullAccess
aws iam list-roles
📄 CloudFormation
aws cloudformation list-stacks
aws cloudformation create-stack \
--stack-name my-stack \
--template-body file://template.yaml
aws cloudformation delete-stack --stack-name my-stack
📊 CloudWatch
aws logs describe-log-groups
aws logs describe-log-streams --log-group-name my-log-group
aws logs get-log-events \
--log-group-name my-log-group \
--log-stream-name my-log-stream
🛠️ ECR (Elastic Container Registry)
aws ecr get-login-password | docker login --username AWS --password-stdin <account>.dkr.ecr.<region>.amazonaws.com
aws ecr create-repository --repository-name my-repo
aws ecr describe-repositories
🐳 ECS (Elastic Container Service)
aws ecs list-clusters
aws ecs list-services --cluster my-cluster
aws ecs describe-task-definition --task-definition my-task
🔒 Secrets Manager
aws secretsmanager list-secrets
aws secretsmanager get-secret-value --secret-id my-secret
📍 RDS (Relational Database Service)
aws rds describe-db-instances
aws rds start-db-instance --db-instance-identifier mydb
aws rds stop-db-instance --db-instance-identifier mydb
🧠 SageMaker
aws sagemaker list-notebook-instances
aws sagemaker start-notebook-instance --notebook-instance-name my-notebook
aws sagemaker stop-notebook-instance --notebook-instance-name my-notebook
🧰 Miscellaneous
aws configure get region
aws configure set region us-east-1
aws ec2 help
💬 Final Thoughts
If you're building on AWS, the CLI is essential—especially when combined with shell scripts, cron jobs, or infrastructure automation. Bookmark this post, share it with your team, and let me know if you'd like a downloadable PDF version or printable one-pager.