Question

Difficulty: EasyAWS CodeDeploy

A developer is preparing an AppSpec file for an Amazon ECS deployment using AWS CodeDeploy. The developer needs to define lifecycle hooks to validate the deployment before routing production traffic to the new task set. What target type must the developer specify in the AppSpec file to execute the validation tests?

  1. A
    A shell script path on the container instance
  2. B
    An IAM service role ARN
  3. An AWS Lambda functionAnswer
  4. D
    An AWS Secrets Manager secret ARN

Answer

An AWS Lambda function
For Amazon ECS deployments, CodeDeploy lifecycle hooks (such as BeforeAllowTraffic and AfterAllowTraffic) must target an AWS Lambda function. The Lambda function runs the validation code and calls the CodeDeploy API to report success or failure.

Step-by-Step Solution

1
Identify the target compute platform for the CodeDeploy deployment.
The target platform is Amazon ECS.
CodeDeploy handles lifecycle hooks differently depending on whether the target platform is EC2/on-premises versus ECS/Lambda.
2
Determine how validation tests are executed on the Amazon ECS platform.
ECS deployments use AWS Lambda functions to execute validation code for lifecycle hooks.
Because containers in ECS tasks cannot run arbitrary local host scripts during CodeDeploy lifecycle transitions, a Lambda function must be used to perform checks like BeforeAllowTraffic.

Key Concept

AWS CodeDeploy lifecycle hooks for Amazon ECS require AWS Lambda functions to execute validation tests.
Estimated Time:1m 0s
Rate this question