Question

Difficulty: MediumDeployment Strategy Design

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 10%10\% of the production traffic to the new version, and then increases the traffic to the new version by 10%10\% every 1010 minutes until it reaches 100%100\%. 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.)

  1. Set the `Type` property of the `DeploymentPreference` for the Lambda function to `Linear10PercentEvery10Minutes` and specify an `AutoPublishAlias` for the function.Answer
  2. B
    Set the `Type` property of the `DeploymentPreference` for the Lambda function to `Canary10Percent10Minutes` and specify an `AutoPublishAlias` for the function.
  3. 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
  4. D
    Create 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`.
  5. E
    Set 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 10%10\% of the traffic to the new version every 1010 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

1
Determine the correct deployment preference type that matches a gradual linear traffic increase of 10%10\% every 1010 minutes.
Identify `Linear10PercentEvery10Minutes` as the AWS SAM deployment type that satisfies the requirement, unlike `Canary10Percent10Minutes` which performs a single canary step before routing all traffic.
This step ensures that the deployment configuration aligns exactly with the gradual linear scaling requirement.
2
Configure the required Lambda properties to enable traffic shifting.
Specify both the `DeploymentPreference` and the `AutoPublishAlias` properties in the AWS SAM template.
AWS SAM and AWS CodeDeploy require a Lambda function alias to coordinate version weight shifting. Without an alias, traffic shifting cannot occur.
3
Configure an automated monitoring and rollback mechanism for the deployment.
Create a CloudWatch alarm targeting the `Errors` metric of the specific Lambda function alias, and link it to the `DeploymentPreference` alarms.
Monitoring the alias ensures that only metrics relevant to the active traffic-shifted versions are evaluated, and listing it in the deployment preference allows CodeDeploy to automatically roll back on failure.

Key Concept

AWS SAM deployment preferences and CodeDeploy traffic shifting configurations for Lambda functions using aliases and CloudWatch alarms.
Rate this question