Question

Difficulty: HardDeployment Strategies

A company is deploying a new version of a microservice on Amazon ECS (Fargate) behind an Application Load Balancer (ALB). The deployment uses AWS CodeDeploy to perform a blue/green deployment. The ALB is configured with two target groups: one for production traffic on port 80, and one for test traffic on port 8080.

The deployment must satisfy the following requirements:
1. Route 10%10\% of production traffic to the replacement task set (Green) initially, and then route the remaining 90%90\% after a 15-minute wait period.
2. Run automated validation tests against the replacement task set using the test traffic port (8080) before any production traffic is shifted.
3. Automatically roll back the deployment if the validation tests fail or if a CloudWatch alarm monitoring 5XX errors triggers during the 15-minute wait period.

Which configuration should the developer specify in the CodeDeploy deployment configuration and the AppSpec file to meet these requirements?

  1. Use CodeDeployDefault.ECSCanary10Percent15Minutes as the deployment configuration. In the AppSpec file, specify the validation test Lambda function under the AfterAllowTestTraffic hook.Answer
  2. B
    Use CodeDeployDefault.ECSCanary10Percent15Minutes as the deployment configuration. In the AppSpec file, specify the validation test Lambda function under the ValidateService hook.
  3. C
    Use CodeDeployDefault.ECSLinear10PercentEvery3Minutes as the deployment configuration. In the AppSpec file, specify the validation test Lambda function under the AfterAllowTestTraffic hook.
  4. D
    Use CodeDeployDefault.ECSCanary10Percent15Minutes as the deployment configuration. In the AppSpec file, specify the validation test Lambda function under the BeforeInstall hook.

Answer

Use CodeDeployDefault.ECSCanary10Percent15Minutes as the deployment configuration and run the validation tests under the AfterAllowTestTraffic hook in the AppSpec file.
The configuration using CodeDeployDefault.ECSCanary10Percent15Minutes correctly implements the required traffic shifting (10% initially, wait 15 minutes, then shift the remaining 90%). In an ECS blue/green deployment, the AfterAllowTestTraffic hook is executed after the test listener begins routing traffic to the green task set, making it the correct place to run validation tests on port 8080 before production traffic begins shifting.

Step-by-Step Solution

1
Analyze the traffic shifting requirement
The requirement is to route 10% of traffic initially, wait 15 minutes, and then route the remaining 90%. This matches the Canary deployment pattern with a 10% initial shift and a 15-minute bake period, represented by the built-in configuration CodeDeployDefault.ECSCanary10Percent15Minutes.
Choosing the correct deployment configuration ensures traffic shifting conforms to the SLA and rollback windows.
2
Identify the lifecycle hook for testing on the test port
The AfterAllowTestTraffic hook is run immediately after the test listener starts routing test traffic to the replacement task set, but before any production traffic is shifted. This is the correct lifecycle hook to trigger a Lambda function to perform validation tests.
Placing validation tests in the correct lifecycle hook ensures that failures can trigger a rollback before production users are affected.
3
Configure the rollback mechanism
If the validation Lambda function fails (returns a failure status to CodeDeploy) or if the CloudWatch alarm triggers during the 15-minute baking period, CodeDeploy will automatically initiate a rollback to the original task set.
Ensures the deployment is safe and automatically rolls back on error detection.

Key Concept

AWS CodeDeploy ECS Blue/Green Deployment Lifecycle Hooks and Deployment Configurations
Estimated Time:3m 0s
Rate this question