Courseiva

DOP-C02 Configuration Management and IaC Practice Question

A company uses AWS OpsWorks for configuration management. They want to ensure that whenever a new instance is added to a layer, it automatically installs the latest security patches and joins a central logging system. What is the most efficient way to achieve this?

⚠ Common exam trap

DOP-C02 often tests the difference between OpsWorks lifecycle events and EC2 user data — candidates may pick user data because it is familiar, but OpsWorks layers require Chef recipes in lifecycle events, not user data scripts.

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

✓

Use Chef recipes in a custom OpsWorks layer's Setup lifecycle event.

AWS OpsWorks uses Chef recipes to automate configuration management. The Setup lifecycle event runs on every instance when it is added to a layer, making it the correct place to install security patches and configure the logging agent. This ensures consistency and automation without manual intervention, and it is the native OpsWorks mechanism for bootstrapping instances.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✗

    Schedule a cron job on each instance to check and apply patches daily.

    Why it's wrong here

    A cron job patches only after the instance is running and does not join logging at creation, so new instances remain unconfigured until the next scheduled run. Cron suits recurring maintenance on long-lived hosts, not lifecycle-triggered setup. OpsWorks layer lifecycle recipes execute automatically at instance setup.

  • ✓

    Use Chef recipes in a custom OpsWorks layer's Setup lifecycle event.

    Why this is correct

    The Setup lifecycle event runs recipes when an instance is added to the layer, so security patches and logging-agent configuration apply automatically. This satisfies the requirement for automatic onboarding without manual intervention on each new instance.

  • ✗

    Configure user data scripts in the launch configuration.

    Why it's wrong here

    User data runs once at first boot but sits outside OpsWorks configuration management, so it does not integrate with layer lifecycle events or Chef recipes. It is a valid approach for standalone EC2 bootstrapping, yet here it duplicates and bypasses the OpsWorks setup and deploy recipe mechanism.

  • ✗

    SSH into each instance and run the commands manually.

    Why it's wrong here

    Manual SSH does not scale and cannot trigger automatically when a new instance joins a layer, so instances stay unpatched until an operator intervenes. It remains acceptable for one-off troubleshooting on a single host, but not for repeatable, event-driven configuration across an autoscaling layer.

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 →

How Courseiva writes practice questions · Editorial policy

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 have a stack with a layer that includes several EC2 instances. The DevOps engineer needs to deploy a custom configuration file to all instances in the layer. What is the recommended approach?

medium
  • A.Use custom JSON in the stack settings to specify the file content
  • ✓ B.Create a custom Chef recipe and assign it to the layer's lifecycle events
  • C.Use AWS Systems Manager Run Command to copy the file
  • D.Add the file to the instance's user data script

Why B: AWS OpsWorks is a configuration management service that uses Chef. The recommended approach to deploy custom configuration files to all instances in a layer is to create a custom Chef recipe and assign it to the layer's lifecycle events (e.g., Setup, Configure, Deploy, or Shutdown). This ensures the recipe runs automatically on every instance in the layer at the appropriate stage of the instance lifecycle, providing a consistent and idempotent deployment method.

JA

Written and reviewed by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

Last reviewed September 2026 · checked against the official Amazon Web Services exam blueprint

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.