Question

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

A retail company's developer is designing a real-time inventory tracking system. Point of Sale (POS) terminals publish checkout events as JSON payloads containing a store_id attribute to a custom Amazon EventBridge event bus. The developer wants to route these events directly to an Amazon Kinesis Data Stream for stream processing. To ensure accurate inventory aggregation, all events originating from the same store must be processed in the exact chronological order in which they were generated. Which configuration should the developer apply to satisfy these requirements?

  1. A
    Route the EventBridge events to a Lambda function deployed in a private VPC subnet without a NAT Gateway or VPC endpoints, and have the function write the events to Kinesis.
  2. Configure the Kinesis Data Stream as the target of the EventBridge rule and set the PartitionKeyPath parameter to $.detail.store_id.Answer
  3. C
    Configure the Kinesis Data Stream as the target of the EventBridge rule and use a static string constant as the partition key for all incoming events.
  4. D
    Configure the Kinesis Data Stream as the target of the EventBridge rule using an IAM role to grant permissions, and set the role's trust policy to trust only lambda.amazonaws.com.

Answer

Configure the Kinesis Data Stream as the target of the EventBridge rule and set the PartitionKeyPath parameter to $.detail.store_id.
The correct approach is to set the Kinesis Data Stream as the EventBridge target and utilize the PartitionKeyPath parameter with the JSONPath expression $.detail.store_id. This dynamically extracts the store identifier from each event payload and sets it as the Kinesis partition key. Since Kinesis guarantees ordering within a single shard, and hash-partitioning maps the same key to the same shard, this satisfies the requirement of in-order processing per store.

Step-by-Step Solution

1
Identify the requirement for maintaining event ordering per store in Kinesis Data Streams.
Realize that events must be routed to the same shard based on the store identifier.
In Kinesis, ordering is guaranteed only within a single shard, and records with the same partition key are mapped to the same shard.
2
Determine the mechanism EventBridge uses to assign partition keys when routing directly to Kinesis.
Use the PartitionKeyPath property to specify a JSONPath expression that extracts the store ID from the event payload.
This allows EventBridge to dynamically assign partition keys per event using fields in the JSON payload (e.g., $.detail.store_id).
3
Verify that the selected target configuration and IAM roles are authorized for the EventBridge service.
Ensure the EventBridge service (events.amazonaws.com) is trusted by the IAM role used to write to the Kinesis stream.
If the trust policy points to a different service like Lambda, EventBridge will be unable to assume the role and publish the events.

Key Concept

Partitioning in Amazon Kinesis via Amazon EventBridge target configurations.
Estimated Time:1m 30s
Rate this question