Skip to content

DVA-C03 · Domain 3: Testing and Deployment · 22% of the exam

Task 3.3: Deploy code by using AWS continuous integration and continuous delivery (CI/CD) services.

Releasing through a pipeline: Lambda packaging methods, container deployments on ECS, EKS and Fargate, CloudFormation and SAM templates, CodeDeploy, CodePipeline across environments, blue/green, canary and rolling strategies with automatic or manual rollback, branches and tags, and AI tools that support the pipeline.

Study it

  • Packaging: dependencies, .zip archives, layers and container images

    Partly covered by: Images, Layers & Multi-Stage Builds

  • CloudFormation, SAM and CDK templates, change sets and updates

    Lesson coming

  • Pipelines: CodePipeline, CodeBuild buildspec and CodeDeploy appspec

    Lesson coming

  • Deployment strategies and rollbacks: rolling, blue/green, canary and linear

    Partly covered by: Scheduling & Rolling Updates

  • Container deployments: ECS task definitions, EKS manifests and Fargate

    Partly covered by: ECS vs EKS vs Fargate, Pods, ReplicaSets & Deployments

  • Elastic Beanstalk and Amplify deployments, and AI tools in the pipeline

    Lesson coming

Sample questions

Try each one before opening the answer. Every option is explained, with the AWS documentation page that proves it.

Question 1 · choose 1

An AWS Elastic Beanstalk environment runs six instances behind a load balancer. For the next application version, the environment must keep full capacity during the deployment, the instances that run the current version must not be modified, and if the new version fails its health checks, rolling back must only mean terminating the new instances. The environment URL must not change. Which deployment policy should the developer choose?

  1. AAll at once
  2. BRolling with additional batch
  3. CBlue/green, with a CNAME swap to a cloned environment
  4. DImmutable
Show the answer and why
  • AAll at once

    Incorrect

    All at once deploys to every instance at the same time, and all instances are out of service for a short time.

  • BRolling with additional batch

    Incorrect

    This keeps full capacity, but it updates the existing instances batch by batch, which can leave a partially completed rolling deployment when the new version fails.

  • CBlue/green, with a CNAME swap to a cloned environment

    Incorrect

    Blue/green deploys to a separate environment and then swaps the environment URLs, which the requirement rules out.

  • DImmutable

    Correct

    An immutable deployment launches a full set of new instances in a separate Auto Scaling group alongside the old ones. If it fails, rollback only terminates the new instances.

Immutable deployments never touch the running instances: new ones are added, checked, and either kept or terminated.

Question 2 · choose 1

A V2 pipeline in AWS CodePipeline uses a GitHub repository as its source through a connection, and it starts on every push to the main branch. The team wants a separate production pipeline that starts only when a release tag such as v2.3.0 is pushed, and never for ordinary commits. What should the developer configure on the production pipeline?

  1. AThe source action's BranchName set to a branch named release
  2. BA manual approval action in front of the production deploy stage
  3. CA push trigger with a Git tag filter that includes v*
  4. DA pull request trigger filtered on the main branch
Show the answer and why
  • AThe source action's BranchName set to a branch named release

    Incorrect

    BranchName defines a single branch, so every ordinary commit pushed to that branch would still start the pipeline.

  • BA manual approval action in front of the production deploy stage

    Incorrect

    An approval action stops a running execution until someone approves or rejects it. The pipeline would still start for every commit.

  • CA push trigger with a Git tag filter that includes v*

    Correct

    Push triggers can be filtered on Git tags, so the pipeline starts only when a matching tag is pushed.

  • DA pull request trigger filtered on the main branch

    Incorrect

    Pull request triggers react to pull requests being opened, updated or closed, and they filter on branches and file paths, not tags.

V2 pipelines support trigger filters on branches, file paths and Git tags, which is how tags drive release pipelines.

Question 3 · choose 2

An AWS SAM template defines an AWS Lambda function that already has AutoPublishAlias set to live. For each release, 10 percent of traffic should move to the new version first and the remaining 90 percent ten minutes later. If the function's error alarm goes off during the shift, traffic must return to the previous version automatically. Which TWO settings should the developer add to the function? (Choose TWO.)

  1. AA DeploymentPreference with Type set to Linear10PercentEvery10Minutes
  2. BA DeploymentPreference with Type set to Canary10Percent10Minutes
  3. CDeploymentPreference Alarms that list the function's error alarm
  4. DA ProvisionedConcurrencyConfig for the live alias
  5. ERemoval of AutoPublishAlias so that traffic goes straight to $LATEST
Show the answer and why
  • AA DeploymentPreference with Type set to Linear10PercentEvery10Minutes

    Incorrect

    A linear configuration shifts 10 percent every 10 minutes until all traffic has moved, which takes far longer than one ten-minute step.

  • BA DeploymentPreference with Type set to Canary10Percent10Minutes

    Correct

    This canary configuration shifts 10 percent of traffic first and the remaining 90 percent ten minutes later.

  • CDeploymentPreference Alarms that list the function's error alarm

    Correct

    CodeDeploy watches the listed CloudWatch alarms during the deployment and rolls back automatically if one of them is triggered.

  • DA ProvisionedConcurrencyConfig for the live alias

    Incorrect

    Provisioned concurrency keeps execution environments initialized. It does not control how traffic moves between versions.

  • ERemoval of AutoPublishAlias so that traffic goes straight to $LATEST

    Incorrect

    AWS SAM gradual deployments shift traffic on the alias that AutoPublishAlias creates and points at each new version, so removing it works against the requirement.

In AWS SAM, AutoPublishAlias plus DeploymentPreference (type, alarms, optional hooks) hands traffic shifting and rollback to CodeDeploy.

Question 4 · choose 1

A developer changes the TableName property of an AWS::DynamoDB::Table in an AWS CloudFormation template. A change set shows that the update will replace the table. The team wants to go ahead with the update, but the existing table and its data must be kept in the account instead of being deleted when CloudFormation replaces it. What should the developer add to the table resource before executing the change set?

  1. ADeletionPolicy set to Retain
  2. BTermination protection turned on for the stack
  3. CA stack policy that denies Update:Replace on the table
  4. DUpdateReplacePolicy set to Retain
Show the answer and why
  • ADeletionPolicy set to Retain

    Incorrect

    DeletionPolicy applies when a resource is deleted from the stack, for example when it is removed from the template. It does not apply to a resource that is replaced during an update.

  • BTermination protection turned on for the stack

    Incorrect

    Termination protection only blocks deleting the stack. It does not keep a resource that an update replaces.

  • CA stack policy that denies Update:Replace on the table

    Incorrect

    A stack policy prevents the replacement from happening at all, so the update the team wants could not go ahead.

  • DUpdateReplacePolicy set to Retain

    Correct

    UpdateReplacePolicy keeps (or, in some cases, backs up) the existing physical resource when an update replaces it, so the old table stays in the account.

DeletionPolicy covers deletion from the stack; UpdateReplacePolicy covers replacement during an update. Changing TableName requires replacement.

Question 5 · choose 1

AWS CodeDeploy shifts traffic to new versions of an AWS Lambda function. After all traffic has moved to the new version, the team wants an automated smoke test function to run end-to-end checks, and a failure must roll the deployment back. Which AppSpec hook should run the test function?

  1. ABeforeInstall
  2. BBeforeAllowTraffic
  3. CAfterAllowTraffic
  4. DValidateService
Show the answer and why
  • ABeforeInstall

    Incorrect

    BeforeInstall is a hook for EC2, on-premises and Amazon ECS deployments, not for Lambda version deployments.

  • BBeforeAllowTraffic

    Incorrect

    BeforeAllowTraffic runs before traffic is shifted, not after the new version serves all traffic.

  • CAfterAllowTraffic

    Correct

    AfterAllowTraffic runs after all traffic is shifted to the new version, and a failing hook function can trigger a rollback.

  • DValidateService

    Incorrect

    ValidateService belongs to EC2 and on-premises deployments; Lambda deployments use the AllowTraffic hooks.

Lambda deployments with CodeDeploy have two hooks: BeforeAllowTraffic and AfterAllowTraffic.

Question 6 · choose 1

In an AWS CodePipeline V2 pipeline, the Deploy stage is followed by automated tests in the same stage. When the tests fail, the team wants the stage to go back automatically to the last execution that succeeded in it, instead of someone redeploying by hand. What should the developer configure?

  1. AAutomatic rollback on failure for the stage
  2. BThe PARALLEL execution mode for the pipeline
  3. CA manual approval action after the tests
  4. DA retry of the failed stage after each failure
Show the answer and why
  • AAutomatic rollback on failure for the stage

    Correct

    A stage can be preconfigured to roll back on failure to an execution that succeeded in that stage.

  • BThe PARALLEL execution mode for the pipeline

    Incorrect

    In PARALLEL mode stage rollback is not available, so this works against the goal.

  • CA manual approval action after the tests

    Incorrect

    An approval waits for a person and does not roll anything back.

  • DA retry of the failed stage after each failure

    Incorrect

    A retry runs the same failing revision again; it does not return to the last good one.

CodePipeline stage rollback returns a stage to a previously successful execution, automatically on failure if configured.

Question 7 · choose 1

A small team deploys AWS Lambda functions with the AWS CLI and no deployment service. For the next release, it wants 5 percent of production invocations to go to the new version while it watches metrics, with a quick way to move all traffic back. What should the developer do?

  1. APoint the prod alias at the new version and keep the old version's ARN
  2. BConfigure the prod alias with weighted routing between the two versions
  3. CSet reserved concurrency of 5 on the new version
  4. DCreate a second function and call it from the first in 5 percent of requests
Show the answer and why
  • APoint the prod alias at the new version and keep the old version's ARN

    Incorrect

    This sends all traffic to the new version at once, not 5 percent.

  • BConfigure the prod alias with weighted routing between the two versions

    Correct

    A weighted alias splits traffic between two versions, so a small share can test the new version and be rolled back quickly.

  • CSet reserved concurrency of 5 on the new version

    Incorrect

    Reserved concurrency is set on the function, not per version, and does not split traffic by percentage.

  • DCreate a second function and call it from the first in 5 percent of requests

    Incorrect

    Hand-written routing in code duplicates what alias routing provides.

Weighted aliases give simple canary releases for Lambda without extra services.

Question 8 · choose 1

A team releases a web application on AWS Elastic Beanstalk. For the next version, it wants a canary release: a small share of client traffic should go to new instances running the new version for a period of time, with the rest on the current version, before the release completes. Which deployment policy fits?

  1. ATraffic splitting
  2. BAll at once
  3. CRolling
  4. DRolling with additional batch
Show the answer and why
  • ATraffic splitting

    Correct

    Traffic splitting sends a percentage of client traffic to new instances for an evaluation period before completing the deployment.

  • BAll at once

    Incorrect

    All instances switch at the same time, with no canary period.

  • CRolling

    Incorrect

    Rolling updates existing instances batch by batch; it does not send a set share of traffic to new instances for a test period.

  • DRolling with additional batch

    Incorrect

    This keeps full capacity during a rolling update but does not split traffic by percentage.

Elastic Beanstalk traffic splitting provides canary testing as part of a deployment.

Question 9 · choose 1

Developers push to a repository several times an hour. In the team's AWS CodePipeline V2 pipeline, newer executions overtake older ones, so some commits are never deployed on their own, which breaks the team's audit process. Every commit must go through the pipeline, one execution at a time and in order. What should the developer configure?

  1. AThe SUPERSEDED execution mode
  2. BThe PARALLEL execution mode
  3. CA manual approval action at the start of each stage
  4. DThe QUEUED execution mode
Show the answer and why
  • AThe SUPERSEDED execution mode

    Incorrect

    In SUPERSEDED mode, the default, a more recent execution can overtake an older one, which is the current problem.

  • BThe PARALLEL execution mode

    Incorrect

    PARALLEL runs executions at the same time and independently, not one at a time in order.

  • CA manual approval action at the start of each stage

    Incorrect

    Approvals pause executions for people; they do not change how executions are ordered.

  • DThe QUEUED execution mode

    Correct

    In QUEUED mode, executions are processed one by one in the order they are queued; it requires a V2 pipeline.

CodePipeline execution modes control whether executions are superseded, queued or run in parallel.

Question 10 · choose 1

A pipeline in AWS CodePipeline in account A must deploy, through AWS CodeDeploy, to EC2 instances in account B. The pipeline's artifact bucket uses the pipeline's default encryption key. The deploy action in account B cannot read the artifacts. What should the developer change about the artifact encryption?

  1. ATurn off encryption for the artifact bucket
  2. BCopy the artifacts into a bucket in account B with a script after each build
  3. CUse a customer managed KMS key that account B may use
  4. DTurn on automatic rotation of the default key
Show the answer and why
  • ATurn off encryption for the artifact bucket

    Incorrect

    Removing encryption weakens security and is not the documented way to share artifacts across accounts.

  • BCopy the artifacts into a bucket in account B with a script after each build

    Incorrect

    A copy step adds work outside the pipeline; the documented approach shares the artifacts through a key both accounts can use.

  • CUse a customer managed KMS key that account B may use

    Correct

    Cross-account pipelines use a customer managed KMS key in place of the default key, with permissions for the other account to use it.

  • DTurn on automatic rotation of the default key

    Incorrect

    Rotation does not change who may use the key.

For cross-account deployments, encrypt pipeline artifacts with a customer managed key that the target account is allowed to use.

Practice domain 3 →Practice all domains →