Courseiva
SDLC AutomationeasyMultiple ChoiceObjective-mapped

DOP-C02 SDLC Automation Practice Question

A development team uses AWS CodeCommit to store source code and AWS CodePipeline to automate builds and deployments. The team wants to ensure that every commit to the main branch triggers a build and deployment to a test environment. Which action should be taken?

⚠ Common exam trap

The trap here is that candidates may overthink the solution and choose a more complex option (like Lambda polling or manual CloudWatch Events rules) instead of recognizing that CodePipeline's native source configuration already handles event-driven triggers automatically.

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 source stage of the CodePipeline to use the CodeCommit repository and specify the main branch.

CodePipeline natively integrates with CodeCommit as a source action. By configuring the source stage to use the CodeCommit repository and specifying the main branch, the pipeline automatically triggers on every commit to that branch without any additional infrastructure or polling. This is the simplest and most reliable approach, as CodePipeline uses Amazon CloudWatch Events under the hood to detect changes.

Answer analysis

Option-by-option breakdown

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

  • Create a CodeBuild project that watches the main branch and starts a pipeline.

    Why it's wrong here

    CodeBuild is a build service, not an event-driven orchestrator; it has no built-in mechanism to 'watch' a branch and initiate a CodePipeline execution. A CodeBuild project can run tests or builds, but triggering a pipeline requires an external event source, which CodeBuild itself does not provide for repository polling. Using CodeBuild as a proxy here would create a needless middleman, because CodePipeline's CodeCommit source action already natively detects branch commits and starts the pipeline automatically.

  • Use AWS Lambda to poll the repository and start the pipeline on new commits.

    Why it's wrong here

    Introducing a Lambda function to poll the repository every few seconds or minutes adds operational overhead, potential API throttling, and event latency, while duplicating functionality that CodePipeline already provides out of the box. The CodeCommit source action in CodePipeline uses a CloudWatch Events rule under the hood to receive near-instant commit notifications, so manual polling is both unnecessary and an anti-pattern for event-driven CI/CD. This approach also requires you to write and maintain custom code for permission handling, error retries, and deduplication, all of which are managed by the native integration.

  • Set up an Amazon CloudWatch Events rule that matches commits to the main branch and targets the CodePipeline.

    Why it's wrong here

    Setting up a CloudWatch Events rule is unnecessary here, as CodePipeline's CodeCommit source action type natively detects repository commits and automatically triggers the pipeline, providing direct integration. This option is tempting because CloudWatch Events (now Amazon EventBridge) is a powerful event-driven service, ideal for triggering pipelines based on events from *other* AWS services or custom events where a direct source integration is not available, such as an S3 object upload or a successful Lambda execution.

  • Configure the source stage of the CodePipeline to use the CodeCommit repository and specify the main branch.

    Why this is correct

    In CodePipeline, a source stage with a CodeCommit action automatically subscribes to repository events on the specified branch (e.g., main) and triggers a new pipeline execution whenever a commit is pushed. This is the standard, fully managed integration: CodePipeline creates the necessary event rule to detect the branch update and passes the commit ID and repository name as inputs to subsequent stages. By specifying the branch in the action configuration, you also get filtering on that branch only, making this the simplest and most reliable way to achieve continuous delivery from CodeCommit.

About these practice questions

This DOP-C02 question is part of Courseiva's 251-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 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.