DVA-C02 domain - 24% of the exam

Deployment

Deployment is 24% of the DVA-C02 exam. These are the objectives it covers, each with practice questions, with every answer explained.

The domain in numbers

87
Practice questions
8
Objectives
66
Medium
21
Hard

Where people go wrong

  • Stretching the zip package limit

    The wrong answers treat the zip format as if a bigger upload route or more layers could stretch its limit. A direct upload is capped at 50 MB, staging in S3 raises only that upload ceiling, and layers share the 250 MB unzipped budget with the function code, at most five per function. Only a container image pushed to Amazon ECR, which supports artifacts up to 10 GB, holds a 4 GB dependency set.

    See it in a sample question
  • Pointing a stable role at $LATEST

    The wrong answers hand a stable job to $LATEST, the mutable draft. Callers pinned to it run in-progress code, a weighted alias cannot send any share of traffic to it, and provisioned concurrency cannot be set on it. Each of these needs a published version, or an alias that resolves to one. An alias then gives callers a single ARN that is repointed after each deployment.

    See it in a sample question
  • Mixing up canary, linear and all-at-once shifting

    The wrong answers swap the shapes of the CodeDeploy traffic-shifting configurations. All-at-once moves every request in one step, and linear moves equal increments on a repeating interval. Neither holds a single small slice while an alarm is watched. A canary configuration such as Canary10Percent5Minutes sends a small first slice, waits through the bake time, then shifts the remainder in one step, and the alarm can trigger rollback.

    See it in a sample question
  • Placing validation at the wrong lifecycle hook

    The wrong answers attach validation to a hook that runs at the wrong moment. AfterAllowTraffic runs once traffic already flows, AfterInstall runs before the application is started, and BeforeInstall runs before the new code is copied. ApplicationStop and ApplicationStart are EC2 events that Lambda does not use. ValidateService gates an EC2 instance before traffic returns, and BeforeAllowTraffic gates ECS and Lambda releases before any traffic shifts.

    See it in a sample question
  • Giving stage variables a deployment's job

    The wrong answers reach for a stage setting to do a deployment's work. Stage variables pass values into integrations, so they cannot publish edited methods, select which deployment a stage serves, or route a hostname. Flushing a cache publishes nothing. A deployment is the immutable snapshot a stage serves: create one to publish edits, repoint the stage to an earlier one to roll back, and add an API mapping on the custom domain to reach a stage.

    See it in a sample question

Objectives in this domain

What to study

The official documents this domain's practice questions cite most.

Sample questions from this domain

Free sampleDeploymentmedium

A developer is assembling a Lambda function that already attaches four layers for shared utilities. They want to add a fifth layer for a new dependency and are reviewing the constraints before publishing. Which constraint must the developer respect when attaching layers to this single function?

  • AA function may attach an unlimited number of layers as long as each individual layer stays under 50 MB zipped, since the per-layer cap is what Lambda enforces.
  • BA function may attach at most five layers, and the unzipped size of the function code plus all attached layers must stay within 250 MB. Correct
  • CA function may attach at most ten layers, and only the function code counts toward the 250 MB unzipped limit while layer contents are excluded from it.
  • DA function may attach at most five layers, and each layer is measured against its own separate 250 MB unzipped limit independent of the function code size.
A Lambda function can attach up to five layers, and code plus layers must total no more than 250 MB unzipped. Lambda caps the number of layers attached to a function at five. The unzipped size of the function code together with all attached layers shares a single 250 MB budget in the execution environment, so adding a layer must keep the combined total within that ceiling.

Why A is wrong: The 50 MB figure describes direct console zip upload rather than a per-layer cap, and Lambda enforces a hard limit of five layers per function, so unlimited layers is wrong.

Why B is correct: Lambda allows up to five layers per function, and the combined unzipped size of the function code and all attached layers is limited to 250 MB, so both limits apply to the fifth layer.

Why C is wrong: The limit is five layers rather than ten, and layer contents do count toward the 250 MB unzipped total, so excluding them understates the real constraint.

Why D is wrong: The five-layer count is right, but the 250 MB unzipped limit is a single combined budget for code and layers together, not a separate allowance for each layer.

Free sampleDeploymentmedium

An Amazon API Gateway integration and an Amazon EventBridge rule both invoke a Lambda function. Each time the developer publishes a new function version, the version number changes, and the team does not want to update the integration target on every release. They need a single stable invocation target that they can repoint to a new version after each deployment. Which approach should the developer use?

  • AConfigure both the API Gateway integration and the EventBridge rule to call the function by its $LATEST qualifier so they always reach the newest code.
  • BCreate a Lambda alias such as prod, point both the API Gateway integration and the EventBridge rule at the alias ARN, and update the alias to the new version after each deployment. Correct
  • CHave each integration invoke the function by its fully qualified version ARN and write a deployment script that rewrites both ARNs after every publish.
  • DPoint both the API Gateway integration and the EventBridge rule at an unqualified function reference so Lambda resolves to whichever version is newest.
Use a Lambda alias as a stable invocation target so callers stay decoupled from changing version numbers across deployments. A Lambda alias is a named pointer to a specific published version that callers invoke by a fixed ARN, so updating the alias to a new version repoints every caller at once, which lets API Gateway and EventBridge reference one stable target while the underlying version changes each release.

Why A is wrong: $LATEST refers to the mutable draft rather than a published version, so callers would run untested in-progress code and the requirement is a stable, controllable target, not the latest draft.

Why B is correct: An alias is a stable named pointer to a published version, so callers target the alias ARN once and a single alias update repoints all of them to the new version without touching the integrations.

Why C is wrong: Pinning each caller to a version ARN works but forces the script to update every integration on each release, which is exactly the per-deployment churn the team wants to avoid.

Why D is wrong: An unqualified reference resolves to $LATEST, meaning callers hit the unpublished draft, so it gives neither an immutable target nor controlled promotion between versions.

Free sampleDeploymentmedium

A team deploys a Lambda function with AWS SAM and wants each release to shift production traffic gradually onto the new version, sending ten percent of invocations to it for ten minutes and then the remainder if a CloudWatch alarm on function errors stays healthy, rolling back automatically if the alarm fires. They want SAM to wire up the version, the alias, and the underlying traffic-shifting mechanism from the template rather than scripting it themselves. Which addition to the AWS::Serverless::Function resource achieves this?

  • AAdd a DeploymentPreference property of type Canary10Percent10Minutes with the error alarm listed under Alarms, letting SAM provision the CodeDeploy resources that shift alias traffic. Correct
  • BAdd a DeploymentPreference property of type Linear10PercentEvery10Minutes with the error alarm listed under Alarms, letting SAM provision the CodeDeploy resources that shift alias traffic.
  • CAdd a ProvisionedConcurrencyConfig property to the function so the new version warms ten percent of environments before production traffic is shifted onto it.
  • DAdd a ReservedConcurrentExecutions property set to ten so the new version receives only ten percent of the function's invocations during the rollout window.
Use the SAM DeploymentPreference property with a canary type and an alarm to let SAM generate CodeDeploy-based gradual traffic shifting for a Lambda function. DeploymentPreference on AWS::Serverless::Function instructs SAM to create the CodeDeploy application, deployment group, alias, and version, and to shift alias traffic on the chosen schedule; a Canary type holds a fixed percentage for one interval then shifts the rest, and any listed CloudWatch alarm entering ALARM triggers an automatic rollback.

Why A is correct: A canary preference sends a fixed ten-percent slice for ten minutes then shifts the rest, and SAM generates the AutoPublishAlias version, CodeDeploy application, and alarm-driven rollback automatically from this one property.

Why B is wrong: A linear preference shifts equal increments on a repeating timer rather than a fixed ten-percent canary slice held for one interval, so it does not match the single ten-percent-for-ten-minutes pattern described.

Why C is wrong: Provisioned concurrency controls how many environments stay initialised to reduce cold starts, it has nothing to do with splitting traffic between versions or rolling back on an alarm.

Why D is wrong: Reserved concurrency caps how many simultaneous executions a function may run, it does not route a percentage of traffic to a specific version nor trigger alarm-based rollback.

Free sampleDeploymenthard

A developer deploys to a fleet of Amazon EC2 instances using AWS CodeDeploy with an in-place deployment. The release must run a script that checks the application is serving healthy responses on each instance after the new code is installed but before that instance is returned to the load balancer rotation. In which AppSpec lifecycle hook should the validation script run to gate the instance before traffic returns?

  • AReference the validation script under the ValidateService hook in the AppSpec file so it runs after the new revision is installed and gates the instance before traffic is allowed back. Correct
  • BReference the validation script under the AfterInstall hook in the AppSpec file so it checks the running application once the new files are copied onto the instance.
  • CReference the validation script under the AfterAllowTraffic hook in the AppSpec file so it confirms the application is healthy on the instance immediately after traffic is restored.
  • DReference the validation script under the BeforeInstall hook in the AppSpec file so it verifies application health on the instance before the new revision is deployed.
Place a health-check script in the ValidateService AppSpec hook so CodeDeploy gates an in-place EC2 instance before returning it to load balancer traffic. CodeDeploy runs in-place EC2 hooks in a fixed order, and ValidateService executes after ApplicationStart but before AllowTraffic on each instance, so a script that fails there stops that instance from being returned to the load balancer and fails the deployment, exactly the gate the requirement describes.

Why A is correct: ValidateService runs after the application starts and before AllowTraffic on each instance, so a health check there gates the instance and fails the deployment when the new revision is not serving correctly.

Why B is wrong: AfterInstall runs before the application is started and before traffic decisions, so it can adjust files but cannot reliably verify the application is serving healthy responses to gate the instance.

Why C is wrong: AfterAllowTraffic runs only after the instance is already back in rotation, so a failure there means users may have hit the new code before the gate, which violates the before-traffic requirement.

Why D is wrong: BeforeInstall runs before the new code is even copied, so it can only inspect the old revision and cannot confirm the new application is healthy ahead of returning the instance to traffic.

Free sampleDeploymentmedium

A developer edited methods and integrations on an Amazon API Gateway REST API in the console, but calls to the existing invoke URL still return the previous behaviour. The developer confirms the edits are saved on the resources. What must happen for the changes to become available to clients on a stage?

  • AToggle the stage cache off and on again, because the stage cache is serving the prior response and dropping it forces clients onto the latest saved resources.
  • BUpdate a stage variable on the stage, since changing any stage variable causes API Gateway to recompile the current resource definitions onto that stage automatically.
  • CCreate a new deployment of the API and associate it with the stage, since a deployment is the immutable snapshot that a stage serves to clients. Correct
  • DRedeploy the underlying Lambda function so the new function version forces API Gateway to refresh the stage with the latest method and integration edits.
Recognise that API Gateway resource edits go live only after a new deployment is created and associated with a stage. In API Gateway a stage serves an immutable deployment snapshot, so any change to methods, integrations or models stays invisible to callers until a fresh deployment is created and the stage is pointed at it, regardless of cache state or stage variables.

Why A is wrong: Flushing a cache only clears stored responses for an already deployed configuration and does nothing to publish unsaved resource edits to the stage.

Why B is wrong: Stage variables pass runtime values to integrations and do not trigger a deployment, so changing one cannot publish edited methods to the stage.

Why C is correct: Edits to resources are not live until a deployment captures them and the stage points at that snapshot, so creating and deploying to the stage is what exposes the changes.

Why D is wrong: Publishing a Lambda version changes the backend code only, while the API Gateway method and integration edits still sit unpublished until an API deployment captures them.

Other domains in this exam

See also the DVA-C02 cert hub, the study guide, and the cheat sheet.

Examworthy is not affiliated with or endorsed by Amazon Web Services. Original, blueprint-aligned practice material only.