A team deploys a Lambda function with AWS SAM, with AutoPublishAlias set to live.
For each release, 10% of invocations should shift to the new version first, and all remaining traffic should move to it 10 minutes later. The new version must pass a smoke-test Lambda function before any traffic shifts. If an error alarm enters the ALARM state during the deployment, traffic must roll back automatically.
Which DeploymentPreference meets these requirements?
Choose one answer.
AA. Type: Linear10PercentEvery1Minute, with the error alarm under Alarms and the smoke test under Hooks PreTraffic.
BB. Type: Canary10Percent10Minutes, with the error alarm under Alarms and the smoke test under Hooks PreTraffic.
CC. Type: Canary10Percent5Minutes, with the error alarm under Alarms and the smoke test under Hooks PostTraffic.
DD. Type: AllAtOnce, with the smoke test under Hooks PreTraffic and the error alarm under Alarms.
Show the answer and explanation
Answer: B
A. Wrong: Linear shifts traffic in equal increments, here 10% every minute. It does not move 10% first and then everything after 10 minutes, so the timing is wrong.
C. Wrong: This uses a 5-minute interval instead of 10. A PostTraffic hook runs after traffic has already shifted, so it cannot keep the new version from receiving traffic.
D. Wrong: AllAtOnce sends every request to the new version at once. It skips the 10% canary stage and the 10-minute wait the team requires.
Explanation
SAM's DeploymentPreference uses CodeDeploy to shift traffic between alias versions. A canary type shifts a percentage first and the remainder after an interval, a PreTraffic hook validates the new version before any shift, and CloudWatch alarms listed under Alarms trigger an automatic rollback.
SAM shifts 10 percent of traffic to the new version for 10 minutes after the PreTraffic smoke test, and the alarm can roll it back.
Want more on Deployment strategies and rollbacks? The 5 full-length practice sets have 11 more Deployment strategies and rollbacks questions, 390 in all, none of them in the free exam. One payment of $14.99, no subscription. See the practice sets →