DVA-C02 Deployment Practice Question
A developer is setting up a CI/CD pipeline using AWS CodePipeline to deploy an application to Amazon ECS. The pipeline has a source stage that pulls code from an AWS CodeCommit repository. The developer wants the pipeline to execute only when commits are pushed to the 'main' branch. How should the developer configure this?
⚠ Common exam trap
The trap here is that candidates might overthink the solution by considering external services like CloudWatch Events or Lambda, when the correct answer is a simple configuration option already built into the CodePipeline source stage.
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 pipeline's source stage to include the branch name in the CodeCommit action configuration.
AWS CodePipeline allows you to specify a branch name directly in the source action configuration for CodeCommit. When you configure the source stage, you can set the 'BranchName' parameter to 'main', which ensures the pipeline only triggers on commits pushed to that specific branch. This is the simplest and most direct method to filter by branch without additional services or custom logic.
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 an Amazon CloudWatch Events rule that triggers the pipeline only when the branch is 'main'.
Why it's wrong here
While CloudWatch Events can trigger pipelines, it's not the native or most efficient mechanism for filtering source commits within CodePipeline itself. This option is tempting because CloudWatch Events is a general-purpose AWS automation service, and one *could* theoretically set up complex event filtering to achieve this. However, CodePipeline offers a more direct and integrated solution for branch-specific triggers within its source action configuration.
- ✓
Configure the pipeline's source stage to include the branch name in the CodeCommit action configuration.
Why this is correct
When configuring a CodePipeline, the CodeCommit source action within the source stage includes a mandatory `BranchName` parameter. By specifying the desired branch, such as 'main', directly in this configuration, CodePipeline is explicitly instructed to monitor only that particular branch for new commits. This native integration ensures that the pipeline automatically initiates an execution solely upon pushes to the designated branch, making it the most direct and efficient method for branch-specific triggering.
- ✗
Use an AWS Lambda function in the source stage to filter the branch.
Why it's wrong here
Integrating an AWS Lambda function into the source stage to filter branches introduces unnecessary complexity and overhead. CodePipeline's CodeCommit source action inherently supports specifying a target branch, eliminating the need for custom filtering logic. Employing a Lambda for this purpose would add latency, incur additional operational costs, and require managing extra components (Lambda code, IAM roles, invocation triggers) when a simpler, built-in solution is readily available.
- ✗
Set a branch filter pattern in the pipeline trigger settings.
Why it's wrong here
CodePipeline's top-level trigger settings, which govern how the pipeline is invoked (e.g., via CloudWatch Events or manual start), do not provide a mechanism for filtering based on a Git branch name. Branch specification is handled at a more granular level, specifically within the configuration of the source action itself, such as a CodeCommit or S3 source action. Therefore, attempting to configure a branch filter pattern directly in general pipeline trigger settings would be ineffective.
Go deeper
Related to this question
About these practice questions
This DVA-C02 question is part of Courseiva's 724-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 →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This DVA-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 DVA-C02 exam.