Question 1,070 of 256
DOP-C02 SDLC Automation Practice Question
A development team uses AWS CodeCommit for source control. They want to enforce that all commits include a JIRA issue key in the commit message. What is the MOST efficient way to achieve this?
⚠ Common exam trap
It's easy for candidates to confuse CodeCommit branch policies (which enforce approval workflows and restrict direct pushes) with the ability to validate commit message format, but branch policies do not support message validation—only CodeCommit triggers with Lambda can perform custom validation on commit content.
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 CodeCommit trigger that invokes an AWS Lambda function on every push to validate commit messages.
CodeCommit triggers can invoke an AWS Lambda function on every push event, allowing real-time validation of commit messages against a required pattern (e.g., JIRA issue key). This serverless approach enforces the policy centrally without relying on client-side configurations, making it the most efficient and reliable method for a team using AWS CodeCommit.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Use Amazon CloudWatch Events to detect new commits and invoke a Lambda function to validate the commit message.
Why it's wrong here
While CloudWatch Events (now EventBridge) can be configured to match CodeCommit repository events and route them to Lambda, this approach requires you to manually define an event pattern, set up the rule, and attach the necessary IAM permissions for the rule to invoke the function. CodeCommit's native trigger capability is more direct because it is configured at the repository level specifically for push actions, eliminating the need to parse event envelopes or write custom matching logic. Because the requirement is to validate on every push, using CloudWatch Events adds unnecessary complexity and is not the most efficient solution.
- ✗
Implement a pre-commit hook in each developer's local repository.
Why it's wrong here
Pre-commit hooks are client-side scripts that run only on a developer's local machine before a commit is created; they are not distributed or enforced by CodeCommit. Developers can easily bypass them by using `git commit --no-verify`, and the hooks only exist if each developer manually installs and maintains them. Since the team needs to enforce validation on all pushed commits centrally, this approach provides no guarantee and does not protect the repository from non-compliant messages.
- ✗
Configure a branch policy on the repository that requires commit message format.
Why it's wrong here
CodeCommit branch policies are designed to govern pull requests, such as requiring a minimum number of approvals or restricting who can merge, and they do not inspect the format of commit messages themselves. Commit messages are written at the time of commit and are immutable once pushed; branch policies only act on the PR lifecycle, not on individual commit objects. Therefore, configuring a branch policy will not enforce a commit message format on direct pushes or on commits within a PR.
- ✓
Create a CodeCommit trigger that invokes an AWS Lambda function on every push to validate commit messages.
Why this is correct
A CodeCommit trigger can be set up to invoke an AWS Lambda function whenever a push event occurs, and the event payload includes the full commit list with metadata such as the commit message and author. The Lambda function can programmatically validate each commit message against a required format or regex, and then take action such as sending an alert or invoking a rollback if validation fails. This is a serverless, centrally managed approach that runs on every push and cannot be bypassed by developers, making it the correct solution.
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 |
About these practice questions
Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →
Last reviewed: Jul 4, 2026
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.
Question Discussion
Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.
Sign in to join the discussion.