Question

Difficulty: EasyAWS CodeDeploy

A developer is configuring an AWS CodeDeploy deployment for an AWS Lambda function. The developer needs to define the target Lambda function to deploy and run a validation test before any production traffic shifts to the new version. Which two configurations must the developer include in the AppSpec file to accomplish this? (Select TWO.)

  1. A resources section that specifies the Lambda function name, alias, current version, and target versionAnswer
  2. A BeforeAllowTraffic hook under the hooks section that references a validation Lambda functionAnswer
  3. C
    An ApplicationStart hook under the hooks section to run the validation script
  4. D
    An IAM trust policy definition under a permissions section to grant execution rights to CodeDeploy
  5. E
    A parameters section referencing AWS Systems Manager Parameter Store to retrieve database passwords

Answer

The developer must include a resources section with the Lambda function details (name, alias, current version, and target version) and define a BeforeAllowTraffic lifecycle hook under the hooks section pointing to a validation Lambda function.
To deploy a Lambda function using AWS CodeDeploy, the AppSpec file must define the target function details under the resources section. To run validation tests before shifting traffic, the developer must use the BeforeAllowTraffic lifecycle hook, which runs a separate validation Lambda function before any production traffic begins routing to the new version.

Step-by-Step Solution

1
Identify the compute platform for the CodeDeploy deployment.
The compute platform is AWS Lambda.
Different compute platforms (EC2, ECS, Lambda) have distinct AppSpec schema requirements.
2
Determine how to define the deployment target for AWS Lambda.
Define the function name, alias, current version, and target version in the resources section.
This tells CodeDeploy which function and versions are involved in the deployment.
3
Determine how to run a validation test before traffic shifting.
Add a BeforeAllowTraffic hook in the hooks section pointing to a validation Lambda function.
This hook executes before traffic shifting begins, allowing tests to run and potentially roll back the deployment if they fail.

Key Concept

AWS CodeDeploy AppSpec file structure and lifecycle hooks for AWS Lambda deployments.
Estimated Time:1m 0s
Rate this question