Gradual rollout of a new Lambda version with auto-rollback on errors.
Alias with weighted version routing (e.g. 90/10). CodeDeploy `LambdaCanary10Percent5Minutes` or `LambdaLinear*` shifts traffic and watches CloudWatch alarms.
Need an additional access pattern beyond the primary key.
GSI: alternate partition + sort key, eventually consistent, separate capacity, can be added any time. LSI: same partition key, alternate sort key, strong-consistency option, must be created at table creation.
Standard: long-running (β€1 year), exactly-once, $0.025/1k transitions, full history. Express: β€5 min, at-least-once or at-most-once, billed per request + duration; for high-volume ETL/streaming.
Workflow step fails; want retry with backoff and route to a recovery state.
`Retry` array (per-state, with `BackoffRate` + `MaxAttempts`) and `Catch` for terminal failure routing. Match by `ErrorEquals` (e.g. `States.TaskFailed`, custom error names).
Code on EC2 / ECS task / Lambda needs AWS access - no embedded keys.
Attach an IAM role via instance profile (EC2) or task/execution role (ECS/Lambda). SDK pulls temporary credentials from the metadata service; auto-rotates.
Let a team self-manage IAM roles, but cap what permissions they can grant.
Permission boundary policy on the team's creator role. Any role they create with the boundary has the intersection of identity policy + boundary as effective permissions.
SPA / mobile client vs server-side service calling Cognito.
Public clients (SPA, mobile) β app client without secret. Confidential clients (server) β app client with secret; client must include `SECRET_HASH` (HMAC of username + clientId).
Encrypt a small secret (β€4 KB) directly with KMS.
`kms:Encrypt` returns ciphertext blob containing the key ARN. `kms:Decrypt` recovers plaintext if caller has permission and (if specified) `EncryptionContext` matches.
Encrypt large data with KMS without hitting the 4 KB direct-encrypt limit.
Envelope encryption. `GenerateDataKey` returns plaintext + encrypted DEK; encrypt data locally with DEK, store encrypted DEK alongside, discard plaintext DEK.
Why: KMS enforces access control on the small DEK; bulk encryption happens locally at line speed.
Secrets Manager native rotation (managed Lambda) for Aurora/RDS/DocumentDB/Redshift. Master/user pattern uses a separate master secret to rotate the user secret.
Restrict CloudFront access to authenticated users.
Signed URLs (single resource) or signed cookies (multiple resources, SPAs/streaming). Sign with a CloudFront key pair stored as a public key in CloudFront key group.
Lambda environment variable contains a sensitive value.
Lambda encrypts env vars at rest with KMS by default. For in-transit/at-decrypt control, configure a custom CMK and use the in-console Encryption helpers to ship pre-encrypted ciphertext.
Blue/green deployment for an ECS service behind an ALB.
CodeDeploy Compute Platform = ECS. Creates green task set; ALB shifts listener to green target group; optional manual approval before traffic switch and before terminating blue.
CDK: programming languages (TS/Python/Java/Go/.NET), full app constructs, multi-resource patterns. SAM: YAML extension of CFN, focused on serverless, simpler. Both compile to CloudFormation.
CloudFormation auto-rolls back unless `DisableRollback` is true. Stuck in `UPDATE_ROLLBACK_FAILED`? Use `ContinueUpdateRollback` with `ResourcesToSkip`.
Nested stacks (`AWS::CloudFormation::Stack` with `TemplateURL`) for reuse owned by one parent. Cross-stack via Outputs + `Fn::ImportValue` for tighter coupling between separate stacks.
All-at-once (fastest, downtime), Rolling (no extra instances, partial capacity), Rolling with additional batch (no capacity loss, extra cost), Immutable (new ASG, safest), Blue/Green (separate env, swap CNAMEs).
Push a Docker image to ECR for ECS / EKS / Lambda.
`aws ecr get-login-password | docker login` β `docker tag` β `docker push`. Lambda container images: image pulled once at deploy; tagged image must be in same region.
Provisioned Concurrency for predictable load. SnapStart for Java/Python init-heavy code. Slim deps, use ARM/Graviton, move heavy init outside the handler.
`TooManyRequestsException` from Lambda; concurrency limit hit.
Reserved concurrency per function (caps + reserves) or request account-level limit increase. Async invocations queue and retry; sync invocations error.
CloudWatch `WriteThrottleEvents` / `ReadThrottleEvents`. Switch to On-Demand mode, increase provisioned capacity, or fix a hot partition with better key design.
Lazy loading (cache miss β DB β populate cache): only cache requested data, but stale-prone. Write-through (write to cache + DB on every write): always fresh, but writes have extra cost. TTL bounds staleness either way.