A developer is building a dispatch system for a ride-sharing application. The application streams real-time driver location updates to an Amazon Kinesis Data Stream. An AWS Lambda function deployed inside a private subnet of a VPC processes the stream to update an Amazon RDS database. In addition, the developer must route specific high-priority alert events from the stream to an Amazon EventBridge custom event bus. Which two actions should the developer take to ensure optimal stream shard utilization, prevent connectivity issues, and maintain secure integration? (Select TWO.)
- Configure the stream producer to use a high-entropy string, such as a hash of the driver ID and a timestamp, as the partition key for each location update.Answer
- Deploy a NAT Gateway in the public subnet or configure interface VPC endpoints for Kinesis and EventBridge in the VPC.Answer
- CConfigure the stream producer to use a static partition key like 'LocationUpdate' for all records to simplify stream processing.
- DDeploy the Lambda function in the private subnet without establishing a NAT Gateway or VPC endpoints, relying on default VPC routing to reach AWS services.
- EModify the Lambda execution role trust policy to list the Amazon Kinesis service principal as a trusted entity.
Answer
The developer should configure the stream producer to use a high-entropy partition key (such as a hash of the driver ID and timestamp) and deploy a NAT Gateway or configure VPC endpoints in the VPC.
To achieve optimal shard utilization and avoid throttling, records must be distributed evenly across shards. This is done by using a high-entropy partition key (such as a hash of the driver ID and a timestamp). Additionally, because the Lambda function is deployed within a private VPC subnet, it cannot access public endpoints like Kinesis and EventBridge by default. Providing a NAT Gateway or setting up VPC endpoints allows the function to securely reach these services.
Step-by-Step Solution
Key Concept
Distributing stream records with high-entropy partition keys and enabling public AWS service connectivity for VPC-bound Lambda functions.