Skip to main content

AWS DVA-C02 Drill: CodeCommit EventBridge Events - Selecting the Right Trigger for CI/CD Automation

Jeff Taakey
Author
Jeff Taakey
21+ Year Enterprise Architect | AWS SAA/SAP & Multi-Cloud Expert.

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 pullRequestCreated and pullRequestSourceBranchUpdated. 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.
  • 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.

The DevPro Network: Mission and Founder

A 21-Year Tech Leadership Journey

Jeff Taakey has driven complex systems for over two decades, serving in pivotal roles as an Architect, Technical Director, and startup Co-founder/CTO.

He holds both an MBA degree and a Computer Science Master's degree from an English-speaking university in Hong Kong. His expertise is further backed by multiple international certifications including TOGAF, PMP, ITIL, and AWS SAA.

His experience spans diverse sectors and includes leading large, multidisciplinary teams (up to 86 people). He has also served as a Development Team Lead while cooperating with global teams spanning North America, Europe, and Asia-Pacific. He has spearheaded the design of an industry cloud platform. This work was often conducted within global Fortune 500 environments like IBM, Citi and Panasonic.

Following a recent Master’s degree from an English-speaking university in Hong Kong, he launched this platform to share advanced, practical technical knowledge with the global developer community.


About This Site: AWS.CertDevPro.com


AWS.CertDevPro.com focuses exclusively on mastering the Amazon Web Services ecosystem. We transform raw practice questions into strategic Decision Matrices. Led by Jeff Taakey (MBA & 21-year veteran of IBM/Citi), we provide the exclusive SAA and SAP Master Packs designed to move your cloud expertise from certification-ready to project-ready.