Question 17
Domain 3: Resilient Cloud SolutionsA company releases a new application in a new AWS account. The application includes an AWS Lambda function that processes messages from an Amazon Simple Queue Service (Amazon SQS) standard queue. The Lambda function stores the results in an Amazon S3 bucket for further downstream processing. The Lambda function needs to process the messages within a specific period of time after the messages are published. The Lambda function has a batch size of 10 messages and takes a few seconds to process a batch of messages. As load increases on the application's first day of service, messages in the queue accumulate at a greater rate than the Lambda function can process the messages. Some messages miss the required processing timelines. The logs show that many messages in the queue have data that is not valid. The company needs to meet the timeline requirements for messages that have valid data. Which solution will meet these requirements?
Correct answer: D
Explanation
SQS standard queues can redeliver messages, so invalid records in a batch can slow processing and cause valid messages to miss their deadlines. Keeping the batch size at 10 and enabling Lambda to "report failed batch items" lets successful messages be deleted while only bad ones are retried, and an SQS dead-letter queue isolates messages that continue to fail.
Why each option is right or wrong
A. Increase the Lambda function's batch size. Change the SQS standard queue to an SQS FIFO queue. Request a Lambda concurrency increase in the AWS Region.
FIFO changes ordering semantics, not invalid-message handling; larger batches can worsen retry impact from bad records.
B. Reduce the Lambda function's batch size. Increase the SQS message throughput quota. Request a Lambda concurrency increase in the AWS Region.
Higher quotas and smaller batches do not isolate poison messages that keep being retried.
C. Increase the Lambda function's batch size. Configure S3 Transfer Acceleration on the S3 bucket. Configure an SQS dead-letter queue.
S3 Transfer Acceleration helps client uploads, not Lambda-to-S3 processing delays from invalid SQS messages.
D. Keep the Lambda function's batch size the same. Configure the Lambda function to report failed batch items. Configure an SQS dead-letter queue.
Under the Lambda–SQS event source mapping, a batch is deleted only when the invocation succeeds; with partial batch response enabled, Lambda can return only the failed message IDs so the successfully processed records are removed immediately. This is the feature introduced by the `ReportBatchItemFailures` response type for SQS event sources, and it prevents one invalid record from forcing the entire batch of up to 10 messages to be retried. An SQS dead-letter queue is appropriate here because standard queues can redrive messages that exceed the queue’s `maxReceiveCount`, isolating the repeatedly invalid messages while allowing valid messages to meet the required processing window.