Skip to main content

DVA-C02 practice question · Deployment

During a CodeDeploy deployment to EC2 instances, which file in the application's deployment bundle defines the lifecycle…

During a CodeDeploy deployment to EC2 instances, which file in the application's deployment bundle defines the lifecycle event hooks (such as BeforeInstall and AfterInstall scripts) to run?

  • Aappspec.yml
  • Bbuildspec.yml
  • Cpackage.json
  • Dtemplate.yaml
Show the answer and explanation

Correct answer: A) appspec.yml

Why each option is right or wrong

  • A) Correct. The AppSpec file defines the deployment lifecycle event hooks and, for EC2/on-premises deployments, where to copy files — CodeDeploy reads it to know what scripts to run at each stage.
  • B) Incorrect. buildspec.yml is a CodeBuild file for build commands, a different stage and service than CodeDeploy's deployment lifecycle.
  • C) Incorrect. package.json describes a Node.js project's dependencies and scripts; it isn't the file CodeDeploy reads for deployment lifecycle hooks.
  • D) Incorrect. template.yaml is typically a CloudFormation/SAM infrastructure template, not the CodeDeploy lifecycle hook definition file.
Exam domain
Deployment · 24% of DVA-C02
Question type
Multiple choice (one answer)

Practise the full DVA-C02 exam

This question is one of a small free sample from the CertRidge DVA-C02 bank. Full practice exams match the real exam's length, time limit and domain weights, explain every option, and Review Mode re-drills the questions you miss.

Original question written from the official exam guide. Not affiliated with AWS; never copied from the real exam.

Worth reading: DVA-C02 cheat sheet, Lambda, DynamoDB, API Gateway, IAM and Cognito, messaging, CI/CD and X-Ray in tables, plus what DVA-C03 changes.