AWS CLI Cheatsheet - Cloud Commands
All essential AWS CLI commands organized by use case, with 41+ entries you can copy and run directly. Find the right command fast when you need it.
Back to SysOpsConfigure & Auth 6
aws configureInteractive configure access key and region
aws configure --profile productionConfigure credentials for a profile
aws configure listShow current config
aws sts get-caller-identityVerify the current identity
export AWS_PROFILE=productionSwitch the default profile
aws configure set region us-west-2Set a single config value
EC2 Instances 6
aws ec2 describe-instances --filters "Name=instance-state-name,Values=running"List running instances
aws ec2 describe-instances --query "Reservations[].Instances[].[InstanceId,State.Name]"Query instance IDs and state
aws ec2 start-instances --instance-ids i-xxxxxStart an instance
aws ec2 stop-instances --instance-ids i-xxxxxStop an instance
aws ec2 terminate-instances --instance-ids i-xxxxxTerminate an instance (irreversible)
aws ec2 create-key-pair --key-name my-key --query "KeyMaterial" --output text > my-key.pemCreate an SSH key pair, save the private key
S3 Storage 8
aws s3 lsList all buckets
aws s3 ls s3://my-bucket/List bucket contents
aws s3 cp file.txt s3://my-bucket/Upload a file
aws s3 cp s3://my-bucket/file.txt ./file.txtDownload a file
aws s3 sync ./local/ s3://my-bucket/remote/Sync a directory (changed files only)
aws s3 sync s3://src-bucket/ s3://dst-bucket/ --deleteSync buckets and delete extras
aws s3 rm s3://my-bucket/file.txtDelete a file
aws s3 mb s3://new-bucket-nameCreate a new bucket
IAM Users & Policies 6
aws iam list-usersList all IAM users
aws iam create-user --user-name newuserCreate an IAM user
aws iam create-access-key --user-name newuserCreate an access key for a user
aws iam attach-user-policy --user-name newuser --policy-arn arn:aws:iam::aws:policy/AmazonS3ReadOnlyAccessAttach a managed policy to a user
aws iam list-attached-user-policies --user-name newuserList a user's attached policies
aws iam delete-user --user-name newuserDelete an IAM user
CloudWatch Logs 5
aws logs describe-log-groupsList log groups
aws logs tail /app/production --followTail logs in real time
aws logs filter-log-events --log-group-name mygroup --start-time 1234567890Filter logs by time
aws logs tail /app/production --since 1hShow logs from the last hour
aws cloudwatch get-metric-statistics --namespace AWS/EC2 --metric-name CPUUtilization --start-time 2026-07-20T00:00:00Z --end-time 2026-07-21T00:00:00Z --period 3600 --statistics AverageQuery EC2 CPU utilization metric
Lambda & Services 5
aws lambda list-functionsList all Lambda functions
aws lambda invoke --function-name my-function output.jsonInvoke a Lambda function (sync)
aws lambda create-function --function-name my-fn --runtime python3.11 --role arn:aws:iam::123:role/role --handler index.handler --zip-file fileb://fn.zipCreate a Lambda function
aws rds describe-db-instancesList RDS DB instances
aws dynamodb list-tablesList DynamoDB tables
Query Tips 5
aws ec2 describe-instances --output tableOutput as a table (readable)
aws s3api list-objects --bucket my-bucket --query "Contents[?Size>`1000000`].Key"JMESPath query for files > 1MB
aws ec2 describe-instances --filters "Name=tag:Name,Values=web-*"Filter instances by tag
aws ec2 describe-instances --query "Reservations[].Instances[].PublicIpAddress" --output textExtract all instances' public IPs
aws s3 presign s3://my-bucket/file.zip --expires-in 3600Generate a 1-hour presigned URL
Tips
- aws configure --profile creates named profiles for multi-account use.
- S3 sync transfers only changed files - good for backup/deploy.
- describe-instances --query filters output with JMESPath.
- Logs Insights queries are more powerful than filter-log-events.
- --output json/table/text: text for scripts, table for humans.
- --query with JMESPath + --output text suits shell scripts.
Official References
Commands are compiled from the official docs below. Click to verify the latest usage.
Maintained by LaoHand
Publicly updated on Jul 19, 2026, continuously proofread against official docs.
Contact Us
Wrong command or description? Send us corrections, business inquiries or product feedback by email.
Contact Us