Question

Difficulty: EasyAWS CodeDeploy

A developer is configuring the AppSpec file for an AWS CodeDeploy deployment to Amazon ECS. The developer wants to run a validation test before production traffic is routed to the newly deployed task set. Which lifecycle hook should the developer use in the AppSpec file?

  1. BeforeAllowTrafficAnswer
  2. B
    ApplicationStart
  3. C
    ValidateService
  4. D
    ApplicationStop

Answer

BeforeAllowTraffic
The lifecycle hook designed for Amazon ECS deployments to run tasks before traffic shifts to the new task set is BeforeAllowTraffic. This hook allows developers to invoke a Lambda function to validate the new task set prior to routing live traffic.

Step-by-Step Solution

1
Identify the target compute platform for the CodeDeploy deployment.
The target platform is Amazon ECS.
ECS deployments use a specific, limited set of lifecycle hooks compared to EC2/On-premises deployments.
2
Determine the timing requirement for running the validation test.
The test must run after containers are deployed but before production traffic is shifted.
This corresponds to the phase before allowing traffic to the replacement task set.
3
Select the correct Amazon ECS lifecycle hook that executes before traffic shifting.
BeforeAllowTraffic is the correct hook.
This allows running Lambda functions to validate the deployment before any users access it.

Key Concept

AWS CodeDeploy AppSpec lifecycle hooks vary by compute platform. Amazon ECS deployments support BeforeAllowTraffic and AfterAllowTraffic to validate deployments before and after traffic shifting, while EC2 deployments support hooks like ApplicationStart and ValidateService.
Rate this question