A serverless application uses CloudFront, API Gateway, and Lambda. Deployments are currently done by creating a new Lambda version and running a CLI script to update. If the new version has errors, another CLI script redeploys the previous version. The company wants faster deployments and quicker detection and rollback when errors occur. Which approach accomplishes this?
Choose an answer
Tap an option to check your answer.
Correct answer: Use AWS SAM and the Lambda deployment integration with AWS CodeDeploy to deploy a new Lambda version, shift traffic gradually to the new version, and run pre-traffic and post-traffic test hooks. Roll back automatically if CloudWatch alarms are triggered..
Why this is the answer
AWS SAM (Serverless Application Model) simplifies serverless deployments and integrates seamlessly with AWS CodeDeploy for Lambda. This integration allows for canary or linear traffic shifting, gradually moving traffic to the new Lambda version. Pre-traffic and post-traffic hooks enable automated testing before and after traffic shifts. Crucially, CodeDeploy can automatically roll back to the previous stable version if CloudWatch alarms (e.g., error rates) are triggered, ensuring quick detection and recovery from errors. The other options are less effective. Nested CloudFormation stacks with change sets offer rollback but lack automated traffic shifting and testing hooks. Combining CLI scripts improves efficiency but still requires manual error detection and rollback. Deploying a new API Gateway endpoint and changing CloudFront origins is a more complex and disruptive process for Lambda-specific changes, lacking the granular control and automation of CodeDeploy.
Pass your exam — without the endless answer hunt
Get every verified question and explanation for this exam in one place, and save hours of prep. 1,000+ certifications · 20+ languages · free to start.
Pass your exam faster → No card needed