Question

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

A developer is configuring an AWS Lambda function to process a real-time data stream from Amazon Kinesis. During testing under high load, the Lambda function frequently times out because it cannot process the large batch of stream records within its configured execution time limit. Which action should the developer take to resolve this processing timeout issue?

  1. Decrease the batch size (BatchSize) in the Lambda event source mapping configuration.Answer
  2. B
    Change the partition key on the producer to a single static string to consolidate all records into one shard.
  3. C
    Move the Lambda function into a private VPC subnet with no NAT Gateway to decrease network latency.
  4. D
    Modify the trust policy of the Lambda execution role to allow the Kinesis service to assume the role.

Answer

Decrease the batch size (BatchSize) in the Lambda event source mapping configuration.
Decreasing the batch size in the event source mapping limits the number of stream records sent to the Lambda function during a single invocation. This directly reduces the computational load and time required to execute the function, preventing it from hitting the execution time limit.

Step-by-Step Solution

1
Identify the root cause of the Lambda function timeout when processing stream records.
The function is attempting to process too many records at once, exceeding the execution time limit.
Lambda polls Kinesis and retrieves records up to the configured BatchSize.
2
Adjust the BatchSize parameter in the event source mapping.
Fewer records are delivered to the Lambda function per invocation.
This reduces the total processing work per invocation, ensuring the function completes before timing out.

Key Concept

Configuring Kinesis event source mapping parameters for AWS Lambda to optimize stream processing.
Estimated Time:1m 0s
Rate this question