A developer is designing a real-time multiplayer game event processor. The game client sends player match telemetry (including player ID, match ID, action type, and score) to an Amazon Kinesis Data Stream. The developer must ensure that events for the same match are processed in the strict order they occurred by the consumer. In addition, the consumer, an AWS Lambda function running in a virtual private cloud (VPC), must query an external SaaS security endpoint over the internet to check for anomalous player behavior.
Which two actions should the developer take to meet these requirements?
- AUse a static partition key like 'game_event' for all records to guarantee that all match events are sent to the same shard for sequential processing.
- Use the match ID as the partition key when publishing events to the Amazon Kinesis Data Stream.Cevap
- CDeploy the Lambda function in the public subnets of the VPC and assign it a public IP address to allow outbound communication to the external SaaS endpoint.
- Deploy the Lambda function in the private subnets of the VPC, and route outbound internet traffic through a NAT Gateway located in a public subnet.Cevap
- EConfigure the Lambda function's execution timeout to 15 minutes to ensure that execution context and database connection pools are preserved across all processed matches.
Cevap
Use the match ID as the partition key when publishing events to the Amazon Kinesis Data Stream, and deploy the Lambda function in the private subnets of the VPC, routing outbound internet traffic through a NAT Gateway located in a public subnet.
To achieve strict event ordering for each match, the events must be sent to the same shard of the Kinesis Data Stream. This is done by selecting a partition key with sufficient cardinality that groups related events, such as the match ID. For the Lambda consumer in a VPC to access an external SaaS endpoint over the internet, it must be placed in private subnets, with its outbound traffic routed to a NAT Gateway in a public subnet. Lambda functions inside a VPC cannot directly use an Internet Gateway or a public IP address.
Adım Adım Çözüm
Anahtar Kavram
Configuring partition keys in Kinesis Data Streams for order preservation and setting up NAT Gateways for Lambda VPC outbound connectivity.
Tahmini Süre:1m 30s