DOP-C02 SDLC Automation Practice Question
A developer wants to automatically run unit tests when a pull request is created in AWS CodeCommit. Which AWS service should be used to trigger the tests?
⚠ Common exam trap
A common mix-up: candidates confuse CodeCommit webhooks (which only support push events) with EventBridge events (which support pull request state changes), leading them to incorrectly select AWS CodeBuild with webhooks.
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 rule for CodeCommit pull request state changes targeting AWS Lambda.
Amazon EventBridge can capture CodeCommit pull request state changes (e.g., created, updated, merged) via a rule and route them to a target like AWS Lambda. The Lambda function can then invoke unit tests in response to the pull request creation event. This provides a serverless, event-driven trigger without polling or webhooks.
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 with source polling.
Why it's wrong here
AWS CodePipeline source polling is periodic and branch-based: it checks for changes at an interval, not on an event. It cannot distinguish pull request state transitions—pipeline triggers on commit pushes to a branch, not on PR creation, approval, or merge. This introduces latency, extra cost, and fails to match the event-driven requirement for running tests when a pull request state changes.
- ✗
AWS CodeBuild with webhooks from CodeCommit.
Why it's wrong here
AWS CodeBuild webhooks listen for Git push events and can start builds for branch or tag updates, but they do not emit events for pull request activity. CodeCommit does not send a push event when a pull request is created, updated, or approved, so the webhook will never fire for those state changes. Thus, CodeBuild lacks the native trigger needed to run unit tests in response to a pull request state transition.
- ✗
AWS CloudWatch Logs subscription filter for repository logs.
Why it's wrong here
AWS CloudWatch Logs subscription filters route matching log records to a Lambda function for analysis, not to act as an event source for repository changes. CodeCommit does not automatically write pull request state changes to CloudWatch Logs, so there is no log stream to subscribe to. Even if logging were enabled, a subscription filter is for pattern matching on log data and is unrelated to event-driven triggers on service events like pull requests.
- ✓
Amazon EventBridge rule for CodeCommit pull request state changes targeting AWS Lambda.
Why this is correct
Amazon EventBridge natively captures CodeCommit events, including the 'CodeCommit Pull Request State Change' detail type, and invokes Lambda via an event rule. This event-driven pattern eliminates polling and reacts the moment a pull request transitions to a state such as Approved or Merged. The Lambda function can run unit tests and then post results back to the pull request, and you can optionally route results to other services like SNS for notifications.
Quick reference
Cloud Service Model Comparison
| Model | You Manage | Provider Manages | Examples |
|---|---|---|---|
| IaaS | OS, runtime, apps, data | Hardware, hypervisor, networking | EC2, Azure VMs, GCP Compute Engine |
| PaaS | Apps and data | OS, runtime, middleware, hardware | Elastic Beanstalk, Azure App Service |
| SaaS | Data and settings only | Everything else | Microsoft 365, Salesforce, Workday |
| FaaS / Serverless | Function code only | Infra, scaling, runtime | Lambda, Azure Functions, Cloud Run |
| CaaS | Containers and apps | Kubernetes, OS, hardware | EKS, AKS, GKE |
Go deeper
Related to this question
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 →
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.