Question

Difficulty: EasyStream Processing and Event Routing with Amazon Kinesis and EventBridge

A developer is building a serverless application and needs to configure Amazon EventBridge to route custom application events to a target AWS Lambda function. The events must be filtered so that only events with a `detail-type` of `OrderCreated` and a `status` of `completed` are forwarded to the function. Which two configurations are required to accomplish this? (Select TWO.)

  1. A
    Deploy the target Lambda function into a private VPC subnet with no NAT Gateway or VPC endpoint to allow private event ingestion.
  2. Create an EventBridge rule with an event pattern that matches the custom event source and the status field under the detail object.Answer
  3. C
    Modify the trust policy of the Lambda function's execution role to allow the EventBridge service principal to assume the role.
  4. Add the Lambda function as a target to the EventBridge rule and configure a resource-based policy on the function to allow the EventBridge service principal to invoke it.Answer
  5. E
    Configure the EventBridge rule to use a static partition key so that all incoming events are distributed evenly across matching targets.

Answer

The correct configurations are creating an EventBridge rule with an event pattern matching the custom detail-type and status, and adding the Lambda function as a target while allowing EventBridge to invoke it via a resource-based policy.
To route specific events to a target in EventBridge, a rule must be created with an event pattern that filters incoming JSON events. Additionally, EventBridge needs permissions to invoke the target Lambda function, which is granted using a Lambda resource-based policy.

Step-by-Step Solution

1
Define an EventBridge rule with a pattern.
An EventBridge rule is created that filters events by matching specific JSON fields.
This ensures only matching events (detail-type: OrderCreated and status: completed) are processed.
2
Add the target and set permissions.
The Lambda function is linked as the rule's target, and permission is granted.
EventBridge must have explicit permission to execute the target Lambda function using a resource-based policy.

Key Concept

Routing events using EventBridge rules, custom event patterns, and Lambda resource-based invoke permissions.
Rate this question