Skip to content
Tutorials Center
My learning

Topics

Lesson 69 of 70 ยท Practice, interviews and cheat sheet

AWS Cheat Sheet

A one-page AWS cheat sheet: pick the right service, remember key limits and defaults, copy common CLI commands and apply pricing rules of thumb and design decisions.

This is the page to keep open while you build. It does not teach anything new; it condenses the whole tutorial into tables you can scan: which service for which job, the limits that bite, the CLI commands you type weekly, the pricing rules that prevent surprises, and the decisions that come up in every design.

Limits and prices change, and many limits are soft quotas you can raise. Treat the numbers as orientation and confirm them in the Service Quotas console and the pricing pages before you depend on them. Prices below are described as relative rules of thumb on purpose.

Service chooser

You need to... Reach for Why
Run a server you control EC2 Full OS access, many instance types
Run a container without servers ECS on Fargate Pay per task, no hosts to patch
Run code on events Lambda No servers, scales to zero
Store files and objects S3 Durable, cheap, unlimited size in total
Attach a disk to one instance EBS Block storage, snapshots
Share a file system across instances EFS NFS, elastic
Relational database RDS or Aurora Managed backups, patching, failover
Key-value at huge scale DynamoDB Single-digit millisecond, serverless
Cache hot reads ElastiCache In-memory Redis or Memcached
Queue work SQS Buffers and decouples
Fan out notifications SNS Pub/sub to many subscribers
Route events by rules EventBridge Event bus, schedules, pattern matching
Orchestrate steps with retries Step Functions State machines
Expose an HTTP API API Gateway Auth, throttling, stages
Distribute traffic ALB or NLB Layer 7 or layer 4
Serve content close to users CloudFront Edge cache
DNS and health-based routing Route 53 Records and routing policies
Private network VPC Subnets, routes, security groups
Secrets Secrets Manager Rotation and fine-grained access
Config values Parameter Store Hierarchical and cheap
Encryption keys KMS Managed keys and audit
Audit API calls CloudTrail Who did what, when
Metrics, logs, alarms CloudWatch Monitoring and alerting
Infrastructure as code CloudFormation, CDK, Terraform Repeatable environments
flowchart TD
    A["New workload"] --> B{"Event-driven and short?"}
    B -->|Yes| L["Lambda"]
    B -->|No| C{"Containerized?"}
    C -->|Yes| F["ECS on Fargate"]
    C -->|No| E["EC2"]

A first-pass compute decision. Real choices also weigh team skills, cost and runtime limits.

Limits and defaults worth remembering

Service Fact
S3 Object up to 5 TB; one PUT up to 5 GB; multipart for large uploads (parts 5 MB to 5 GB, up to 10,000 parts)
S3 Bucket names are global; new buckets block public access by default
Lambda Timeout up to 15 minutes; memory 128 MB to 10,240 MB; CPU scales with memory
Lambda Synchronous request or response payload 6 MB; /tmp from 512 MB up to 10,240 MB
Lambda Default regional concurrency is 1,000 (raisable); container images up to 10 GB
API Gateway Integration timeout is 29 seconds by default
SQS Visibility timeout default 30 seconds, maximum 12 hours; retention 1 minute to 14 days, default 4 days
SQS Standard queues deliver at least once and may reorder; FIFO preserves order per message group
DynamoDB Item size limit 400 KB; query reads from one partition key
VPC Five addresses reserved per subnet; default 5 VPCs per region
VPC A security group is stateful; a NACL is stateless and numbered
EBS gp3 baseline 3,000 IOPS and 125 MB/s, scalable independently of size
EC2 Spot gives a two-minute interruption notice
CloudFormation A stack holds up to 500 resources; use nested stacks beyond that
IAM Roles are assumed with temporary STS credentials; policies are denied by default
Route 53 Alias records are free to query for AWS targets and work at the zone apex

Do not memorize a limit you have not checked. Most are adjustable quotas, and new features sometimes move them. When a design depends on a number, look it up in Service Quotas.

CLI quick list

All commands are read-only here; they need an account and credentials. Add --profile name and --region region as needed.

Terminal
# identity and setup
aws configure
aws sts get-caller-identity
aws configure sso
aws sso login --profile dev

# S3
aws s3 ls
aws s3 cp file.txt s3://my-bucket/
aws s3 sync ./site s3://my-bucket --delete
aws s3 presign s3://my-bucket/file.txt --expires-in 600

# EC2
aws ec2 describe-instances --query "Reservations[].Instances[].[InstanceId,State.Name]" --output table
aws ec2 start-instances --instance-ids i-0123456789abcdef0
aws ec2 stop-instances --instance-ids i-0123456789abcdef0

# IAM
aws iam list-roles
aws iam simulate-principal-policy --policy-source-arn ARN --action-names s3:GetObject

# Lambda
aws lambda invoke --function-name my-fn out.json
aws lambda update-function-code --function-name my-fn --zip-file fileb://function.zip

# Logs and monitoring
aws logs tail /aws/lambda/my-fn --follow
aws cloudwatch describe-alarms --state-value ALARM

# Infrastructure
aws cloudformation deploy --template-file template.yaml --stack-name demo --capabilities CAPABILITY_IAM
aws cloudformation describe-stack-events --stack-name demo

# Containers
aws ecr get-login-password | docker login --username AWS --password-stdin ACCOUNT.dkr.ecr.REGION.amazonaws.com
aws ecs update-service --cluster app --service web --force-new-deployment

Two flags save time everywhere: --query (a JMESPath filter) and --output table|json|text. Many list commands paginate automatically in the v2 CLI.

Pricing rules of thumb

  • You pay for what is running or stored, whether or not it does useful work: idle instances, unattached volumes, load balancers with no traffic and old snapshots all bill.
  • Data coming into AWS is generally free; data leaving to the internet, and data crossing regions or sometimes AZs, costs money.
  • A NAT gateway has an hourly charge plus a per-GB processing charge, which makes it a frequent surprise. Gateway endpoints for S3 and DynamoDB avoid it for that traffic.
  • Public IPv4 addresses are billed hourly, even when attached.
  • Lambda bills per request and per GB-second, so more memory costs more per millisecond but can finish faster.
  • Commitment (Savings Plans, Reserved Instances) discounts steady baselines; Spot discounts interruptible work most.
  • Tier storage by access: Standard for hot data, Intelligent-Tiering for unknown patterns, Glacier classes for archives (mind retrieval fees and minimum durations).
  • Tag everything with an owner and environment, and set budgets with alerts before you need them.

The calculator below turns the Lambda rule into numbers, using made-up unit prices so the shape is clear. Real prices differ by region and over time.

Python Lambda memory versus cost

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Notice that doubling memory often does not double the bill, because the function finishes sooner. The cheapest setting is found by measuring, not guessing.

Architecture decisions

Question Default answer
One AZ or two? At least two for anything production
Public or private subnets? Load balancers public, compute and data private
Long-lived keys or roles? Roles and temporary credentials
Console clicks or code? Infrastructure as code for anything you will rebuild
Scale up or scale out? Scale out, with stateless instances
Synchronous or asynchronous? Queue anything that can wait
Pull or push messages? SQS pull for work, SNS push for notifications
Cache or not? Cache reads that are repeated and tolerate staleness
Multi-region? Only when your RTO, RPO or users demand it
Encrypt? Yes, at rest and in transit, with managed keys unless you need control

The next tool is a tiny decision helper that encodes a few of these answers. It is a stand-in for judgment, not a replacement: use it to check you answered the same questions you would ask a colleague.

Python Design checklist reviewer

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. You want a managed relational database with automatic failover. Which service fits best?

    RDS and Aurora provide managed relational engines with backups, patching and Multi-AZ failover. DynamoDB is a key-value store, S3 stores objects and ElastiCache is a cache.
  2. 2. Which cost is a common surprise in private-subnet designs?

    Traffic that leaves a private subnet through a NAT gateway is charged per GB processed on top of the hourly fee. Gateway endpoints avoid this for S3 and DynamoDB.
  3. 3. How long can a single Lambda invocation run at most?

    The Lambda timeout can be set up to 15 minutes. The 29-second figure is the default API Gateway integration timeout, which often limits request-response APIs first.
  4. 4. Which is the best default for credentials used by an application running on AWS?

    Roles provide short-lived credentials automatically, so nothing permanent can leak from code, images or logs.

Summary

  • Pick services by the job: compute (EC2, Fargate, Lambda), storage (S3, EBS, EFS), data (RDS, DynamoDB, ElastiCache), messaging (SQS, SNS, EventBridge).
  • Check limits in Service Quotas; many are adjustable and some change over time.
  • The CLI patterns you will use most are sts get-caller-identity, s3 sync, logs tail and cloudformation deploy, with --query for filtering.
  • Idle resources, NAT traffic, data transfer and public IPv4 addresses are the usual bill surprises.
  • Default designs use two AZs, private compute, roles, queues for slow work and infrastructure as code.

You have reached the end of the AWS tutorial. Revisit any chapter from the AWS course home, or sharpen your skills again with the Practice Exercises.