aws cli cheat sheet

Config

Create profiles

aws configure --profile profilename

Output format

aws configure output format {json, yaml, yaml-stream, text, table}

Specify your AWS Region

aws configure region (region-name)

API Gateway

List API Gateway IDs and Names

aws apigateway get-rest-apis | jq -r '.items[] | .id+" "+.name'

List API Gateway keys

aws apigateway get-api-keys | jq -r '.items[] | .id+" "+.name'

List API Gateway domain names

aws apigateway get-domain-names | jq -r '.items[] | .domainName+" "+.regionalDomainName'

List resources for API Gateway

aws apigateway get-resources --rest-api-id ee86b4cde | jq -r '.items[] | .id+" "+.path'

Find Lambda for API Gateway resource

Amplify

List Amplify apps and source repository

CloudFront

List CloudFront distributions and origins

Create a new invalidation

CloudWatch

List information about an alarm

Delete an alarm or alarms (you can delete up to 100 at a time)

Cognito

List user pool IDs and names

List phone and email of all users

DynamoDB

List DynamoDB tables

Get all items from a table

Get item count from a table

Get item using key

Get specific fields from an item

Delete item using key

EBS

Complete a Snapshot

Start a Snapshot

Get a Snapshot block

EC2

List Instance ID, Type and Name

List Instances with public IP address and Name

List VPCs and CIDR IP Block

List Subnets for a VPC

List Security Groups

Print Security Groups for an Instance

Edit Security Groups of an Instance

Print Security Group Rules as FromAddress and ToPort

Add Rule to Security Group

Delete Rule from Security Group

Edit Rules of Security Group

Delete Security Group

ECS

Create an ECS cluster

Create an ECS service

EKS

Create a cluster

Delete a cluster

List descriptive information about a cluster

List clusters in your default region

Tag a resource

Untag a resource

ElastiCache

Get information about a specific cache cluster

List ElastiCache replication groups

List ElastiCache snapshots

Create ElastiCache snapshot

Delete ElastiCache snapshot

Scale up/down ElastiCache replica

ELB

List ELB Hostnames

List ELB ARNs

List of ELB target group ARNs

Find instances for a target group

IAM Group

List groups

Add/Delete groups

List policies and ARNs

List user/group/roles for a policy

List policies for a group

Add policy to a group

Add user to a group

Remove user from a group

List users in a group

List groups for a user

Attach/detach policy to a group

IAM User

List userId and UserName

Get single user

Add user

Delete user

List access keys for user

Delete access key for user

Activate/deactivate access key for user

Generate new access key for user

Lambda

List Lambda functions, runtime, and memory

List Lambda layers

List source event for Lambda

Download Lambda code

RDS

List DB clusters

List DB instances

Take DB Instance Snapshot

Take DB cluster snapshot

Route53

Create hosted zone

Delete hosted zone

Get hosted zone

List hosted zones

Create a record set

To do this you’ll first need to create a JSON file with a list of change items in the body and use the CREATE action. For example the JSON file would look like this.

Once you have a JSON file with the correct information like above you will be able to enter the command

Update a record set

To do this you’ll first need to create a JSON file with a list of change items in the body and use the UPSERT action. This will either create a new record set with the specified value, or update a record set if it already exists. For example the JSON file would look like this.

Once you have a JSON file with the correct information like above you will be able to enter the command

Delete a record set

To do this you’ll first need to create a JSON file with a list of the record set values you want to delete in the body and use the DELETE action. For example the JSON file would look like this.

Once you have a JSON file with the correct information like above you will be able to enter the following command.

S3

List Buckets

List files in a Bucket

Create Bucket

Delete Bucket

Download S3 object to local

Upload local file as S3 object

Delete S3 object

Download bucket to local

Upload local directory to bucket

Share S3 object without public access

SNS

List SNS topics

List SNS topic and related subscriptions

Publish to SNS topic

SQS

List queues

Create queue

Send message

Receive message

Delete message

Purge queue

Delete queue