cs.oldnet

All sheets / Cloud & Infra

AWS Core

Compute, API, storage and IAM essentials. Messaging lives in the AWS Messaging sheet.

IAM

  • Principal (user, role, service) → policy (JSON: Effect, Action, Resource, Condition).
  • Evaluation: explicit Deny > explicit Allow > implicit deny. SCPs and permission boundaries cap the max.
  • Roles + STS temporary credentials for workloads; avoid long-lived access keys.
  • Identity-based policy (on principal) vs resource-based policy (on S3 bucket, SQS queue, Lambda).
{ "Effect": "Allow", "Action": ["s3:GetObject"],
  "Resource": "arn:aws:s3:::my-bucket/*",
  "Condition": { "StringEquals": { "aws:PrincipalTag/team": "web" } } }

Lambda

LimitValue
Timeout15 min max
Memory128 MB – 10 GB (CPU scales with it)
Payload6 MB sync, 256 KB async
/tmpup to 10 GB
Concurrency1000/region default (soft)
  • Cold start: init new execution env. Mitigate: smaller bundles, init outside handler, provisioned concurrency, SnapStart (Java/Python/.NET).
  • Invocation: sync (API GW), async (S3, SNS, EventBridge: retries 2x + DLQ/destinations), poll-based (SQS, Kinesis, DynamoDB Streams via event source mapping).
  • Reserved concurrency caps a function; protects downstream DBs.
const client = new S3Client({});                  // reused across warm invocations
export const handler = async (event, context) => {
  return { statusCode: 200, body: JSON.stringify({ ok: true }) };
};

API Gateway

REST APIHTTP API
Cost / latencyhigher~70% cheaper, faster
Featuresusage plans, API keys, WAF, request validation, cachingJWT authorizers, simpler
  • Integrations: Lambda proxy, HTTP proxy, AWS service, mock. Also WebSocket APIs.
  • Auth: IAM, Cognito, Lambda authorizer, JWT.
  • Limits: 29 s integration timeout (REST default), 10 MB payload; throttling 10k rps account default.

ECS & Fargate

  • Cluster → Service (desired count, LB, deployments) → Tasks (running copies of a task definition).
  • Launch types: Fargate (serverless, per-task billing) or EC2 (you manage instances; cheaper at scale).
  • Task role = app's AWS permissions; execution role = pull image from ECR, write logs, read secrets.
  • Deployments: rolling (min/max healthy %), blue/green via CodeDeploy, circuit breaker with auto-rollback.
  • Service auto scaling on CPU/memory/ALB request count; Service Connect / Cloud Map for discovery.

S3

  • Object storage; 5 TB max object; multipart upload > 100 MB.
  • Strong read-after-write consistency.
  • Storage classes: Standard → Intelligent-Tiering → Standard-IA → Glacier Instant/Flexible/Deep Archive. Lifecycle rules move/expire.
  • Security: Block Public Access on, bucket policies, SSE-S3/SSE-KMS, presigned URLs for temporary access.
  • Static sites: private bucket + CloudFront with Origin Access Control.
  • Events → Lambda/SQS/SNS/EventBridge.

VPC networking

  • VPC → subnets per AZ: public (route to Internet Gateway) and private (route to NAT Gateway).
  • Security groups: stateful, instance-level, allow only. NACLs: stateless, subnet-level, allow + deny.
  • VPC endpoints: gateway (S3, DynamoDB, free) and interface (PrivateLink) to keep traffic private.
  • Load balancers: ALB (L7, path/host routing), NLB (L4, static IP, extreme throughput).

Choosing compute

NeedPick
Event-driven, spiky, < 15 minLambda
Long-running containers, no serversECS Fargate
Kubernetes ecosystemEKS
Full control / GPUs / licensingEC2
Batch jobsAWS Batch, Step Functions + Lambda/ECS

Other services to know

  • CloudFront: CDN, edge caching, OAC to S3, Lambda@Edge/CloudFront Functions.
  • Route 53: DNS, alias records, health checks, weighted/latency/failover routing.
  • Step Functions: workflow orchestration, retries, saga pattern.
  • Secrets Manager (rotation) vs SSM Parameter Store (cheaper config).
  • ECR: container registry with image scanning.
  • Cognito: user pools (auth) and identity pools (AWS creds).

Well-Architected pillars

Operational excellence, Security, Reliability, Performance efficiency, Cost optimization, Sustainability.