Question

Difficulty: HardDeployment Strategy Design

A company is designing a deployment pipeline for a serverless API that uses Amazon API Gateway and AWS Lambda. The new deployment strategy must meet the following requirements:
- Shifting traffic to the new Lambda version must be done gradually, routing 10%10\% of the traffic for a 1515-minute verification period before routing the remaining 90%90\% of the traffic.
- A health-check suite must execute testing against the new Lambda version before any production traffic is routed to it.
- The deployment must automatically roll back if the Lambda function's error rate spikes or if the health-check suite fails.

Which combination of actions must the solutions architect take to implement this deployment strategy? (Select TWO.)

  1. Configure the AWS CodeDeploy deployment group to use the CodeDeployDefault.LambdaCanary10Percent15Minutes deployment configuration, and define a BeforeAllowTraffic lifecycle hook in the AppSpec file that points to a validation Lambda function.Answer
  2. Create a CloudWatch alarm that monitors the Errors metric of the Lambda function, and configure the CodeDeploy deployment group to automatically roll back when this alarm is triggered.Answer
  3. C
    Configure the AWS CodeDeploy deployment group to use the CodeDeployDefault.LambdaLinear10PercentEvery15Minutes deployment configuration, and define an AfterAllowTraffic lifecycle hook in the AppSpec file to execute the health-check suite.
  4. D
    Create an AWS Lambda alias pointing to both the active and the new Lambda versions with a 10%10\% routing weight, and configure a Route 53 weighted alias record to shift traffic after 1515 minutes.
  5. E
    Create a CloudWatch alarm that monitors API Gateway IntegrationLatency and associate it with a CloudFormation stack rollback trigger to automatically revert the Lambda function version alias.

Answer

Configure the AWS CodeDeploy deployment group to use the canary deployment configuration with a BeforeAllowTraffic lifecycle hook, and configure a CloudWatch alarm on the Lambda Errors metric to trigger an automatic rollback.
To implement the gradual traffic shifting strategy, the canary deployment configuration routes 10%10\% of traffic to the new Lambda version for 1515 minutes, then shifts the remaining 90%90\% of traffic instantly. The BeforeAllowTraffic hook runs before any production traffic is shifted to the new Lambda function version, making it the correct lifecycle phase to execute the health-check suite. To support automated rollbacks based on failures, CodeDeploy natively supports CloudWatch alarms. If the CloudWatch alarm monitoring the Lambda Errors metric triggers during the deployment, CodeDeploy immediately halts the deployment and rolls back the alias to the previous stable version.

Step-by-Step Solution

1
Select the CodeDeploy deployment configuration that routes 10%10\% of the traffic for 1515 minutes and then routes 90%90\% immediately.
CodeDeployDefault.LambdaCanary10Percent15Minutes is selected.
This matches the traffic shifting requirements exactly.
2
Configure the validation hook in the AppSpec file to execute the health-check suite before traffic shifting starts.
BeforeAllowTraffic hook is defined, pointing to a test-execution Lambda function.
BeforeAllowTraffic runs validation scripts before production traffic is routed to the new Lambda version.
3
Configure CloudWatch Alarms to monitor Lambda Errors and link them to the CodeDeploy deployment group rollback options.
CodeDeploy automatically rolls back the deployment if the alarm transitions to the ALARM state during deployment.
This satisfies the requirements for automated rollback on function failure.

Key Concept

Canary deployment strategy with CodeDeploy lifecycle validation hooks and CloudWatch rollback alarms for serverless workloads
Rate this question