Q6 — AWS DVA-C02 Ch.1

Question 6 of 100 | ← Chapter 1

A developer is implementing unit tests for a new application to be deployed on AWS. The developer wants unit tests to validate all pull requests and only merge code into the main branch when all tests pass. The developer stores code in AWS CodeCommit and configures AWS CodeBuild to run unit tests. The developer created an AWS Lambda function to trigger CodeBuild jobs. The developer needs to identify the appropriate CodeCommit event in Amazon EventBridge so the Lambda function is invoked when a pull request is created or updated. Which CodeCommit event meets these requirements?

Correct Answer: C. {"source": ["aws.codecommit"],"detail":{"event": ["pullRequestSourceBranchUpdated","pullRequestCreated"]}}

Explanation

The scenario requires triggering the Lambda function upon creation or update of a pull request. Option C includes 'pullRequestSourceBranchUpdated' and 'pullRequestCreated', both directly associated with pull request initiation or modification. Option A ('pullRequestMergeStatusUpdated') triggers only on merge status changes—not creation or updates. Option B ('pullRequestApprovalRuleCreated') relates to approval rule setup, not pull request lifecycle events. Option D contains invalid event names ('pullRequestSourceBranchCreated' is not a valid CodeCommit event). Thus, Option C is correct.