Question

Difficulty: HardDeployment Strategy Design

An online banking consortium is implementing a serverless wire transfer API. The backend logic is hosted on AWS Lambda functions, fronted by Amazon API Gateway. The compliance department mandates that any updates to the transfer Lambda function must undergo automated end-to-end transaction validation in the production environment before any actual user traffic is routed to the new code. If validation succeeds, the new version must be gradually introduced, starting at 5%5\% of live traffic, scaling up by 5%5\% every 10 minutes, until it handles 100%100\% of the workload. If the error rate of the new version exceeds 0.5%0.5\% or if the validation fails at any point, the system must immediately and automatically roll back to the previous stable version with zero downtime. Which of the following configurations represents the most operationally efficient deployment strategy that meets these requirements?

  1. A
    Configure AWS CodeDeploy to use a custom deployment configuration defined with a linear traffic shifting type, a step percentage of 5%5\%, and a step interval of 10 minutes. In the AppSpec file, define an `AfterAllowTraffic` hook pointing to a validation Lambda function that executes the end-to-end transaction tests. Associate a CloudWatch Alarm monitoring the Lambda function's error rate with the CodeDeploy deployment group to trigger automatic rollbacks.
  2. B
    Configure Amazon API Gateway with two stages: Production and Canary. Set up a Route 53 weighted routing policy between the two stages, starting with a 5%5\% weight on the Canary stage. Use an AWS CodePipeline pipeline to trigger a Lambda function that gradually increases the Route 53 weights by 5%5\% every 10 minutes. Define a `BeforeAllowTraffic` hook in the pipeline to execute the validation tests before updating the Route 53 weights.
  3. Configure AWS CodeDeploy to use a custom deployment configuration defined with a linear traffic shifting type, a step percentage of 5%5\%, and a step interval of 10 minutes. In the AppSpec file, define a `BeforeAllowTraffic` hook pointing to a validation Lambda function that executes the end-to-end transaction tests. Associate a CloudWatch Alarm monitoring the Lambda function's error rate with the CodeDeploy deployment group to trigger automatic rollbacks.Answer
  4. D
    Configure AWS CodeDeploy with the predefined `LambdaLinear10PercentEvery10Minutes` deployment configuration. In the AppSpec file, define a `BeforeAllowTraffic` hook pointing to a validation Lambda function that executes the end-to-end transaction tests. Configure AWS Lambda alias routing manually via an AWS Step Functions state machine to throttle the traffic shifting rate to 5%5\% steps to meet the compliance requirement.

Answer

Configure AWS CodeDeploy to use a custom deployment configuration defined with a linear traffic shifting type, a step percentage of 5%5\%, and a step interval of 10 minutes. In the AppSpec file, define a `BeforeAllowTraffic` hook pointing to a validation Lambda function that executes the end-to-end transaction tests. Associate a CloudWatch Alarm monitoring the Lambda function's error rate with the CodeDeploy deployment group to trigger automatic rollbacks.
Defining a custom CodeDeploy deployment configuration with a linear shifting pattern is correct because it matches the requested custom increments of 5%5\% every 10 minutes. Using the `BeforeAllowTraffic` hook allows the system to validate the deployment on the new Lambda function version in the target environment before any live user traffic is routed. Linking the deployment group to CloudWatch alarms ensures that any breach of the error rate threshold immediately triggers an automatic, zero-downtime rollback.

Step-by-Step Solution

1
Analyze standard versus custom CodeDeploy configurations.
Determine that AWS does not provide a predefined linear deployment configuration matching exactly 5%5\% every 10 minutes, meaning a custom configuration must be defined.
Predefined options only cover standard steps like 10%10\% increments.
2
Select the correct lifecycle hook for pre-traffic verification.
Choose the `BeforeAllowTraffic` hook in the AppSpec file to execute the validation Lambda function.
This hook executes before the first traffic shifting step starts, ensuring no production users hit unverified code.
3
Configure the automated rollback mechanism.
Create and link a CloudWatch Alarm monitoring the Lambda function's error rate to the CodeDeploy deployment group.
This enables automatic rollback to the previous stable version if the error rate exceeds the defined threshold.

Key Concept

Custom deployment configurations and lifecycle hooks in AWS CodeDeploy for serverless applications.
Rate this question