DOP-C02 Configuration Management and IaC Practice Question
A company uses AWS OpsWorks for configuration management. They need to automate the installation of a custom package on all instances in a layer. Which OpsWorks feature should they use?
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Custom Chef recipes associated with lifecycle events
Custom Chef recipes associated with lifecycle events in AWS OpsWorks allow running Chef recipes automatically on instance lifecycle events such as Setup, Configure, Deploy, Undeploy, and Shutdown. This is the correct feature for automating package installation on all instances in a layer. Option A is incorrect because AWS CodeDeploy AppSpec file is used for CodeDeploy deployments, not OpsWorks. Option B is incorrect because AWS CloudFormation custom resources are used to extend CloudFormation templates, not for OpsWorks automation. Option D is incorrect because AWS Systems Manager Run Command is a separate service for managing instances, not OpsWorks.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
AWS CodeDeploy AppSpec file
Why it's wrong here
The AWS CodeDeploy AppSpec file is a YAML or JSON file that defines deployment actions for CodeDeploy, such as hooks like BeforeInstall, AfterInstall, and ApplicationStop. It is entirely unrelated to AWS OpsWorks, which uses Chef recipes for configuration management. OpsWorks does not read or execute AppSpec files; instead, it relies on Chef cookbooks associated with lifecycle events to manage instance configuration and package installation.
- ✗
AWS CloudFormation custom resources
Why it's wrong here
AWS CloudFormation custom resources allow CloudFormation templates to invoke external providers (e.g., Lambda functions) during stack create/update/delete operations. While OpsWorks stacks can be provisioned via CloudFormation, custom resources are not a feature of OpsWorks itself and cannot be used to define configuration management actions on instances managed by OpsWorks. Lifecycle events in OpsWorks are handled exclusively by Chef recipes, not by CloudFormation resource triggers.
- ✓
Custom Chef recipes associated with lifecycle events
Why this is correct
Custom Chef recipes associated with lifecycle events are the correct mechanism for configuration management in AWS OpsWorks. OpsWorks defines five lifecycle events—Setup, Configure, Deploy, Undeploy, and Shutdown—and you can assign custom Chef recipes to run at each stage. For example, a Setup recipe can install packages and configure software, while a Deploy recipe can deploy application code. This is the native, fully integrated way to manage configurations in OpsWorks.
- ✗
AWS Systems Manager Run Command
Why it's wrong here
AWS Systems Manager Run Command is a separate service that lets you remotely execute commands or scripts on EC2 instances, either on-demand or via maintenance windows. It is not integrated with OpsWorks lifecycle events and cannot replace Chef recipes for configuration management. While one could manually run commands on OpsWorks-managed instances via Run Command, it does not provide the event-driven, idempotent configuration management that OpsWorks's Chef-based lifecycle model does.
Go deeper
Related to this question
About these practice questions
One of 1,298 original DOP-C02 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →
Same concept, more angles
1 more way this is tested on DOP-C02
These questions test the same concept from different angles. Work through them to make sure you can recognise it however the exam phrases it.
Variation 1. A company uses AWS OpsWorks for configuration management. They want to automate the installation of a custom agent on new EC2 instances. Which OpsWorks feature should they use?
easy- ✓ A.Use a custom Chef recipe in the layer's configuration to run the installation.
- B.Define the agent installation in the layer's built-in configuration.
- C.Use custom JSON to pass the installation commands.
- D.Create a cookbook repository and upload the agent installation script.
Why A: AWS OpsWorks (both Stacks and the managed Chef Automate offering) executes configuration management through Chef recipes organized into cookbooks and attached to layers via lifecycle events (Setup, Configure, Deploy, Undeploy, Shutdown). To install a custom agent on every new instance, the correct mechanism is a custom Chef recipe bound to the layer's Setup lifecycle event, which runs automatically when an instance boots. Built-in layer configuration only covers AWS-provided defaults and cannot encode arbitrary installation logic.
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This DOP-C02 practice question is part of Courseiva's free Amazon Web Services certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the DOP-C02 exam.