AWS CLI Cheat Sheet

Comprehensive AWS CLI commands for configuration, profiles, global options, queries, and common cross-service recipes.

View
StandardDetailedCompact
Export
Copy the compact sheet, download it, or print it.
Download
`D` dense toggle · `C` copy all
## Install, Version, and Help
Show AWS CLI version
aws --version

# Print the installed AWS CLI version.

Open top-level help
aws help

# Show global AWS CLI help.

Open service help
aws ec2 help

# Show help for a specific AWS service namespace.

Open command help
aws s3 cp help

# Show help for a specific command.

## Configuration and Profiles
Run interactive configure
aws configure

# Set credentials, region, and output format interactively.

List current config values
aws configure list

# Show the currently resolved config values.

List configured profiles
aws configure list-profiles

# Show the names of configured profiles.

Get configured region
aws configure get region --profile prod

# Read a config value from a profile.

Set profile region
aws configure set region us-west-2 --profile prod

# Set a config value for a profile.

Configure IAM Identity Center (SSO)
aws configure sso

# Interactively create an SSO-backed profile.

Log in with SSO
aws sso login --profile sandbox

# Obtain an SSO session for a named profile.

Show current caller identity
aws sts get-caller-identity

# Confirm which account, role, or user is active.

## Global Options, Output, and Queries
Override region for one command
aws ec2 describe-instances --region us-east-1

# Run a command in a specific region.

Use a specific profile
aws s3 ls --profile prod

# Run a command under a named profile.

Render tabular output
aws iam list-users --output table

# Format command results as a table.

Filter results with JMESPath
aws ec2 describe-instances --query 'Reservations[].Instances[].{Id:InstanceId,State:State.Name,Type:InstanceType}'

# Select fields from JSON output.

Disable the default pager
aws iam list-users --no-cli-pager

# Prevent output from opening in a pager.

Disable automatic pagination
aws logs describe-log-groups --no-paginate

# Fetch only the first page of a paginated result set.

Control service page size
aws ec2 describe-instances --page-size 25

# Reduce the number of items retrieved per service call.

Limit total items returned
aws iam list-users --max-items 10

# Return only a specific number of items in the CLI output.

Generate input skeleton
aws dynamodb put-item --generate-cli-skeleton input

# Print a JSON skeleton for command input.

Pass structured input from JSON
aws ec2 run-instances --cli-input-json file://run-instances.json

# Provide command arguments from a JSON document.

## Common Cross-Service Recipes
List AWS regions
aws ec2 describe-regions --query 'Regions[].RegionName' --output text

# Show available regions from EC2.

List availability zones
aws ec2 describe-availability-zones --query 'AvailabilityZones[].ZoneName' --output text

# Show AZs for the active region.

Create tags on a resource
aws ec2 create-tags --resources i-0123456789abcdef0 --tags Key=Name,Value=web-01 Key=Env,Value=prod

# Attach tags using a service-specific tagging command.

Wait for a resource state
aws ec2 wait instance-running --instance-ids i-0123456789abcdef0

# Use a waiter until an EC2 instance is running.

Enable debug logging
aws sts get-caller-identity --debug

# Print request/response debugging details.

Recommended next

No recommendations yet.