Jeff’s Note #
Unlike generic exam dumps, ADH analyzes this scenario through the lens of a Real-World Lead Developer.
For AWS DVA-C02 candidates, the confusion often lies in differentiating closely named CodeCommit event types in EventBridge triggers. In production, this is about knowing exactly which event detail indicates pull request creation or updates to reliably trigger build validations. Let’s drill down.
The Certification Drill (Simulated Question) #
Scenario #
You are a lead developer at FinSoft Solutions, working on automating the CI/CD pipeline for your new application hosted entirely on AWS. The source code is stored in AWS CodeCommit. Your team requires that every pull request (PR) undergoes unit test validation before getting merged into the main branch. To automate this, you use AWS CodeBuild to run the tests, but want to trigger the CodeBuild project via an AWS Lambda function.
You plan to configure Amazon EventBridge rules that react to CodeCommit events indicating PR creation or updates since these actions should invoke the Lambda which in turn starts the CodeBuild job.
The Requirement: #
Identify which CodeCommit event fields in the EventBridge event detail correctly capture when a pull request is either created or its source branch updated so the Lambda function can react accordingly.
The Options #
- A)
{ "source":"aws.codecommit", "detail": { "event":"pullRequestApprovalRuleCreated" } } - B) No option provided
- C)
{ "source":"aws.codecommit", "detail": { "event":["pullRequestSourceBranchUpdated", "pullRequestCreated"] } } - D)
{ "detail":{ "source":"aws.codecommit", "event":["pullRequestUpdated", "pullRequestSourceBranchCreated"] } }
Google adsense #
leave a comment:
Correct Answer #
C
Quick Insight: The Developer Imperative #
For DVA-C02, it’s critical to understand that the EventBridge event “detail.event” attribute can be an array when specifying multiple events like
pullRequestCreatedandpullRequestSourceBranchUpdated. These indicate the creation of a new pull request and updates to its source branch, respectively—ideal triggers for Lambda functions validating PRs before merge.
Content Locked: The Expert Analysis #
You’ve identified the answer. But do you know the implementation details that separate a Junior from a Senior?
The Expert’s Analysis #
Correct Answer #
Option C
The Winning Logic #
Option C correctly specifies CodeCommit event detail with an event array including "pullRequestSourceBranchUpdated" and "pullRequestCreated". These events fire when a PR is opened or when its source branch receives commits—exactly the moments you want to validate code changes via automated testing.
- In AWS EventBridge for CodeCommit, the
"source"is"aws.codecommit". - The
"detail.event"field precisely identifies the type of action. - Using an array allows the rule to respond to multiple relevant events.
- This approach guarantees your Lambda triggers for both PR creation and any updates, preventing merges of untested code.
The Trap (Distractor Analysis): #
- Option A (
"pullRequestApprovalRuleCreated"):- This event occurs when an approval rule is created for a PR, unrelated to PR creation or branch updates.
- It triggers too late in the workflow to start basic unit testing.
- Option D:
- The event structure is incorrectly formatted—
"detail"should contain"event", but placing"source"inside"detail"is invalid. - The event names
"pullRequestUpdated"and"pullRequestSourceBranchCreated"do not match the exact AWS CodeCommit event naming documented.
- The event structure is incorrectly formatted—
- Option B is not provided and thus invalid.
The Technical Blueprint #
import boto3
def lambda_handler(event, context):
print("Received event:", event)
# Example snippet to check event detail for CodeCommit PR creation or branch update
detail = event.get("detail", {})
event_type = detail.get("event")
if event_type in ["pullRequestCreated", "pullRequestSourceBranchUpdated"]:
codebuild = boto3.client('codebuild')
response = codebuild.start_build(
projectName='FinSoftUnitTestProject'
)
print("Started CodeBuild:", response['build']['id'])
else:
print("Event not triggering build:", event_type)
The Comparative Analysis #
| Option | API/Event Matching Complexity | Accuracy of Trigger | Use Case Fit for CI/CD |
|---|---|---|---|
| A | Low | Incorrect trigger | Irrelevant event type |
| C | Medium | Correct trigger | Matches PR creation & updates |
| D | High | Invalid event format | Doesn’t comply with schema |
Real-World Application (Practitioner Insight) #
Exam Rule #
“For DVA-C02, always pick the exact, documented AWS event names when configuring EventBridge rules for automation triggers.”
Real World #
“In practice, teams might add additional filters (e.g., repository name) in EventBridge rules to fine-tune when Lambda triggers, avoiding unnecessary builds.”
(CTA) Stop Guessing, Start Mastering #
Disclaimer
This is a study note based on simulated scenarios for the AWS DVA-C02 exam.