DOP-C02 SDLC Automation Practice Question
A company uses AWS CodeCommit for source control. Developers need to automatically run tests on every push to a feature branch, but only if the push includes changes to the 'src/' directory. Which TWO AWS services can be used together to achieve this?
⚠ Common exam trap
Watch out — candidates often assume AWS CodeBuild alone can handle event-driven triggers with path filtering, but it requires an orchestrator like CodePipeline or a Lambda-based custom trigger to implement conditional execution based on directory changes.
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
✓
AWS CodePipeline
AWS CodePipeline can be configured to trigger a pipeline execution when a push occurs to a specific branch in CodeCommit, and it supports path-based filtering using the 'PathFilter' condition in the source action. By combining CodePipeline with AWS Lambda, you can run custom validation logic (e.g., checking if changes are within the 'src/' directory) before invoking further actions like tests. This pair allows you to conditionally run tests only when the push includes changes to 'src/'.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Amazon CloudWatch Logs
Why it's wrong here
CloudWatch Logs is a service for centrally aggregating, storing, and monitoring log files from applications and AWS resources. It does not have native event-driven triggers to start a CI/CD pipeline or build job based on a CodeCommit push; its primary integration is through Log Groups, metric filters, and subscriptions, which are not designed to respond to repository events. While CodeBuild or CodePipeline can send logs to CloudWatch Logs, the service itself cannot initiate test execution on a commit.
- ✓
AWS CodePipeline
Why this is correct
AWS CodePipeline is a fully managed continuous delivery service that can be configured with CodeCommit as a source action, automatically detecting new commits and triggering the pipeline execution. It supports path filters in the source action (e.g., requiring changes only in a specific folder) to avoid unnecessary runs. This makes it the native, event-driven orchestration service to start automated tests (via a CodeBuild build stage) exactly when developers push code.
- ✗
AWS CodeDeploy
Why it's wrong here
AWS CodeDeploy is specifically designed to automate application deployments to EC2, Lambda, or on-premises instances. It does not support source control events or pre-test triggering; it is an execution phase that typically comes after a build and test phase. CodeDeploy relies on a deployment group and AppSpec file to deploy an already-built artifact, so it cannot listen for CodeCommit pushes and invoke a test suite.
- ✓
AWS Lambda
Why this is correct
AWS Lambda can be configured as an event handler for CodeCommit repository notifications via Amazon CloudWatch Events (or EventBridge). When a developer pushes to the repository, the event rule can invoke a Lambda function that programmatically starts an AWS CodeBuild project (or even a CodePipeline execution) to run the test suite. This is a viable serverless approach for triggering tests, though it requires custom event routing and orchestration compared to CodePipeline's direct integration.
- ✗
AWS CodeBuild
Why it's wrong here
AWS CodeBuild is a fully managed build and test service that runs a build project when invoked, but it does not subscribe to CodeCommit repository events on its own. CodeBuild must be triggered explicitly by a parent orchestrator (like CodePipeline) or an external caller (e.g., Lambda or a CLI command), or via periodic schedule. Therefore, while CodeBuild is the tool that actually executes the tests, it lacks the native event-listener capability to start on a push without an intermediate service.
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.