Question

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

A developer is designing an integration where transactional events from an order management system are published to an Amazon EventBridge custom event bus. The developer must route only 'OrderCompleted' events with a 'total_value' greater than $500 to an Amazon Kinesis Data Stream for real-time analysis. The Kinesis stream has multiple shards, and events belonging to the same customer must be processed in order by the same shard.

Which TWO configurations should the developer implement to meet these requirements?

  1. Define an EventBridge event pattern that filters for the 'OrderCompleted' detail-type and uses a numeric comparison to check that the 'total_value' is greater than 500.Answer
  2. Configure the EventBridge rule's Kinesis Data Stream target to use a Partition Key Path that references the customer ID field in the event payload.Answer
  3. C
    Configure the EventBridge target for the Kinesis Data Stream to use a static partition key for all routed events to ensure they are grouped together.
  4. D
    Configure the IAM role assumed by EventBridge to allow writing to the stream by defining the 'kinesis:PutRecord' action inside the role's trust policy.
  5. E
    Configure the EventBridge rule to invoke a custom filtering Lambda function deployed in a private VPC subnet that lacks a NAT Gateway or Kinesis VPC endpoint.

Answer

Define an EventBridge event pattern that filters for 'OrderCompleted' and a 'total_value' greater than 500, and configure the EventBridge rule's target to use a Partition Key Path referencing the customer ID field.
To meet the requirements, the developer must filter events and ensure ordering. Filtering is achieved by configuring an EventBridge event pattern matching the 'OrderCompleted' detail-type and checking that the total value is greater than 500 using a numeric comparison. Ordering per customer is achieved by routing events to the Kinesis stream with a partition key derived from the customer ID. Setting the Partition Key Path on the EventBridge Kinesis target ensures EventBridge extracts the customer ID dynamically from each event payload, routing all events for a given customer to the same shard in sequence.

Step-by-Step Solution

1
Analyze the event filtering requirements.
An EventBridge event pattern needs to match the 'detail-type' value of 'OrderCompleted' and apply a numeric comparison filter where the 'total_value' is greater than 500.
This filters matching events at the source before they are routed to the target, minimizing unnecessary processing.
2
Determine the partition key strategy for Kinesis Data Streams.
Configure the Partition Key Path on the Kinesis target using a JSON path (e.g., $.detail.customer_id).
Kinesis routes records to shards based on the hash of the partition key. To ensure sequential ordering per customer, events must share the same partition key and thus go to the same shard.

Key Concept

Routing events from Amazon EventBridge to Amazon Kinesis Data Streams requires configuring event patterns for filtering and specifying a partition key path to distribute data across shards while preserving order.
Rate this question