Courseiva

DOP-C02 Configuration Management and IaC Practice Question

A company uses AWS CodeCommit as a source repository and AWS CodeBuild for building artifacts. The DevOps team wants to ensure that all commits to the main branch trigger a build. Which steps should be taken? (Choose THREE.)

⚠ Common exam trap

Many exam-takers confuse CodeCommit's lack of native webhook support with other Git providers, leading them to select Option B, or they mistakenly think CodeDeploy can trigger builds instead of deployments.

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

✓

Configure the CodeBuild project to use the CodeCommit repository as the source and specify the main branch

Configuring the CodeBuild project to use the CodeCommit repository as the source and specifying the main branch ensures that CodeBuild knows which repository and branch to monitor for changes. This is the foundational step that links the source code to the build project, enabling automated builds when commits are pushed to the main branch.

Answer analysis

Option-by-option breakdown

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

  • ✓

    Configure the CodeBuild project to use the CodeCommit repository as the source and specify the main branch

    Why this is correct

    The CodeBuild project must be explicitly configured to use the CodeCommit repository as its source and to specify the main branch as the source version. This ensures the build fetches the latest code from that branch whenever a build is initiated, whether manually or via an event. Without this configuration, CodeBuild would have no source to use, so this is a prerequisite that makes the other correct answers functional.

  • ✗

    Configure a webhook in the CodeCommit repository to notify CodeBuild

    Why it's wrong here

    CodeCommit does not support configuring webhooks in the same way as third-party providers like GitHub or Bitbucket. Instead, CodeCommit integrates with Amazon CloudWatch Events/EventBridge, which emits repository state change events on code pushes. Attempting to set up a webhook directly in CodeCommit to notify CodeBuild will fail because there is no webhook endpoint for CodeBuild; the correct approach is to use an EventBridge rule.

  • ✓

    Create a CloudWatch Events rule that listens for CodeCommit repository state changes on the main branch

    Why this is correct

    A CloudWatch Events rule can be created to capture CodeCommit state changes, such as a push to the main branch, by specifying the repository name and branch in the event pattern. When a matching change occurs, the rule is invoked and can then trigger subscribed targets like a CodeBuild project. This is a correct and recommended mechanism for starting builds automatically from CodeCommit commits, filtering to the main branch to avoid building every branch.

  • ✓

    Set the CodeBuild project's trigger to use the CloudWatch Events rule

    Why this is correct

    The CloudWatch Events rule must be configured with a target that points to the CodeBuild project, ensuring the build is actually launched when the event matches. This target can optionally pass the commit ID from the event to the build, allowing for precise version control. Setting the project's trigger to use the rule is a required configuration step that completes the event-to-build pipeline, making it a valid part of the solution.

  • ✗

    Use AWS CodeDeploy to trigger the build on commits

    Why it's wrong here

    AWS CodeDeploy is a deployment service that automates the release of built applications to environments like EC2, Lambda, or ECS, but it does not monitor source repositories or initiate builds. Its purpose is to deploy an artifact that has already been built and packaged, typically stored in Amazon S3 or another location. Using CodeDeploy to trigger a build confuses the CI stage with the CD stage; builds are triggered by event sources like CodeCommit events, not by CodeDeploy.

About these practice questions

Courseiva writes every DOP-C02 question from scratch — 1,298 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

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.