Courseiva

DOP-C02 Configuration Management and IaC Practice Question

A company is using AWS OpsWorks for configuration management of their application stack. The stack includes a PHP application layer and a MySQL database layer. The DevOps team wants to automate the deployment of a new PHP version across all instances in the PHP layer. The team has created a custom Chef recipe that updates PHP. They want to run this recipe on all instances in the PHP layer in a rolling update fashion to avoid downtime. Which OpsWorks feature should they use?

⚠ Common exam trap

The trap is assuming that adding a recipe to a lifecycle event (Setup or Configure) will update running instances — lifecycle events only fire at specific instance lifecycle moments, not on demand, so they cannot perform a rolling update of an existing fleet.

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 the OpsWorks 'Run Command' feature to execute the recipe on the PHP layer with rolling update settings.

AWS OpsWorks Stacks provides a 'Run Command' feature that lets you execute a specific Chef recipe on a chosen layer, and it supports rolling updates so instances are updated in batches rather than all at once. This is the designed mechanism for on-demand execution of a recipe across a layer without redeploying the entire stack. Rolling updates minimize downtime by updating instances in configurable batch sizes while keeping the rest of the layer serving traffic.

Answer analysis

Option-by-option breakdown

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

  • ✓

    Use the OpsWorks 'Run Command' feature to execute the recipe on the PHP layer with rolling update settings.

    Why this is correct

    The 'Run Command' feature in AWS OpsWorks, also known as Execute Recipes, is designed to run Chef recipes on-demand against existing instances or layers without requiring a full lifecycle event. You can target the PHP layer and configure rolling update settings such as batch size and wait time between batches, minimizing downtime across the fleet. This is the correct choice because it directly addresses the need to apply a recipe to currently running PHP instances immediately, not at some future provisioning or event-triggered moment.

  • ✗

    Create a custom Chef cookbook and enable automatic updates in OpsWorks.

    Why it's wrong here

    AWS OpsWorks does not offer any built-in 'automatic updates' mechanism for Chef cookbooks or recipes. While you can create custom Chef cookbooks and store them in a repository like S3 or Git, OpsWorks will not automatically pull and apply new versions on a schedule; you must explicitly trigger a deployment or run a command. The lifecycle events (Setup, Configure, etc.) do not constitute automatic updates because they only fire during specific instance state changes, not periodically. Therefore, this option is incorrect because it relies on a non-existent feature.

  • ✗

    Add the recipe to the Setup lifecycle event for the PHP layer.

    Why it's wrong here

    The Setup lifecycle event in OpsWorks runs only once when an instance is initially bootstrapped or added to a layer, and it is not re-triggered on demand for existing instances. Adding the recipe to the Setup event would only affect future instances that join the PHP layer, leaving all currently running PHP instances unchanged and still in their old state. While this approach could eventually update the fleet if you rotate instances, it does not meet the immediate need to apply the recipe to the existing PHP layer without a reboot or replacement.

  • ✗

    Modify the PHP layer's lifecycle configuration to include the recipe in the Configure event.

    Why it's wrong here

    The Configure lifecycle event in OpsWorks fires in response to topology changes, such as when instances come online or offline, or when layers are modified—not as a manual, ad-hoc execution trigger. Adding the recipe to the Configure event would not cause it to run on command; it would only execute as a side effect of future instance state transitions in the environment. Moreover, Configure is intended to update configuration data across the stack when membership changes, not to run arbitrary recipes on demand, so this option is both functionally incorrect and poorly suited to the scenario.

About these practice questions

This DOP-C02 question is part of Courseiva's 1,298-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

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.