A retail application publishes clickstream events to a custom Amazon EventBridge event bus. A developer needs to route a subset of these events (where the `event_type` is either `add_to_cart` or `checkout`) to an Amazon Kinesis Data Stream for real-time analytics. The event payload includes `session_id` (a UUID v4), `user_id`, and `event_type`. The Kinesis Data Stream has 12 shards. Which configuration should the developer implement to route the correct events while ensuring even data distribution across all stream shards?
- AConfigure an EventBridge rule to route the events to an Amazon SQS queue that triggers a Kinesis producer Lambda function, and configure the SQS queue's visibility timeout to be lower than the Lambda function's timeout.
- BConfigure an EventBridge rule with the event pattern `{"detail": {"event_type": ["add_to_cart", "checkout"]}}`. Set the target as the Kinesis Data Stream, and configure the partition key path to use `$.detail.event_type`.
- Configure an EventBridge rule with the event pattern `{"detail": {"event_type": ["add_to_cart", "checkout"]}}`. Set the target as the Kinesis Data Stream, and configure the partition key path to use `$.detail.session_id`.Answer
- DConfigure an EventBridge rule to route all events to a custom Lambda function that forwards events to Kinesis. Deploy the Lambda function in a private VPC subnet without configuring a NAT Gateway or VPC endpoint.
Answer
Configure an EventBridge rule filtering for the specific event types and route them to Kinesis using the session ID as the partition key.
The correct configuration uses EventBridge's declarative event filtering to only route the matching event types, and uses the high-entropy session ID as the partition key to ensure uniform shard distribution.
Step-by-Step Solution
Key Concept
Selecting high-entropy partition keys for Kinesis Data Streams and setting EventBridge event pattern filters.