Question

Difficulty: EasyAWS CodeDeploy

A developer is writing an appspec.yaml file to deploy updates to an AWS Lambda function using AWS CodeDeploy. Which of the following sections or hooks are valid for an AWS Lambda deployment? (Select TWO.)

  1. The resources section, which specifies the Lambda function name, alias, current version, and target version.Answer
  2. The AfterAllowTraffic hook, which is used to run validation tasks after traffic has shifted to the new version.Answer
  3. C
    The files section, which lists the source file paths and destination directories on the target system.
  4. D
    The BeforeInstall hook, which runs scripts before any files are copied to the instances.
  5. E
    The ApplicationStart hook, which executes scripts to start services after the installation completes.

Answer

The valid sections or hooks for an AWS Lambda CodeDeploy deployment are the resources section and the AfterAllowTraffic hook.
In AWS CodeDeploy, the AppSpec file structure depends on the compute platform. For an AWS Lambda deployment, the resources section must be defined to specify the Lambda function name, alias, and versions. Additionally, only two lifecycle hooks are supported: BeforeAllowTraffic and AfterAllowTraffic. The correct choices represent these valid components.

Step-by-Step Solution

1
Identify the target compute platform for the CodeDeploy deployment.
The target compute platform is AWS Lambda.
AppSpec file schemas and valid hooks differ significantly between AWS Lambda, Amazon ECS, and EC2/On-Premises.
2
Filter out sections and hooks that are specific to EC2/On-Premises deployments.
The files section, BeforeInstall hook, and ApplicationStart hook are identified as EC2/On-Premises specific.
EC2 deployments copy files to instances and manage local service lifecycles, which does not apply to serverless Lambda functions.
3
Select the valid Lambda-specific configuration elements from the remaining options.
The resources section (used to define the function metadata) and the AfterAllowTraffic hook (used to run post-deployment validation Lambda functions) are chosen.
AWS Lambda AppSpec files strictly require the resources section and only support BeforeAllowTraffic and AfterAllowTraffic lifecycle hooks.

Key Concept

AWS CodeDeploy AppSpec file structure for AWS Lambda compute platform
Estimated Time:1m 0s
Rate this question