A developer is configuring a blue/green deployment for an Amazon Elastic Container Service (Amazon ECS) service using AWS CodeDeploy and an Application Load Balancer (ALB). The service runs tasks under normal operation. The developer must run automated integration tests against the new version of the application (the replacement task set) in the production environment before routing any live production traffic to it.
Which configuration should the developer implement to meet these requirements?
- Configure a test listener on the ALB that points to the replacement target group, specify this listener in the CodeDeploy deployment group, and run the integration tests during the AfterAllowTestTraffic lifecycle hook.Answer
- BConfigure the ALB production listener to route of live traffic to the replacement target group, and execute the integration tests using the BeforeInstall lifecycle hook in the appspec.yaml file.
- CAdd a path-based routing rule to the ALB production listener to route traffic with a /test prefix to the replacement target group, and run the integration tests using the BeforeAllowTraffic lifecycle hook.
- DDeploy a separate, temporary ALB for the replacement task set, run the integration tests against this ALB, and then update the ECS service configuration to point to the new ALB using the AWS Command Line Interface (AWS CLI).
Answer
Configure a test listener on the ALB that points to the replacement target group, specify this listener in the CodeDeploy deployment group, and run the integration tests during the AfterAllowTestTraffic lifecycle hook.
The correct configuration utilizes a dedicated test listener on the Application Load Balancer (ALB) to route traffic specifically to the replacement target group hosting the Green task set. By specifying this test listener in AWS CodeDeploy, developers can target the new deployment for testing. The AfterAllowTestTraffic lifecycle hook runs immediately after the test listener starts directing traffic to the replacement task set, providing the ideal phase to execute automated validation tests before any live production traffic is shifted.
Step-by-Step Solution
Key Concept
ECS Blue/Green Deployment Validation with CodeDeploy