Question

Difficulty: HardDeployment Strategies

A developer is configuring a blue/green deployment for an Amazon ECS service using AWS CodeDeploy. The deployment must meet the following requirements:
- Provide zero downtime for users during updates.
- Run automated integration tests to validate the replacement task set (Green) using a test port before any production traffic is shifted.
- Automatically and immediately roll back the deployment if the validation tests fail, or if a CloudWatch alarm for HTTP 5xx errors is triggered.
- Shift 10% of the production traffic to the new version initially, and shift the remaining 90% after a 15-minute soak period.

Which two configurations or lifecycle hooks should the developer use to meet these requirements? (Select TWO.)

  1. Use the AfterAllowTestTraffic lifecycle hook in the AppSpec file to invoke an AWS Lambda function that runs the validation tests.Answer
  2. Select the CodeDeployDefault.ECSCanary10Percent15Minutes deployment configuration for the deployment group.Answer
  3. C
    Use the ApplicationStart lifecycle hook in the AppSpec file to run the validation tests.
  4. D
    Select the CodeDeployDefault.ECSLinear10PercentEvery1Minute deployment configuration for the deployment group.
  5. E
    Specify a shell script path under the BeforeAllowTraffic hook in the AppSpec file to run validation commands directly on the replacement container instances.

Answer

Use the AfterAllowTestTraffic lifecycle hook in the AppSpec file to invoke a Lambda function that runs the validation tests, and select the CodeDeployDefault.ECSCanary10Percent15Minutes deployment configuration for the deployment group.
The correct configurations are the AfterAllowTestTraffic lifecycle hook (which runs validation tests against the replacement task set while it is accessible via the test listener) and the CodeDeployDefault.ECSCanary10Percent15Minutes deployment configuration (which routes 10% of traffic to the green deployment and the remaining 90% after 15 minutes).

Step-by-Step Solution

1
Identify the required traffic shifting behavior.
Traffic must shift 10% initially and the rest after 15 minutes.
This matches a canary traffic routing model with a 15-minute soak period, which corresponds to the CodeDeployDefault.ECSCanary10Percent15Minutes configuration.
2
Determine the correct CodeDeploy lifecycle hook for validation testing in an ECS environment.
Use the AfterAllowTestTraffic hook to run validation tests via the test port before production traffic starts shifting.
In ECS blue/green deployments, the AfterAllowTestTraffic hook executes after the replacement task set is reachable via the test listener but before production traffic is routed.
3
Identify the correct execution target for ECS lifecycle hooks.
The hook must invoke an AWS Lambda function.
Unlike EC2 deployments which run shell scripts, ECS deployments require AppSpec hooks to trigger Lambda functions.

Key Concept

Deploying updates to Amazon ECS using AWS CodeDeploy blue/green traffic shifting and lifecycle hooks.
Rate this question