A development team is deploying an updated AWS Lambda function using AWS CodeDeploy with a linear traffic-shifting configuration. Before any production traffic is routed to the new function version, the deployment process must run a separate validation Lambda function to perform smoke tests.
Which lifecycle hook must be specified in the `Hooks` section of the `appspec.yml` file to execute the validation function?
- ABeforeInstall
- BBeforeAllowTestTraffic
- BeforeAllowTrafficAnswer
- DValidateService
Answer
BeforeAllowTraffic
The BeforeAllowTraffic lifecycle hook is one of the two hooks supported for AWS Lambda deployments in AWS CodeDeploy. It executes before traffic routing to the new Lambda version starts, which is the correct phase to run a validation function.
Step-by-Step Solution
Key Concept
AWS CodeDeploy supports a specific set of deployment lifecycle hooks for AWS Lambda, which are different from those used for Amazon ECS and EC2. Specifically, only BeforeAllowTraffic and AfterAllowTraffic are valid for Lambda deployments.
Estimated Time:1m 0s