Courseiva
SDLC Automation →mediumMultiple Choice

DOP-C02 SDLC Automation Practice Question

A company is implementing a CI/CD pipeline using AWS CodePipeline. The source code is stored in an AWS CodeCommit repository. The pipeline must automatically start whenever a change is pushed to any branch. Which configuration is required?

⚠ Common exam trap

Many candidates assume CodeCommit has a built-in trigger for CodePipeline (like Option A) or that SNS can directly trigger CodePipeline (like Option C), but AWS requires CloudWatch Events as the intermediary for event-driven pipeline starts.

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

✓

Create a CloudWatch Events rule that matches CodeCommit push events and targets the CodePipeline pipeline.

AWS CodePipeline can be triggered automatically by Amazon CloudWatch Events when a CodeCommit repository receives a push event. By creating a CloudWatch Events rule that matches the `codecommit:GitPush` event source and targets the pipeline, the pipeline starts automatically on any branch push without polling or manual intervention.

Answer analysis

Option-by-option breakdown

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

  • ✗

    Add a branch creation trigger in CodeCommit that starts the pipeline.

    Why it's wrong here

    CodeCommit does not expose a native 'branch creation trigger' feature that can directly start a CodePipeline. The service emits repository events (e.g., push, branch creation) to Amazon CloudWatch Events, not to a pipeline configuration as a trigger action. To react to branch creation, you must define an EventBridge rule with an event pattern for 'referenceCreated', not use a built-in branch creation trigger. Thus, this option is incorrect because it mischaracterizes CodeCommit's event integration model.

  • ✓

    Create a CloudWatch Events rule that matches CodeCommit push events and targets the CodePipeline pipeline.

    Why this is correct

    This is the correct approach: CodeCommit publishes push events to CloudWatch Events (Amazon EventBridge), and you create a rule that matches the 'codecommit' source with a 'Push' detail-type, then set CodePipeline as the target. The rule can optionally filter by branch using the 'referenceType' and 'referenceName' fields, enabling branch-specific automation. This event-driven method provides near-immediate pipeline execution and is the recommended best practice for triggering pipelines on code changes.

  • ✗

    Create an SNS topic and subscribe the pipeline to it, then configure CodeCommit to publish to the topic on push.

    Why it's wrong here

    CodeCommit does not support publishing directly to an SNS topic for the purpose of triggering a pipeline; its event integration is limited to CloudWatch Events/EventBridge. SNS topics are not valid targets for CodePipeline source actions, and subscribing a pipeline to SNS is not a supported trigger mechanism. While SNS can receive notifications from other services, using it here would require custom glue logic and is neither native nor correct for this scenario.

  • ✗

    Configure the pipeline to poll the CodeCommit repository every few minutes.

    Why it's wrong here

    Polling is a technically possible but suboptimal approach: CodePipeline can periodically check the CodeCommit repository for changes when configured with 'PollForSourceChanges', but this introduces latency and unnecessary API calls. Because the pipeline wakes at fixed intervals, pushes may not start for several minutes, and repeated polling contributes to repository request load and cost. The preferred method is to use CloudWatch Events/EventBridge push-based rules, which react immediately and avoid idle polling, making polling not the best-practice answer.

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 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.