Back to exam

AWS Certified Developer - Associate DVA-C02 Cheatsheet

AWS Certified Developer - Associate

Download free PDF

Development with AWS Services (32%)

Application patterns and SDK calls

  • **Stateless compute** keeps durable session data outside each instance or function. Use DynamoDB or an appropriately resilient ElastiCache deployment so requests can move between workers.
  • **Synchronous** calls wait for a result. **Asynchronous** jobs acknowledge acceptance, persist work, and expose completion through status queries, notifications or WebSocket updates.
  • **Queues** absorb bursts and decouple processing rates. **Fanout** gives each consumer its own copy. **Orchestration** coordinates ordered steps, branching and recovery.
  • Use **AWS SDKs** for signing, credential refresh, pagination and supported retries. Configure the correct Region and handle service errors and partially successful batch responses.
  • Retry transient throttling with **exponential backoff and jitter** and a bounded retry budget. Make retried writes **idempotent** using durable request identifiers and atomic conditional operations.

Lambda runtime and storage

  • The **event** contains invocation input; the **context** supplies runtime information such as the request ID and remaining time. Log correlation IDs to standard output or standard error.
  • Initialize **SDK clients and reusable connections outside the handler**. Execution environments may be reused; validate stale connections and keep request-specific data inside the handler.
  • Use **environment variables** for deployment-specific settings such as table names. Store rotating credentials in a secret service and retrieve them at runtime.
  • **/tmp** is writable ephemeral storage encrypted at rest. Size it for local scratch files and repeated I/O; contents can survive warm invocations but are neither durable nor shared between environments.
  • **EFS** provides shared persistent files through VPC mount targets and access points. Configure network access, NFS permissions and execution-role permissions; use it for large shared libraries or reference data.
  • **Layers** share versioned dependencies under /opt. Pin layer versions and update consumers explicitly. Layers still count toward the combined unzipped package limit; use an ECR container image or EFS when appropriate.

Lambda invocation and failure handling

  • **S3 and SNS** can invoke Lambda asynchronously. **SQS, DynamoDB Streams and Kinesis** use an event source mapping that polls records and invokes the function with batches.
  • For **asynchronous invocations**, configure retry attempts, maximum event age and an on-failure destination or DLQ. Function errors normally receive two retries by default; throttling follows a different retry path.
  • **Destinations** send an invocation record with outcome details. Configure on-success and on-failure destinations for both outcomes, grant delivery permissions, and monitor **DestinationDeliveryFailures**.
  • For **SQS failures**, use the source queue's redrive policy and DLQ. Lambda's asynchronous invocation DLQ settings do not govern SQS event source mappings.
  • Use **partial batch responses** to retry failed records without replaying successful work where supported. Stream failures can hold up a shard; tune retry, record-age and batch-splitting settings.
  • Use **event filters** on supported mappings to avoid unwanted function invocations. Match the source event structure and data types; an SNS subscription filter belongs on the subscription.

API Gateway contracts and real-time APIs

  • **REST APIs** support features such as mock integrations, request validation and stage caching. **HTTP APIs** offer a simpler API model with built-in JWT authorization. Choose by required features.
  • Use a **MOCK integration** to return predefined status codes and bodies without a backend. Request mapping selects the mock result; integration response mapping supplies the response representation.
  • **Mapping templates** transform non-proxy request and response payloads. Configure method responses and integration responses consistently, including Content-Type and error status mappings.
  • A REST **Lambda proxy response** includes statusCode and a string body, with optional headers and isBase64Encoded. A malformed response can cause **502**; integration timeout can cause **504** even if Lambda later finishes.
  • Return suitable HTTP semantics: **400** for invalid input, **401** for missing or invalid authentication, **403** for forbidden access and **429** for throttling. Diagnose the actual gateway or backend error.
  • For **WebSocket APIs**, track connection IDs through $connect and $disconnect. Use the API Gateway management endpoint to post updates or disconnect clients; handle stale connections and authorize access to each user's data.

DynamoDB keys and indexes

  • A **partition key** distributes data; an optional **sort key** identifies and orders items within a partition key value. Choose high-cardinality keys with well-distributed traffic, based on access patterns.
  • **Query** requires partition-key equality and can constrain the sort key with ranges or begins_with. Use **ScanIndexForward=false** for descending results and Limit for a bounded result page.
  • A **GSI** provides a different partition key and optional sort key. Add one for searches such as customer-to-orders or category-to-top-scores; project the attributes the query needs.
  • An **LSI** keeps the table partition key and changes the sort key. Define it at table creation; it shares table throughput. A GSI can be added later and has separate provisioned throughput.
  • **Strongly consistent reads** are supported on tables and LSIs. GSI reads are eventually consistent; increasing capacity does not change their consistency model.

DynamoDB operations and lifecycle

  • **GetItem** retrieves one complete primary key. **BatchGetItem** retrieves specified keys across one or more tables. Retry only **UnprocessedKeys** with backoff; results need not follow request order.
  • **Query** reads a matching key range; **Scan** reads the table or index. Filters apply after reading and do not reduce read capacity consumed. Follow LastEvaluatedKey to retrieve further pages.
  • **UpdateItem** changes selected attributes and can create an item when the key is absent. **PutItem** replaces an item. Use conditions such as attribute_not_exists to enforce create-only behavior.
  • **Conditional writes** and version attributes prevent lost updates and duplicate claims. A separate read followed by an unconditional write leaves a race window.
  • **TransactWriteItems** groups changes atomically across items and tables; use it for all-or-nothing updates. BatchWriteItem is a batching mechanism and does not provide transaction atomicity.
  • **TTL** uses a Number containing Unix epoch seconds. Expired items are removed asynchronously; filter expired records when access must stop immediately. TTL is not an exact-time deletion scheduler.
  • **DynamoDB Streams** exposes item changes to consumers. Select keys, new images, old images or both; old images support archiving removed items, while both images support comparing changes. Configure the Lambda mapping separately.

S3 objects, events and retention

  • Store **large files in S3** and searchable metadata or object keys in DynamoDB. Put an S3 reference in queue messages instead of embedding large binary files.
  • Use **S3 APIs** for object access; object storage does not provide ordinary shared-file append semantics. Use EFS when applications require a shared filesystem.
  • **Object-created notifications** can trigger processing. Filter prefixes or suffixes, grant destination permissions, and separate input from output prefixes to prevent recursive invocations.
  • S3 event delivery can be duplicated or arrive out of order. Make consumers **idempotent**; use SNS or EventBridge when several independent consumers need the event.
  • **Lifecycle rules** transition and expire objects. In versioned buckets, current-version expiration can create a delete marker; separately manage noncurrent-version expiration and expired delete markers.
  • Noncurrent-version retention can combine **age and number of newer versions**. Noncurrent age begins when a version becomes noncurrent; lifecycle cleanup is asynchronous.
  • **Glacier Instant Retrieval** supports immediate access. **Flexible Retrieval** and **Deep Archive** require restore workflows. Choose by retrieval delay, access frequency, retention and cost; use Object Lock for WORM retention.

SQS delivery and worker control

  • **Standard queues** provide at-least-once delivery and best-effort ordering. **FIFO queues** order messages within each MessageGroupId and support deduplication; consumers still need idempotent side effects.
  • Use **MessageDeduplicationId** or content-based deduplication for FIFO producer retries. Independent message groups allow parallel work; one group serializes its ordered workload.
  • **Visibility timeout** hides a received message while processing. Allow enough time for processing and retries; delete only after success. Extend visibility for long-running custom consumers.
  • For Lambda, size visibility for the **function timeout, batching and retry overhead**. A short timeout can make an in-flight message visible again and cause duplicate processing.
  • **DelaySeconds** postpones initial delivery; visibility starts after receipt. **Long polling** reduces empty receives, and batching reduces request overhead.
  • Set a **redrive policy** with maxReceiveCount to isolate poison messages. After fixing the cause, redrive the DLQ with **StartMessageMoveTask**; PurgeQueue deletes messages.
  • An SQS mapping's **maximum concurrency** caps concurrent function invocations for that source. Batch size controls records per invocation. Neither establishes strict priority between multiple queues or an exact requests-per-second limit.

SNS fanout and EventBridge routing

  • **SNS** publishes to subscriptions. Use one **SQS queue per consumer** for independent buffering; multiple consumers of one queue compete for messages rather than each receiving a copy.
  • Apply **subscription filter policies** to message attributes or supported JSON body fields. Add subscribers and filters to route partner-specific events without adding publisher routing branches.
  • **SNS FIFO with SQS FIFO** preserves ordered fanout by message group. FIFO topics do not directly deliver SMS, email or HTTP notifications; keep ordered processing separate from end-user notification delivery.
  • **EventBridge rules** match event patterns and route to targets. For cross-account collection, authorize the receiving bus, forward events from source-account rules, and configure downstream target permissions.
  • **EventBridge schedules** invoke work at a rate, cron expression or specified time. Use Scheduler or a scheduled rule instead of keeping compute running solely for a timer.
  • **EventBridge Pipes** connects a source to a target with optional filtering and enrichment. Source filtering runs before enrichment; evaluate conditions on newly enriched fields in the enrichment logic or downstream.

Streams and coordinated workflows

  • **Kinesis Data Streams** retains ordered records within shards for independent consumers and replay. Partition keys determine placement; distribute traffic and checkpoint progress for recovery.
  • For **PutRecords**, inspect each result and retry failed records with backoff. Add shard capacity or use an appropriate on-demand configuration for higher throughput; avoid a single hot partition key.
  • **Amazon Data Firehose** buffers and delivers data to destinations such as S3. A transformation Lambda can redact or normalize records before delivery; it serves a different role from a replayable stream.
  • **Step Functions** coordinates Task, Choice, Parallel, Map and Wait states. Use Standard workflows for durable waits and long-running coordination rather than sleeping inside Lambda.
  • **Retry** selects retryable errors and controls delay, backoff and maximum retries. **Catch** routes failures to recovery logic; a Fail state terminates execution. Keep permanent validation errors separate from transient failures.
  • Use **Wait states or callbacks** for external completion. Payment, inventory and notification steps need explicit consistency and compensation logic; ordered message delivery alone does not make a distributed transaction atomic.

Security (26%)

Workload identities and temporary credentials

  • Use an **EC2 instance-profile role**, **Lambda execution role** or **ECS task role** for application AWS access. The SDK obtains temporary credentials; keep long-term access keys out of code and images.
  • The **ECS task execution role** supports actions such as image pulls, configured log delivery and secret injection. The **task role** authorizes AWS API calls made by the application.
  • The **credential provider chain** can select explicit or environment credentials before workload-role credentials. Remove stale credentials and inspect the actual caller identity when permissions appear inconsistent.
  • For **cross-account AssumeRole**, authorize sts:AssumeRole on the caller and trust that caller in the destination role. The assumed role's policy grants target actions; temporary credentials include a session token.
  • Use **IAM Identity Center** for workforce federation and permission sets. Renew expired CLI SSO sessions. Select explicit Regional **STS endpoints** for regional application dependencies.
  • **SigV4** signs requests with scoped credentials. Carry the signature in the Authorization header or signed query parameters; SDKs handle signing. **IMDSv2** uses a session token to retrieve EC2 metadata and role credentials.

Permission boundaries and resource policies

  • Grant **least privilege** by action, resource and applicable conditions. An applicable **explicit deny** overrides allow; permission boundaries and organization controls can further limit effective permissions.
  • Separate **who may invoke Lambda** from **what its code may access**. Resource policies authorize callers such as S3 or ALB; execution-role policies authorize downstream S3, DynamoDB and other API calls.
  • Restrict service-principal trust and invocation permissions with **aws:SourceArn** and **aws:SourceAccount** where supported. Match the exact production bucket, target group or state machine to limit unintended use.
  • For S3, **s3:ListBucket** targets the bucket ARN; **s3:GetObject and s3:PutObject** target object ARNs. Scope prefixes and keys deliberately; account ownership does not automatically grant every cross-account caller access.
  • Cross-account encrypted access can require **identity permission, a resource policy and KMS key permission**. Check all applicable layers and use a customer managed key when cross-account key access is needed.
  • Use supported **DynamoDB fine-grained conditions**, such as LeadingKeys and Attributes, to restrict item and attribute access. Prefer controlled UpdateItem operations when users may edit only selected fields.

Cognito and API authorization

  • **Cognito user pools** manage sign-up, sign-in, MFA, federation and JWT tokens. **Identity pools** exchange supported identities for temporary AWS credentials with authenticated or optional guest roles.
  • Use separate **guest and authenticated roles** with minimal access. Restrict each user's S3 prefix through IAM conditions; filtering files only in the UI does not enforce authorization.
  • For REST APIs, use a **Cognito user pool authorizer** or a custom Lambda authorizer. HTTP APIs support a built-in **JWT authorizer** with issuer, audience and scope validation.
  • Send a valid **token**, not a user ID, in the configured authorization header. Validate claims and expiry. Updated identity attributes require refreshed tokens; authorizer caches can also preserve an older decision.
  • **WebSocket Lambda authorization** occurs on $connect. Enforce resource permissions for subsequent application actions. Cognito triggers such as **post authentication** can initiate custom login notifications.
  • **ALB HTTPS authentication actions** integrate Cognito or an OIDC provider before forwarding. **Function URLs** use AWS_IAM with SigV4 or NONE; IAM access requires InvokeFunctionUrl and InvokeFunction permissions.

Secrets and shared configuration

  • **Secrets Manager** stores encrypted credentials and supports rotation. Retrieve the current value at runtime, cache with a refresh policy, and refresh after authentication failures instead of embedding secrets in published code.
  • Rotation must update **both the secret and the target system**. Use supported managed integration or a rotation Lambda. Alternating-user strategies can reduce interruption for supported database workloads.
  • Use **separate secrets per environment**. For regional resilience, replicate secrets and encrypt each replica with a key in its destination Region; applications select the appropriate regional secret.
  • For **cross-account secret retrieval**, allow the caller through the secret resource policy and its identity policy, plus decrypt access to the customer managed KMS key. AWS managed key policies cannot be customized for this sharing.
  • **Parameter Store** organizes shared settings by paths and supports SecureString encryption. Advanced parameter policies provide expiration and notification events; SecureString alone does not implement database password rotation.
  • Share supported **advanced parameters through AWS RAM**, or use a controlled cross-account role. **AppConfig** adds configuration validation, feature flags, staged deployment and alarm-based rollback; agents cache and refresh values locally.
  • **IAM database authentication** uses short-lived authentication tokens for supported RDS and Aurora engines. Configure the database user, rds-db:connect permission and TLS; SQL privileges remain database permissions.

KMS and envelope encryption

  • **Envelope encryption** uses a data key for file contents and a KMS key to protect that data key. Use a fresh data key per file when separate cryptographic keys are required.
  • **GenerateDataKey** returns plaintext and encrypted copies of a data key. Encrypt locally with the plaintext key, erase it from memory when practical, and store the encrypted key alongside the ciphertext.
  • To decrypt, use **KMS Decrypt** on the encrypted data key, then decrypt the file locally. Direct KMS Encrypt is for small inputs, not multi-megabyte files. The **AWS Encryption SDK** packages encrypted data keys with its ciphertext.
  • **Customer managed keys** provide policy and lifecycle control. **AWS managed** and **AWS owned** keys have different administrative control; key rotation does not rotate database passwords or automatically re-encrypt old objects.
  • **Key deletion** is scheduled, with a waiting period. Removing imported key material is a separate operation that can make data immediately unusable until the same material is reimported; protect recovery material accordingly.

Data encryption and selective disclosure

  • **Encryption at rest** and **TLS in transit** address separate paths. S3 **SSE-S3** uses S3-managed keys; request header AES256 selects it. **SSE-KMS** adds KMS authorization and key-usage auditing.
  • DynamoDB encrypts stored data by default with an **AWS owned key**; choose a customer managed key when policy control requires it. Enable appropriate encryption for EBS, RDS, caches, streams and queues.
  • **Client-side encryption** protects contents before upload. If only users may decrypt, keep the wrapping private key under their control; server-side encryption still permits authorized server-side retrieval.
  • **CloudFront field-level encryption** uses a public key for selected fields; only components holding the private key decrypt them. It complements HTTPS and requires explicit backend decryption before plaintext processing.
  • **Redaction** removes sensitive fields before disclosure. An S3 Object Lambda access path can transform returned objects through its configured function; ordinary bucket GET requests do not automatically use that transformation.
  • **Macie** discovers sensitive data and evaluates S3 security risks. Route findings through EventBridge when needed. Sanitize logs and trace attributes before export; encryption does not itself remove PII.

Private content and HTTPS delivery

  • **S3 presigned URLs** delegate a specific operation for a limited time under the signer's permissions. Authorize the user before signing; the URL can expire sooner if the signer's temporary credentials expire.
  • **CloudFront signed URLs** suit individual resources; **signed cookies** suit groups of protected files. Configure a separate unrestricted cache behavior for a public login page when required.
  • Use **origin access control** and a bucket policy scoped to the CloudFront distribution to keep an S3 origin private. Grant read access for delivery; a private origin does not itself authenticate viewers.
  • Enforce S3 HTTPS with a deny when **aws:SecureTransport=false**. Restrict private paths with **aws:SourceVpce** or **aws:SourceVpc** as appropriate; endpoint policies also constrain access.
  • Configure **viewer and origin HTTPS** independently. CloudFront certificates use ACM in us-east-1; regional ALBs and regional API endpoints need a certificate in their own Region. Monitor expiry and renew imported certificates.
  • **CORS** controls browser cross-origin requests, not IAM permissions. Configure allowed origins, methods and headers for shared assets or APIs; keep authorization controls in place.

Deployment (24%)

Source control and release pipelines

  • **Git repositories**, including CodeCommit repositories, track commits, branches and reviews. Use feature branches for new work and release branches for stabilization; merge release fixes back into the main development line.
  • **CodePipeline** orchestrates source, build, test, approval and deployment actions. A wrong branch trigger or failed earlier action can prevent deployment; inspect execution history and artifact flow.
  • Run **unit tests before promotion**, then integration tests against a test environment. Add a **manual approval action** before production and configure SNS notifications for reviewers.
  • Give each pipeline or action role the permissions it needs. For **cross-account or cross-Region deployments**, plan target roles, artifact access and encryption-key permissions explicitly.
  • **CodeArtifact** stores language packages; **ECR** stores container images. CodeArtifact external connections fetch public packages, while upstream repositories link repositories; package-version events can trigger rebuilds.

CodeBuild specifications and test reports

  • A **buildspec.yml** defines install, pre_build, build and post_build commands, plus artifacts, reports and cache paths. Failed test commands should fail the action so bad artifacts are not promoted.
  • Use **CodeBuild test report groups** for supported machine-readable test results. Keep report configuration separate from deployment lifecycle instructions in an AppSpec file.
  • Load sensitive values through **Secrets Manager or Parameter Store integration** with least-privilege service-role access. Avoid plaintext secrets in buildspecs, source code and logs.
  • Use **S3 or supported local caches** for dependency directories. Local cache reuse depends on host availability; cache paths and keys must match the dependency workflow.
  • Use **VPC-enabled builds** when tests need private databases. Provide network routes and security-group access as well as IAM permissions; a role alone cannot create network reachability.

CloudFormation template mechanics

  • **Resources** declares infrastructure. **Parameters** accept inputs and AllowedValues constrains choices. **Mappings** holds lookup data retrieved with Fn::FindInMap.
  • Use **AWS::Region** and other pseudo parameters for deployment context. **Ref**, **GetAtt** and **Sub** connect resources; use DependsOn when a dependency is not implied by a reference.
  • Publish cross-stack values with **Outputs and Export**, and consume them with **Fn::ImportValue** in the same account and Region. Keep reusable network and application stacks separately owned.
  • Use **StackSets** for repeated deployments across accounts and Regions. AMI IDs are regional: copy a custom AMI, enable encryption during copying when needed, and reference the destination AMI ID.
  • Use **dynamic references** for Parameter Store or Secrets Manager values. Generate passwords with an AWS::SecretsManager::Secret resource; NoEcho hides some displays but is not encryption.
  • **Custom resources** handle provisioning actions outside native resource support, including database-user setup. Implement create, update and delete behavior with an explicit success or failure response.
  • A **service role** performs stack actions. Acknowledge named IAM resources with **CAPABILITY_NAMED_IAM**. Use **DefinitionSubstitutions** to inject deployed resource values into a Step Functions definition.

CloudFormation change and recovery controls

  • A **change set** previews proposed additions, updates and replacements. **Drift detection** compares supported deployed properties with the template; it detects out-of-band modifications.
  • **DeletionPolicy** controls disposal when a resource is removed from the stack or the stack is deleted. **UpdateReplacePolicy** controls the old physical resource after replacement. Use Retain or Snapshot deliberately for stateful data.
  • A **stack policy** can block selected resource updates. **Termination protection** blocks stack deletion. Neither replaces backups or guarantees that all resource-level changes are safe.
  • Changing a replacement-required property, such as a table name, can create a **new physical resource**. Review the change set before updating data stores; retention does not copy data to the replacement.
  • Preserve successfully provisioned resources or disable automatic rollback when diagnosing a failed operation. For **UPDATE_ROLLBACK_FAILED**, inspect stack events, repair the cause and continue rollback before further updates.
  • For **DELETE_FAILED**, inspect remaining dependencies and permissions before retrying or retaining the resource. Stack notifications can publish status events to an SNS topic for the relevant environment.
  • Treat dynamic references as **deployment-time resolution**, not live application subscriptions. Keep runtime-mutated data outside repeatedly enforced template values, or explicitly protect those resources from updates.

SAM, CDK and local testing

  • **AWS SAM** adds serverless shorthand through its CloudFormation Transform. Use **sam build**, package artifacts to S3, then deploy the stack; sam deploy can perform the packaging step.
  • **sam local generate-event** creates sample service events. **sam local invoke** runs a function, **start-api** exposes local API routes, and **start-lambda** exposes a local Lambda invocation endpoint.
  • Local emulation does not prove IAM or live-service integration. Mock dependencies for **unit tests** and deploy isolated infrastructure for **integration tests**; test success and failure paths.
  • Use **samconfig.toml** environments and **--config-env** for repeatable environment settings. **sam sync --watch** accelerates development changes in AWS; retain a controlled deployment process for production.
  • **CDK synth** produces CloudFormation templates; **cdk diff** compares proposed changes and **cdk deploy** applies them. **cdk bootstrap** provisions prerequisite asset resources in an account and Region.
  • Use **CDK assertions** to test generated infrastructure and **Aspects** to inspect constructs for rules. A synthesized template can also support SAM local function testing; shared console test events require suitable IAM permissions.

Lambda versions and progressive delivery

  • A published **version** is an immutable snapshot of code and version-specific configuration. **$LATEST** remains mutable. An **alias** points to a published version and gives callers a stable identifier.
  • A **weighted alias** splits invocations between two versions of the same function. It does not point to another alias or guarantee a stable user cohort; use explicit targeting when selected users must stay on one variation.
  • Publish and test a version, shift traffic through the alias, and **roll back by repointing the alias**. Keep runtime secret retrieval independent of versioned application configuration.
  • In SAM, **AutoPublishAlias** and **DeploymentPreference** enable CodeDeploy traffic shifting. Use pre-traffic and post-traffic hooks plus CloudWatch alarms for validation and rollback.
  • **Canary** shifts a small percentage, waits, then moves the remainder. **Linear** shifts equal increments over time. **All at once** switches immediately; choose exposure and deployment time deliberately.
  • For S3-hosted function code, change the template's **S3Key or S3ObjectVersion** for each release. Replacing bytes at an unchanged location alone does not tell CloudFormation to deploy new code.

API stages and environment isolation

  • A REST API **deployment** is a snapshot; a **stage** points to a deployment. Redeploy after changing resources or methods, even if infrastructure provisioning reports success.
  • Use **stage variables** for backend endpoints or Lambda aliases. A development stage can target a tested version while production keeps its own deployment and alias.
  • Use **API Gateway canary settings** to send a percentage of production requests to a candidate deployment. Use a separate stage or isolated stack for testing that must not touch production users.
  • Separate **data stores, secrets and permissions** by environment. Separate AWS accounts offer stronger isolation; also scope function resource policies so development events cannot invoke production functions.
  • **Amplify Hosting** connects repository branches to web environments and supports build/test settings in amplify.yml. Keep environment configuration distinct from frontend source code and public browser assets.

EC2, CodeDeploy and Elastic Beanstalk

  • **CodeDeploy AppSpec** defines files and lifecycle hooks. For EC2 in-place deployments, key hook order is ApplicationStop, BeforeInstall, AfterInstall, ApplicationStart and ValidateService, with managed download/install events between hooks.
  • EC2 deployments require a functioning **CodeDeploy agent**, instance permissions to retrieve artifacts and the correct **CodeDeploy service role**. Inspect agent logs, hook failures and healthy-instance constraints.
  • **Elastic Beanstalk all at once** is fast but can interrupt service. **Rolling** updates batches with reduced available capacity; **rolling with an additional batch** preserves capacity using temporary extra instances.
  • **Immutable** updates launch a fresh group before replacing old instances. **Traffic splitting** evaluates a percentage on new instances. **Blue/green** uses a separate tested environment and a URL swap for cutover.
  • For a **platform upgrade**, clone into a compatible target platform, deploy and test, then swap environment URLs. Apply persistent configuration through managed settings or .ebextensions instead of manual instance edits.
  • Use **EC2 Image Builder** to bake and validate stable dependencies and patches; deploy changing application code separately to reduce bootstrap time. **run-instances** creates EC2 instances; start-instances resumes stopped instances.

Container definitions and safe promotion

  • Build an image, push it to **ECR**, and deploy a **task definition revision** or updated Kubernetes workload. Use immutable tags or digests so the release references the intended artifact and backend configuration.
  • An ECS **task definition** specifies images, resources, environment variables, secrets, roles, logs and mounts. A **service** maintains running tasks; Fargate runs tasks without managing EC2 container hosts.
  • Use **EFS volumes and mount points** for shared persistent files across supported tasks. Container writable layers and ephemeral storage are not durable shared application stores.
  • Place **image vulnerability scanning after the build and before promotion**. Gate deployment on the chosen findings policy; source analysis and runtime testing assess different security risks.
  • **ECS CodeDeploy blue/green** uses a replacement task set and load-balancer traffic shifting. CloudFormation supports an ECS blue/green transform and hook for applicable deployments.
  • **Capacity provider base and weights** distribute tasks across configured capacity. Fargate Spot can be interrupted and is not an automatic failover reserve; use suitable regular capacity for critical work.

Troubleshooting and Optimization (18%)

CloudWatch logs, metrics and alarms

  • **CloudWatch** collects operational metrics and logs. Install the **CloudWatch agent** for guest memory, additional host metrics and application logs on EC2 or on-premises servers; grant delivery permissions.
  • A **metric filter** converts matching new log events into metrics; it does not backfill historical logs. Use **Logs Insights** to search existing log groups and aggregate application events.
  • Publish business measurements with **PutMetricData** or structured **embedded metric format (EMF)** logs. Choose a namespace and useful dimensions; avoid high-cardinality identifiers as metric dimensions.
  • Use **metric math** for error percentage and throughput. Select the statistic that matches the requirement: Maximum for any slow operation, Sum for counts, and percentiles for latency distributions.
  • **CloudWatch alarms** evaluate metrics over configured periods and notify SNS. Configure missing-data behavior. **High-resolution metrics and alarms** support faster evaluation when ordinary periods are too slow.
  • Logs Insights can calculate **avg, min and max by bin(1m)**, count distinct affected customers by day, or sort Lambda REPORT records by @duration. Add query widgets to dashboards for repeatable analysis.
  • **Lambda Insights** adds execution-environment telemetry through an extension and permissions. **Logs Insights** queries logs. Associate a KMS key with a log group for newly ingested encrypted data and retain keys needed for historical reads.

Distributed tracing and audit evidence

  • **X-Ray traces** connect a request across services. Segments describe services and subsegments describe downstream calls; use the service map and latency distributions to locate slow dependencies.
  • Enable tracing and **instrument application clients and HTTP calls**, using X-Ray-compatible or OpenTelemetry instrumentation. Active tracing alone cannot supply every internal application subsegment.
  • In an **X-Ray SDK and daemon** setup, the SDK creates trace data and the daemon forwards it. EC2 or on-premises hosts need credentials and network access; container workloads can use an appropriate sidecar collector.
  • Propagate **trace context** across service boundaries. **Annotations** are indexed for filter expressions; **metadata** holds additional unindexed details. Use sampling rules to retain important traffic without tracing every health check.
  • **CloudTrail** records AWS API activity and caller identity, such as DeleteDBInstance. **AWS Config** evaluates configuration and compliance. Neither replaces application logs or request tracing.
  • Use **VPC Flow Logs** for accepted or rejected network flows and **ALB access logs** for HTTP routing and status evidence. Flow logs do not capture request bodies or prove that an application processed a request.

Lambda performance and private connectivity

  • Increasing **Lambda memory** also increases available CPU. Measure duration and cost for CPU-bound work; increasing timeout permits more time but does not make code faster.
  • **Reserved concurrency** reserves and caps concurrent executions. **Provisioned concurrency** preinitializes environments for a published version or alias to reduce cold-start latency; it is not a downstream rate limiter.
  • Reduce cold initialization by packaging only needed **SDK modules and dependencies** and reusing clients. Monitor Duration, Errors, Throttles, ConcurrentExecutions and memory usage together.
  • For private databases, configure **VPC subnets, routes and security groups** for Lambda and the required ENI permissions. Allow database ingress from the function's security group on the database port.
  • A VPC-connected Lambda receives **no public IP** merely by selecting a public subnet. Use NAT routing for IPv4 internet APIs and appropriate VPC endpoints for supported AWS services.
  • Use **RDS Proxy** to pool and reuse database connections under Lambda bursts. Network reachability, database credentials and authorization remain required; a proxy alone does not connect an isolated function to a private database.
  • For long work, separate **API response deadlines** from job duration. Start a queued job or workflow and return an identifier; tune worker timeouts and concurrency rather than holding the client request open.

Database capacity and cache freshness

  • For DynamoDB throttling, inspect **consumed capacity, hot keys and index capacity**. On-demand mode or autoscaling helps capacity changes; uneven partition traffic can still require a better key design or write sharding.
  • **DAX** accelerates suitable DynamoDB reads through an in-memory cache. It does not cache RDS or remove write-capacity limits. Strong reads bypass its cache; writes outside DAX can leave cached values stale until expiry.
  • **ElastiCache** caches application data and sessions. Redis-compatible engines provide structures such as sorted sets and replication; Memcached provides a simple multithreaded cache. Choose encryption and availability settings deliberately.
  • **Lazy loading** fills on a cache miss. **Write-through** updates the cache on writes; **TTL** bounds cache age. Handle deletes and all writers, and invalidate or refresh cached data when the authoritative record changes.
  • **RDS read replicas** serve read traffic; a traditional Multi-AZ standby primarily supplies availability. Route queries to the appropriate endpoints and preserve read-after-write consistency where required.
  • **Aurora reader endpoints** distribute new connections, not individual SQL statements. Long-lived pools and cached DNS can concentrate load; review connection reuse, endpoint choice and DNS behavior.

API and CloudFront optimization

  • Compare API Gateway **Latency** with **IntegrationLatency** to separate total response time from backend time. Enable stage access and execution logs where supported, with safe handling of sensitive request data.
  • **API Gateway caching** reduces repeated backend work. Configure method overrides for methods such as POST, and include every response-varying parameter in the cache key to prevent incorrect or cross-user responses.
  • Authorized clients can invalidate a REST API cache entry with **Cache-Control: max-age=0** when granted execute-api:InvalidateCache. **API keys and usage plans** meter usage; they are not user authentication or a guaranteed hard spending cap.
  • **CloudFront** caches near viewers. Use versioned asset names or invalidate changed paths after deployment; changing an S3 object does not immediately purge cached copies.
  • Include relevant **query parameters, language or country signals** in cache and origin-request policies for personalized variants. Forward only needed values to balance correctness and cache efficiency.
  • For a private S3 REST origin, a CloudFront **default root object** does not rewrite every directory path. A viewer-request function can append index.html for nested directory requests.
  • An ALB passes client-address information in **X-Forwarded-For**. Parse it using a trusted-proxy policy; a supplied header value alone is not trustworthy proof of the client's identity.
  • **CloudFront Functions** handles lightweight viewer-request rewrites. **Lambda@Edge** supports richer edge processing; deploy its published function version in us-east-1 and associate it with the required distribution event.

Backlogs, rate limits and failure diagnosis

  • Rising **Kinesis IteratorAge** indicates processing lag. Inspect function duration, failures, shard distribution and consumer throughput; tune memory, parallelism or shard capacity according to the bottleneck.
  • Use **SQS queue age, visible backlog and DLQ messages** to distinguish insufficient workers from poison records. Match concurrency to downstream capacity; increasing workers can worsen a throttled dependency.
  • A concurrency cap limits **simultaneous work**, not exact calls per minute. Respect external API quotas and Retry-After guidance; use pacing, durable waits or token-based rate control when required.
  • For **AccessDenied**, identify the caller and inspect action, ARN, conditions, explicit denies and key permissions. For a **connection timeout**, inspect DNS, routes, security groups, network ACLs and endpoint reachability.
  • For **deployment failures**, inspect the first failed pipeline action, stack event or deployment hook. Confirm the referenced artifact version, role permissions and runtime configuration before rebuilding unrelated components.
  • For **SNS delivery**, compare published, delivered and failed-notification metrics and supported delivery logs. Successful publishing does not prove that every subscriber completed its business processing.