A developer is implementing a web analytics pipeline where user interaction events are sent to a custom Amazon EventBridge event bus. The developer configures an EventBridge rule to route these events to an Amazon Kinesis Data Stream for real-time analytics. The stream has 10 active shards to handle the expected volume. The developer wants to ensure that all events for any given user session are processed in chronological order by the consumer application, while also distributing the write load evenly across all shards to prevent write throttling.
Which target configuration in EventBridge meets these requirements?
- Configure the target with a PartitionKeyPath pointing to the user session ID field ($.detail.sessionId) in the event payload.Cevap
- BConfigure the target with a PartitionKeyPath pointing to the event type field ($.detail.eventType) in the event payload.
- COmit the PartitionKeyPath setting, allowing EventBridge to assign a static default string as the partition key.
- DRoute the events to an AWS Lambda function that writes to the stream using the current timestamp as the partition key.
Cevap
Configure the target with a PartitionKeyPath pointing to the user session ID field ($.detail.sessionId) in the event payload.
Configuring the EventBridge target with a PartitionKeyPath pointing to the user session ID ensures that all events from a given session share the same partition key. Kinesis Data Streams maps records with the same partition key to the same shard, preserving the order of execution. Because there are many unique user sessions (high cardinality), the traffic is distributed evenly across all shards, preventing throttling.
Adım Adım Çözüm
Anahtar Kavram
Selecting high-entropy partition keys using PartitionKeyPath on EventBridge targets is crucial for Kinesis Data Streams to achieve balanced shard utilization and maintain order.