Soru

Zorluk: OrtaStream Processing and Event Routing with Amazon Kinesis and EventBridge

A developer is building an IoT application where temperature sensors send data to an Amazon Kinesis Data Stream. An AWS Lambda function is configured to process the stream in batches and write the processed records to a database inside a private subnet of a VPC. During testing, the developer notices two issues: some shards are heavily throttled with ProvisionedThroughputExceededException errors, and the Lambda function cannot access the Kinesis stream endpoints to read the records. How should the developer resolve both the stream throttling and the Lambda connectivity issues?

  1. Select the unique device ID as the Kinesis partition key to distribute data evenly across shards, and configure interface VPC endpoints for Kinesis in the VPC to allow the Lambda function to access the stream.Cevap
  2. B
    Select the city where the device is located as the Kinesis partition key to group the data, and configure a NAT Gateway in the public subnet to allow the Lambda function to access the stream.
  3. C
    Select the unique device ID as the Kinesis partition key, and modify the Lambda function's IAM role trust policy to allow direct service access to the VPC resources while increasing the Lambda function timeout to handle network retries.
  4. D
    Select a static string as the partition key to guarantee ordering across all shards, and ensure the Lambda function is placed in the private subnet with no NAT Gateway or VPC endpoints to prevent external access.

Cevap

Select the unique device ID as the Kinesis partition key to distribute data evenly across shards, and configure interface VPC endpoints for Kinesis in the VPC to allow the Lambda function to access the stream.
The correct option addresses both the data distribution and network access requirements. First, using the unique device ID as the partition key provides high entropy, which distributes the data evenly across Kinesis shards, preventing hot shards and ProvisionedThroughputExceededException errors. Second, deploying interface VPC endpoints (AWS PrivateLink) inside the VPC allows the Lambda function in the private subnet to securely communicate with Kinesis endpoints without routing traffic over the public internet.

Adım Adım Çözüm

1
Analyze partition key entropy for Kinesis Data Streams.
Using a high-entropy value like the unique device ID distributes records uniformly across shards, avoiding the hot shard problem.
Uneven data distribution causes ProvisionedThroughputExceededException errors when one shard receives disproportionate traffic.
2
Address private subnet network routing for AWS Lambda.
By adding interface VPC endpoints (PrivateLink) for Kinesis, traffic stays within the AWS network and allows the private Lambda function to reach the service.
Lambda functions in private subnets cannot access public AWS endpoints directly unless they go through a NAT Gateway or VPC endpoints.

Anahtar Kavram

Selecting high-entropy partition keys for Amazon Kinesis to avoid hot shards, and using VPC endpoints for private resource connectivity.
Bu soruyu puanla