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?
- 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
- BConfigure 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.
- CConfigure 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.
- DConfigure 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
Key Concept
Partition key design for Kinesis Data Streams and EventBridge target permissions.