All Cheatsheets

AWS CLI Cheatsheet

AWS CLI commands for IAM, EC2, S3, EKS, Lambda, and CloudWatch Logs.

7 sections58 commandsClick any row to copy

Identity & Auth

aws sts get-caller-identity
aws configure
aws configure list
aws configure list-profiles
aws --profile staging s3 ls
export AWS_PROFILE=staging

Show current account, user ARN

Set up AWS credentials interactively

Show active credentials and region

List all configured profiles

Run command with specific profile

Set default profile for session

IAM

aws iam list-users
aws iam create-user --user-name devuser
aws iam delete-user --user-name devuser
aws iam list-roles
aws iam get-role --role-name MyRole
aws iam list-attached-role-policies --role-name MyRole
aws iam list-policies --scope Local
aws iam create-access-key --user-name devuser
aws iam list-access-keys --user-name devuser

List all IAM users

Create IAM user

Delete IAM user

List all IAM roles

Get role details and trust policy

List policies attached to role

List customer-managed policies

Create access key for user

List user's access keys

EC2

aws ec2 describe-instances --output table
aws ec2 describe-instances --filters Name=instance-state-name,Values=running
aws ec2 describe-instances --query 'Reservations[*].Instances[*].[InstanceId,State.Name,PublicIpAddress]' --output table
aws ec2 start-instances --instance-ids i-1234567890abcdef0
aws ec2 stop-instances --instance-ids i-1234567890abcdef0
aws ec2 reboot-instances --instance-ids i-1234567890abcdef0
aws ec2 terminate-instances --instance-ids i-1234567890abcdef0
aws ec2 describe-security-groups
aws ec2 describe-vpcs
aws ec2 describe-subnets --filters Name=vpc-id,Values=vpc-12345
aws ec2 describe-key-pairs

List all EC2 instances as table

Filter running instances only

Show ID, state, public IP as table

Start stopped instance

Stop running instance

Reboot instance

Terminate (delete) instance

List all security groups

List all VPCs

List subnets in a VPC

List EC2 key pairs

S3

aws s3 ls
aws s3 ls s3://my-bucket/
aws s3 ls s3://my-bucket/ --recursive --human-readable
aws s3 cp file.txt s3://my-bucket/folder/
aws s3 cp s3://my-bucket/file.txt .
aws s3 sync ./dist s3://my-bucket/
aws s3 sync s3://my-bucket/ ./backup/
aws s3 rm s3://my-bucket/file.txt
aws s3 rm s3://my-bucket/folder/ --recursive
aws s3 mb s3://new-bucket-name
aws s3 rb s3://bucket-name --force
aws s3 presign s3://my-bucket/file.txt --expires-in 3600

List all S3 buckets

List bucket contents

Recursive listing with human sizes

Upload file to bucket

Download file from bucket

Sync local directory to bucket

Sync bucket to local directory

Delete single object

Delete all objects in prefix

Create new bucket

Delete bucket and all its contents

Generate pre-signed URL valid for 1 hour

EKS

aws eks list-clusters
aws eks describe-cluster --name my-cluster
aws eks update-kubeconfig --name my-cluster --region us-east-1
aws eks list-nodegroups --cluster-name my-cluster
aws eks describe-nodegroup --cluster-name my-cluster --nodegroup-name ng-1
aws eks update-nodegroup-config --cluster-name my-cluster --nodegroup-name ng-1 --scaling-config minSize=2,maxSize=5,desiredSize=3
aws eks list-addons --cluster-name my-cluster

List all EKS clusters

Cluster endpoint, version, status

Update kubeconfig to access cluster

List node groups in cluster

Node group details, scaling config

Update node group scaling

List installed EKS add-ons

Lambda

aws lambda list-functions
aws lambda invoke --function-name myFunc output.json
aws lambda invoke --function-name myFunc --payload '{"key":"val"}' out.json
aws lambda get-function --function-name myFunc
aws lambda update-function-code --function-name myFunc --zip-file fileb://code.zip
aws lambda update-function-configuration --function-name myFunc --timeout 30
aws lambda list-event-source-mappings --function-name myFunc

List all Lambda functions

Invoke function synchronously

Invoke with JSON payload

Function config, code URL, runtime

Update function code from zip

Update function settings (timeout, memory)

List triggers (SQS, DynamoDB, etc.)

CloudWatch Logs

aws logs describe-log-groups
aws logs describe-log-streams --log-group-name /aws/lambda/myFunc
aws logs tail /aws/lambda/myFunc --follow
aws logs tail /aws/lambda/myFunc --since 1h
aws logs filter-log-events --log-group-name /aws/lambda/myFunc --filter-pattern ERROR
aws logs get-log-events --log-group-name /aws/ecs/myapp --log-stream-name stream-name

List all log groups

List log streams in a group

Follow logs in real time (like tail -f)

Logs from last 1 hour

Search logs for pattern

Fetch specific log stream events