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?
- ARoute 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.
- Configure the Kinesis Data Stream as the target of the EventBridge rule and set the PartitionKeyPath parameter to $.detail.store_id.Answer
- CConfigure 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.
- DConfigure 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
Key Concept
Partitioning in Amazon Kinesis via Amazon EventBridge target configurations.
Estimated Time:1m 30s