Question

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

A logistics company tracks fleet vehicle coordinates using IoT devices. The devices stream geolocation data to an Amazon Kinesis Data Stream. An AWS Lambda function is configured as a consumer to process batches of records and write them to a database inside a private VPC subnet. During peak hours, the developer notices two issues:
1. Some shards in the Kinesis Data Stream are experiencing ProvisionedThroughputExceededException errors, while others are underutilized.
2. The Lambda function runs but is unable to connect to external endpoints to fetch auxiliary driver details, resulting in connection timeouts.

Which two actions should the developer take to resolve these issues? (Select TWO.)

  1. Modify the producer application to use a high-entropy partition key, such as a combination of vehicle ID and timestamp, instead of a static region ID.Answer
  2. B
    Modify the producer application to use the vehicle's manufacturing year as the partition key to group data logically.
  3. Configure a NAT Gateway in a public subnet of the VPC, and update the route table of the private subnet to route all outbound traffic (0.0.0.0/00.0.0.0/0) to the NAT Gateway.Answer
  4. D
    Increase the Lambda function's timeout configuration to allow the connection attempts to retry and succeed without modifying subnet routing.
  5. E
    Modify the Lambda function's IAM execution role trust policy to allow the Kinesis service to write records directly to the VPC database.

Answer

Modify the producer application to use a high-entropy partition key (vehicle ID combined with a timestamp) and configure a NAT Gateway in a public subnet of the VPC to route outbound traffic from the private subnet.
Using a high-entropy partition key (vehicle ID combined with a timestamp) ensures data is evenly distributed across Kinesis shards, avoiding hot shards. Configuring a NAT Gateway in a public subnet and updating the private subnet route tables provides the Lambda function inside the private subnet with a valid path to route outbound traffic to the internet.

Step-by-Step Solution

1
Analyze Kinesis Data Stream metrics and identify that uneven write distribution is causing ProvisionedThroughputExceededException errors.
Confirm that a low-entropy partition key (region ID) causes hot shards.
Correcting the partition key to a high-entropy value (vehicle ID and timestamp) ensures write distribution across all shards.
2
Inspect Lambda configuration and subnets to identify why outbound connections to external endpoints are failing.
Confirm the Lambda function is in private subnets with no route to the internet.
Lambda functions in private VPC subnets require a NAT Gateway in a public subnet to communicate with external endpoints.

Key Concept

Amazon Kinesis Data Stream partitioning and AWS Lambda VPC network routing.
Rate this question