AWS Certified Developer – Associate (DVA-C02)DeploymentHard

A company is performing a blue/green deployment of a new application version to an Amazon ECS service using AWS CodeDeploy. They want to shift traffic to the new task set in stages: 10% for 5 minutes, then 50% for 10 minutes, and finally 100%. During these stages, they need to run automated integration tests to ensure the new version is healthy before proceeding to the next traffic shift. How can this be effectively configured?

  1. AConfigure a CodeDeploy Canary deployment strategy with a single AfterAllowTraffic hook.
  2. BDefine a custom CodeDeploy Linear deployment strategy with multiple traffic shift steps and integrate Lambda functions as hooks (e.g., AfterAllowTraffic) to run tests after each shift.
  3. CImplement a CodeDeploy AllAtOnce deployment and manually shift traffic using an Application Load Balancer.
  4. DUse a CodeDeploy Linear deployment strategy with a single PreTraffic hook to run all tests.
Show answer & explanation

Correct answer: B. Define a custom CodeDeploy Linear deployment strategy with multiple traffic shift steps and integrate Lambda functions as hooks (e.g., AfterAllowTraffic) to run tests after each shift.

CodeDeploy's Linear deployment strategies allow for traffic to be shifted in specified percentages over defined intervals. By defining a custom Linear strategy with multiple steps (e.g., 10%, 50%, 100%), and integrating Lambda functions as AfterAllowTraffic hooks, automated tests can be executed after each incremental traffic shift. This approach ensures the new version is validated at each stage before full traffic cutover.

Why the other options are wrong

  • A. While Canary deployments shift traffic in stages, AfterAllowTraffic is a single hook that runs after the *final* traffic shift in a Canary deployment strategy, or after *each* step in a custom linear strategy. However, the specific requirement for 10% then 50% points more towards a custom linear strategy with multiple steps rather than a standard Canary.
  • C. AllAtOnce shifts 100% traffic immediately and doesn't support staged traffic shifts or automated testing between stages within CodeDeploy itself.
  • D. A single PreTraffic hook runs before any traffic shift. The requirement is to run tests *after* each staged traffic shift, which necessitates hooks after traffic shifts.

CodeDeploy Custom Linear Deployments with Hooks

A CodeDeploy feature for ECS blue/green deployments that allows defining custom traffic shifting percentages and intervals, combined with lifecycle hooks (e.g., AfterAllowTraffic Lambda functions) to run validation tests after each staged traffic shift.

  • Customizable traffic shifting percentages and intervals.
  • Uses Lambda hooks for validation after each shift.
  • Ensures gradual rollout and validation at each stage.
  • Supported for ECS blue/green deployments.

Memory trick: Linear shifts, with hooks, for validation's looks.

More Deployment questions