DOP-C02 SDLC Automation Practice Question
A company is using AWS CodeCommit for source control and wants to automatically trigger a build in AWS CodeBuild whenever a pull request is created against the main branch. Which AWS service should be used to connect CodeCommit events to CodeBuild?
⚠ Common exam trap
Many candidates choose AWS CodePipeline because they assume a full CI/CD pipeline is required for any build trigger, but EventBridge provides a simpler, event-driven integration that directly connects CodeCommit events to CodeBuild without pipeline overhead.
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
✓
Amazon EventBridge
Amazon EventBridge is the correct choice because it can capture CodeCommit repository events (such as pull request creation) via a default event bus and route them to targets like CodeBuild. This allows you to define a rule that matches the 'codecommit: PullRequestCreated' event and triggers a CodeBuild project directly, without needing an intermediary pipeline or compute service.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
AWS CodePipeline
Why it's wrong here
AWS CodePipeline is an end-to-end orchestration service that models entire release workflows, not a lightweight event router. Although CodePipeline can integrate with CodeCommit via CloudWatch Events to detect source changes, it introduces an entire pipeline structure, stage transitions, and artifact handling—unnecessary overhead when you simply want to start a CodeBuild build on a commit. Additionally, CodePipeline polls or receives events at the pipeline level, but it is not the direct trigger that fires CodeBuild immediately; it first executes the source stage, making it more indirect and complex than an EventBridge rule targeting CodeBuild directly.
- ✓
Amazon EventBridge
Why this is correct
Amazon EventBridge is the native event-delivery service for AWS and CodeCommit automatically publishes repository events—such as referenceCreated, referenceUpdated, and referenceDeleted—as event objects to the default EventBridge bus. You can define a rule with an event pattern matching the specific CodeCommit repository and event type, then set the rule's target to a CodeBuild project, which EventBridge invokes directly and asynchronously. This is the simplest and most direct integration because no intermediate processing or custom code is required, and you can even configure an input transformer to pass the commit ID as the sourceVersion to the CodeBuild build so the build uses the exact revision that triggered it.
- ✗
AWS Lambda
Why it's wrong here
AWS Lambda is a serverless compute service that can be used as an event target for CodeCommit via EventBridge, but it is not the simplest or most direct approach. To use Lambda, you must write, deploy, and maintain a custom handler function that parses the CodeCommit event payload, extracts details such as the reference and repository name, then calls the CodeBuild StartBuild API with the appropriate parameters. This adds code complexity, potential for custom logic errors, IAM permission management for both Lambda and CodeBuild, and a cold-start or execution-time cost—whereas EventBridge can target CodeBuild directly without any intermediary function.
- ✗
Amazon Simple Notification Service (SNS)
Why it's wrong here
Amazon Simple Notification Service (SNS) is a pub/sub messaging service designed to deliver messages to subscribers such as email, HTTP endpoints, or Lambda functions, but it cannot directly invoke a CodeBuild build. SNS does not have CodeBuild as a supported target type in its subscription protocols, so using SNS would require a Lambda function subscribed to the topic to then call StartBuild, making it an extra and unnecessary hop. Furthermore, SNS is primarily intended for notifications and fan-out messaging, not for triggering AWS build services; EventBridge is the purpose-built service for event-driven invocations of CodeBuild.
Go deeper
Related to this question
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 →
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 development team uses AWS CodeCommit as a Git repository. They want to automatically trigger a build in AWS CodeBuild whenever a pull request is created or updated. Which AWS service should be used to detect the pull request events and start the build?
easy- A.Amazon Simple Notification Service (SNS)
- B.AWS CodePipeline
- C.Amazon CloudWatch Logs
- ✓ D.Amazon EventBridge
Why D: Amazon EventBridge can capture CodeCommit repository events, such as pull request creation and updates, via its event bus. By setting up an EventBridge rule that matches these specific events, you can directly trigger an AWS CodeBuild project as a target, enabling automated builds without additional orchestration services.
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.