Question

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

A developer is designing a real-time order processing system for an e-commerce platform. The system must ingest order events, execute real-time fraud analysis, and route notifications to third-party shipping partners. Order volume spikes unpredictably during promotional events, and the events must be processed in the strict order they are received for each unique customer. The developer decides to use Amazon Kinesis Data Streams for ingestion and Amazon EventBridge for event routing. Which TWO configurations or practices should the developer implement to meet these requirements?

  1. Use the customer ID as the partition key when publishing events to the Kinesis Data Stream to ensure that events for the same customer are routed to the same shard and processed in order.Answer
  2. Create an EventBridge rule with an event pattern that filters for specific order status events and routes them to shipping partners using API destinations.Answer
  3. C
    Use a fixed string such as 'order_event' as the partition key for all records published to Kinesis Data Streams to simplify shard management.
  4. D
    Place the downstream consumer Lambda function in a private VPC subnet without a NAT Gateway or VPC endpoint to read events directly from Kinesis.
  5. E
    Initialize the database connection pool outside the Lambda handler and set the Lambda function timeout to 3 seconds to guarantee in-memory state preservation across all concurrent requests.

Answer

Use the customer ID as the partition key when publishing events to the Kinesis Data Stream, and create an EventBridge rule with an event pattern that filters for specific order status events and routes them to shipping partners using API destinations.
Using the customer ID as the partition key ensures that all records containing events for the same customer map to the same shard. Since Kinesis guarantees ordered delivery within a single shard, events are processed sequentially. Additionally, EventBridge rules combined with API destinations provide a native way to filter events and post them to third-party shipping HTTP endpoints without managing custom polling logic.

Step-by-Step Solution

1
Select a partition key strategy that ensures ordered processing.
Using the customer ID as the partition key hashes the key to assign all events for a specific customer to the same Kinesis shard, guaranteeing they are processed in order.
Kinesis guarantees order within a shard, so related events must go to the same shard.
2
Set up event filtering and routing for third-party endpoints.
Create an EventBridge rule to match order-placed events and use API destinations to call third-party shipping APIs.
EventBridge integrates natively with third-party HTTP endpoints using API destinations.

Key Concept

Preserving order in Kinesis streams using high-entropy partition keys and routing events to HTTP targets via EventBridge API destinations.
Rate this question