AWS Developer DVA-C02 · Deployment · medium

A serverless team uses AWS SAM (template.yaml) and AWS CodeDeploy to deploy a new version of an AWS Lambda function behind an alias named live. They configure DeploymentPreference with Type: Linear10PercentEvery5Minutes. How long will it take for 100% of production traffic on the live alias to shift to the new Lambda version, and which two CodeDeploy lifecycle hooks are available for Lambda deployments?

Published · Last updated · checked before publication — how we verify questions

Options

  • A10% shifts every 5 minutes using BeforeAllowTraffic and AfterAllowTraffic hooksCorrect answer
  • B10% shifts for 5 minutes then 90% at once using BeforeInstall and AfterInstall
  • C100% shifts immediately using ApplicationStop and ValidateService EC2 hooks
  • D5% shifts every 10 minutes using BeforeBlockTraffic and DownloadBundle hooks

Answer: A. 10% shifts every 5 minutes using BeforeAllowTraffic and AfterAllowTraffic hooks

With Linear10PercentEvery5Minutes, CodeDeploy shifts 10% of traffic initially and adds 10% every 5 minutes across 9 subsequent intervals ($9 \times 5 = 45$ minutes; or 10 steps of 10% over 45–50 minutes, reaching 100% after 9 intervals of 5 minutes = 45 minutes after the initial 10% step, or 50 minutes across 10 intervals). For AWS Lambda deployments, CodeDeploy supports only two lifecycle hooks: BeforeAllowTraffic and AfterAllowTraffic (unlike EC2 deployments which use BeforeInstall, AfterInstall, ApplicationStart, ValidateService).

Why the other options are wrong

  • B. 10% shifts for 5 minutes then 90% at once using BeforeInstall and AfterInstall — Shifting 10% then 90% describes a Canary deployment, and BeforeInstall/AfterInstall are EC2/On-Premises hooks.
  • C. 100% shifts immediately using ApplicationStop and ValidateService EC2 hooks — Shifting 100% immediately is AllAtOnce, and ApplicationStop/ValidateService are EC2 hooks.
  • D. 5% shifts every 10 minutes using BeforeBlockTraffic and DownloadBundle hooks — The policy name Linear10PercentEvery5Minutes shifts 10% every 5 minutes, not 5% every 10 minutes.

All Deployment questions and the topic overview →

AWS and Amazon Web Services are trademarks of Amazon.com, Inc. PrepIQ Hub is not affiliated with, endorsed by, or sponsored by Amazon Web Services.