Question

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

A developer is setting up an Amazon EventBridge rule to route custom application events to an Amazon Kinesis Data Stream target for real-time analytics. The stream consists of 12 shards. The incoming events contain a JSON payload with fields including `transaction_id` (a high-entropy UUID), `region` (one of 4 geographic regions), and `department` (one of 3 departments). The developer needs to ensure that the events are distributed evenly across all shards to prevent throttling, and that EventBridge has the necessary permissions to write to the Kinesis stream. Which configuration meets these requirements?

  1. Configure the EventBridge target with PartitionKeyPath set to $.detail.transaction_id, and associate an IAM role with a trust policy that allows the events.amazonaws.com service principal to assume the role.Answer
  2. B
    Configure the EventBridge target with PartitionKeyPath set to $.detail.region, and associate an IAM role with a trust policy that allows the events.amazonaws.com service principal to assume the role.
  3. C
    Configure the EventBridge target with PartitionKeyPath set to $.detail.transaction_id, and associate an IAM role with a trust policy that allows the kinesis.amazonaws.com service principal to assume the role.
  4. D
    Configure the EventBridge target with a static partition key value of transaction-event, and associate an IAM role with a trust policy that allows the events.amazonaws.com service principal to assume the role.

Answer

Configure the EventBridge target with PartitionKeyPath set to $.detail.transaction_id, and associate an IAM role with a trust policy that allows the events.amazonaws.com service principal to assume the role.
The correct configuration uses the transaction_id JSON path as the partition key. Because the transaction ID is a UUID, it provides a high-entropy value that results in a uniform hash distribution of records across all 12 shards in the stream, preventing hot shards. Additionally, EventBridge requires an IAM role to write events to the stream, and the trust policy must explicitly allow the events.amazonaws.com service principal to assume this role.

Step-by-Step Solution

1
Analyze partition key selection for Kinesis Data Streams.
Using a high-entropy field like transaction_id (UUID) distributes records evenly across all 12 shards, whereas region (4 values) or a static key ('transaction-event') causes hot shards and write throttling.
Kinesis uses the MD5 hash of the partition key to determine which shard receives the record; high entropy ensures uniform distribution.
2
Analyze IAM role trust policy configuration for EventBridge targets.
The trust policy must allow the service performing the action (Amazon EventBridge, which is events.amazonaws.com) to assume the role.
If the trust policy specifies the target service (kinesis.amazonaws.com), EventBridge will be unable to assume the role to write events into the stream.

Key Concept

Partition key design for Kinesis Data Streams and EventBridge target permissions.
Rate this question