A developer is designing a real-time multiplayer analytics pipeline. A game server fleet publishes telemetry events to a custom Amazon EventBridge event bus. The developer wants to route these events to an Amazon Kinesis Data Stream for session-based aggregation. To prevent write throttling due to uneven distribution of records and ensure EventBridge can successfully publish to the stream, which two configurations must the developer implement?
- Configure the EventBridge target for the Kinesis Data Stream to use a PartitionKeyPath that extracts the game session identifier (e.g., $.detail.game_session_id) from the JSON event payload.Cevap
- Associate an IAM role with the EventBridge rule target that has a trust policy allowing the events.amazonaws.com service principal to assume the role, and a permissions policy allowing the kinesis:PutRecord action.Cevap
- CConfigure the EventBridge target to use a static string prefix as the partition key to guarantee that all telemetry events are ordered sequentially within a single shard.
- DAssociate an IAM role with the EventBridge rule target that has a trust policy allowing the kinesis.amazonaws.com service principal to assume the role, and a permissions policy allowing the events:PutEvents action.
- EConfigure a consumer Lambda function to process the Kinesis Data Stream from a private subnet without configuring a NAT Gateway or VPC endpoint.
Cevap
The developer must configure the EventBridge target to use a PartitionKeyPath that extracts the game session identifier from the JSON payload, and associate an IAM role with the target that trusts the EventBridge service principal and has permissions to put records into the Kinesis stream.
To successfully route events from EventBridge to Kinesis, EventBridge needs permission to write to the Kinesis stream. This is accomplished by creating an IAM role that trusts the EventBridge service principal (events.amazonaws.com) and contains permissions to perform the kinesis:PutRecord action on the target stream. Additionally, to avoid hot shards and write throttling (such as a ProvisionedThroughputExceededException), the partition key must have high cardinality. Using a PartitionKeyPath to extract a dynamic field like the session identifier from the event payload ensures records are evenly distributed across the stream's shards.
Adım Adım Çözüm
Anahtar Kavram
Stream Processing and Event Routing with Amazon Kinesis and EventBridge
Tahmini Süre:2m 0s