An enterprise is designing a deployment pipeline for a serverless microservice using the AWS Serverless Application Model (SAM). The microservice is deployed as an AWS Lambda function behind an Amazon API Gateway REST API. The company requires a deployment strategy that routes of the production traffic to the new version, and then increases the traffic to the new version by every minutes until it reaches . If the error rate of the microservice increases during the deployment, the process must automatically roll back.
Which TWO configurations must the Solutions Architect implement in the AWS SAM template to achieve this deployment strategy? (Select TWO.)
- Set the `Type` property of the `DeploymentPreference` for the Lambda function to `Linear10PercentEvery10Minutes` and specify an `AutoPublishAlias` for the function.Answer
- BSet the `Type` property of the `DeploymentPreference` for the Lambda function to `Canary10Percent10Minutes` and specify an `AutoPublishAlias` for the function.
- Create an Amazon CloudWatch alarm that monitors the `Errors` metric of the Lambda function alias, and list this alarm in the `Alarms` property of the `DeploymentPreference`.Answer
- DCreate an Amazon CloudWatch alarm that monitors the `Errors` metric of the global `$LATEST` version of the Lambda function, and list this alarm in the `Alarms` property of the `DeploymentPreference`.
- ESet the `Type` property of the `DeploymentPreference` for the Lambda function to `AllAtOnce` and configure a pre-traffic hook Lambda function to test the deployment.
Answer
Setting the deployment preference type to `Linear10PercentEvery10Minutes` with an `AutoPublishAlias` configured, and creating an Amazon CloudWatch alarm that monitors the `Errors` metric of the Lambda function alias listed in the `Alarms` property of the `DeploymentPreference`.
To satisfy the deployment requirements, the solutions architect must use the `Linear10PercentEvery10Minutes` configuration in the deployment preference, which shifts of the traffic to the new version every minutes until completion. Since AWS SAM uses Lambda aliases to manage these shifts, the `AutoPublishAlias` property is required. Additionally, to automate rollbacks on failure, a CloudWatch alarm monitoring the `Errors` metric of the specific Lambda function alias must be associated with the deployment preference. This ensures CodeDeploy can monitor the health of both versions during traffic shifting and trigger a rollback if error thresholds are exceeded.
Step-by-Step Solution
Key Concept
AWS SAM deployment preferences and CodeDeploy traffic shifting configurations for Lambda functions using aliases and CloudWatch alarms.