Skip to main content
Quick Reference

AWS Cheatsheet

AWS on one page — IAM, VPC, EC2, S3, and the traps around regions, explicit deny, and public buckets.

10 sections 10 tables 14 code snippets

Account and region

Which principal is active

aws sts get-caller-identity

Say the region

# --region ap-south-1

Where the call lands

PieceMeaning
AccountThe bill, the root user, and the hard quotas live here
RegionMost resources exist in one region. IAM users and roles are global
AZOne or more data centers inside a region. A subnet sits in a single AZ
CLI regionComes from config, unless --region or AWS_DEFAULT_REGION overrides it
CredentialsEnvironment keys win, then the shared credentials file, then an instance role
RootUse it to turn on MFA and to create the first admin. Not for daily CLI calls

This page is AWS. Azure is left out.

Who can call

Workloads use a role

# a role yields temporary credentials

The decision

PieceMeaning
UserA person or app with long-lived access keys. Prefer a role for anything that runs unattended
GroupA set of users. A group cannot contain another group
RoleAssumed through STS. An instance profile attaches one role to EC2
Explicit denyBeats every allow. No matching allow is an implicit deny
RootIAM policies do not limit the root user. MFA on, and no root access keys
Two attachmentsAn identity policy and a resource policy both count. A deny in either one wins

VPC

What makes a subnet public

# route 0.0.0.0/0 to an internet gateway, and give the instance a public IP

Paths

PieceMeaning
VPCRegional. Its subnets do not span AZs
Public subnetA route to an internet gateway plus a public IP. The route alone is not enough
NAT gatewayOutbound internet for a private subnet. It lives in one AZ, inside a public subnet
Security groupStateful allow rules on the network interface. There is no deny rule
NACLStateless allow and deny on the subnet. Return traffic needs the ephemeral ports allowed
Gateway endpointS3 and DynamoDB only, with no hourly fee. Other services use an interface endpoint

EC2

Stop

# stop keeps the EBS volumes

Instance store

# instance store is erased on stop

Disks and addresses

PieceMeaning
AMIRegional. Copy it before a launch in another region
StopKeeps EBS. Drops the auto-assigned public IPv4. An Elastic IP on a stopped instance is billed
TerminateDeletes the root volume when DeleteOnTermination is true, the default for the root volume
Instance storeLocal disks. The data is gone after stop or terminate
User dataRuns on the first boot. A later stop and start does not run it again
Security group editTakes effect immediately. No reboot

S3

Upload one object

aws s3 cp report.csv s3://logs-prod/2026/report.csv

Private unless you open it

# Block Public Access starts on for a new bucket

Objects

PieceMeaning
Bucket nameUnique across all AWS accounts. The bucket still lives in one region
ConsistencyStrong read-after-write for creates, overwrites, and deletes
Block Public AccessOn for new buckets. A public bucket policy is ignored while a block is on
VersioningDelete writes a delete marker. Older versions stay until you delete the version id
ClassesOne Zone-IA keeps a single AZ. Glacier Instant Retrieval is immediate. Flexible Retrieval and Deep Archive need a restore
PresignThe URL can do only what the signer can do. It cannot outlive temporary credentials, and an IAM user signature tops out at 7 days

RDS and DynamoDB

Failover is not a read copy

# a Multi-AZ instance standby has no read endpoint

Query needs the key

# Query takes the partition key. Scan walks the table

Reads and writes

PieceMeaning
Multi-AZ instanceThe standby is for failover. A read replica is async and has its own endpoint
EncryptionChosen at creation. The same RDS instance cannot be switched on later
QueryRequires the partition key. The sort key can narrow the range
FilterRuns after the read. You pay for the items read, not the items returned
GSI and LSIA GSI can use a new partition key, is eventually consistent, and can be added later. An LSI shares the table key and is created with the table
Item size400 KB, attribute names included

Lambda

The short default

# the default timeout is 3 seconds. The max is 15 minutes

The function

PieceMeaning
Timeout3 seconds unless you set it. 15 minutes is the ceiling
Execution roleThe function calls AWS as this role. Permission to invoke it is a separate grant
VPCOnly the routes of that subnet. Internet needs a NAT gateway. S3 from a private subnet needs a gateway endpoint or NAT
AsyncRetried twice after the first failure. A synchronous invoke returns the error to the caller
/tmpUp to 10 GB. A warm environment can still hold files from the previous run
Reserved concurrency 0Throttles every invoke of that function

CloudFront and Route 53

The apex record

# an alias can be the zone apex. A CNAME cannot

In front of the origin

PieceMeaning
CloudFrontCaches at edge locations. The origin can be S3, an ALB, or a custom host
OACOrigin Access Control keeps an S3 origin private. Origin Access Identity is the older option
AliasA Route 53 record that can target CloudFront, an ALB, or an S3 website, including at the zone apex
CNAMEA DNS alias to another name. It cannot sit alone at the zone apex
FailoverPrimary and secondary. The primary needs a health check
TTLA long TTL keeps the old answer in resolvers after you edit the record

Cost

What moves the total

PieceMeaning
Data inInbound from the internet is free. Outbound to the internet is billed
Between AZsBilled in both directions, inside the same region
CloudFrontS3 to CloudFront is free. CloudFront out to viewers is billed
SpotCan be interrupted with a two-minute warning. On-Demand has no commit. Savings Plans commit to an hourly spend
Who patchesOn EC2 you patch the guest OS. On S3 and Lambda, AWS runs the servers and you still own IAM and the data
Budget alertSends a notice. It does not stop new spend. The billing metric is published in us-east-1

Interview traps

Versions still fill the bucket

# delete every version and delete marker, then aws s3 rb

The key the CLI is actually using

# AWS_ACCESS_KEY_ID in the environment hides the instance role

Traps worth memorising

TrapWhat happensPrefer
CLI pointed at the wrong regiondescribe-instances returns an empty list--region, or a config region that holds the resource
Access key in the environmentThe instance role is never calledaws sts get-caller-identity before the rest of the debug
aws s3 rb --force with versioningOld versions and delete markers remain, so the bucket delete failsDelete each version id, then remove the bucket
A deny on a security groupThe group has allow rules onlyLeave out the allow, or deny on the NACL
A public bucket policyBlock Public Access ignores itLeave the block on unless the bucket must be public
A presign past the sessionTemporary credentials cannot sign past their own expiryAn expiry inside that session. The URL still cannot exceed the signer

How to use this page: confirm the caller and the region, then read the IAM decision, before you debug the service.