Question

Difficulty: MediumServerless Development with AWS Lambda

A developer is building a serverless application where an AWS Lambda function processes records from an Amazon Kinesis data stream. During testing, some malformed records cause the Lambda function to return an error, which causes the entire batch of records to be retried repeatedly. This retry behavior blocks the stream partition and causes processing latency to increase. The developer wants to configure the event source mapping to automatically split the failed batch and retry the smaller batches to isolate the malformed records. Which configuration change should the developer implement to achieve this goal?

  1. A
    Increase the execution timeout of the Lambda function to allow it to process the entire batch again.
  2. B
    Deploy the Lambda function in a private VPC subnet and configure a NAT Gateway to route retry requests.
  3. Configure the event source mapping with BisectBatchOnFunctionError set to true.Answer
  4. D
    Increase the visibility timeout of the event source mapping to exceed the Lambda function timeout.

Answer

Configure the event source mapping with BisectBatchOnFunctionError set to true.
Configuring the event source mapping with BisectBatchOnFunctionError set to true tells Lambda to split a failed batch into two halves and retry them. This process repeats until the problematic record is isolated, allowing the other valid records in the batch to be processed successfully.

Step-by-Step Solution

1
Analyze the problem requirements.
The developer wants to prevent a failed batch of Kinesis records from repeatedly failing in its entirety, blocking the partition.
Understanding the goal helps select the correct event source mapping configuration.
2
Evaluate Amazon Kinesis event source mapping error handling features.
Lambda event source mappings for Kinesis support BisectBatchOnFunctionError.
This option allows Lambda to bisect the batch when a function error occurs and retry each half.
3
Select the configuration that isolates the bad records.
Setting BisectBatchOnFunctionError to true splits the batch recursively until the failing record is processed individually.
This minimizes duplicate processing of successful records and unblocks the stream.

Key Concept

Handling batch processing errors in AWS Lambda event source mappings for stream sources.
Estimated Time:1m 30s
Rate this question