Incident and Event Response

A Lambda function processes Amazon SQS FIFO batches in order, but a failed record causes successfully processed records to be retried. The engineer enables ReportBatchItemFailures on the event source mapping; how should the function handle a failure to preserve ordering and avoid retrying successful records?

Show the answer

Correct answerD. Stop processing the batch and return the failed and unprocessed record identifiers.

AWhy not this: Continuing after a failure can process later records out of order; unprocessed records must also be reported.

BWhy not this: Reporting every identifier causes successfully processed records to be retried and does not preserve processing order after failure.

CWhy not this: An exception causes the entire batch to fail, even when partial batch reporting is enabled.

DWhy this is right: Reporting failed and unprocessed records preserves ordering while excluding records already processed successfully.

For FIFO queues, stop after the first failure and report both failed and unprocessed records so they can be retried without disrupting ordering. Reporting only the failed record while continuing can process later records before their failed predecessor.