AWS Developer DVA-C02 · Development with AWS Services · hard

An AWS Lambda function polls an Amazon SQS standard queue via an Event Source Mapping with a batch size of 10 messages. During one invocation, 8 messages are processed successfully, but 2 messages fail due to a transient downstream timeout. By default, if the Lambda function throws an unhandled exception, all 10 messages return to the queue and the 8 succeeded messages get reprocessed. Which two actions should the developer take so only the 2 failed messages are retried? (Select two.)

Published · Last updated · checked before publication — how we verify questions

Options

  • AEnable ReportBatchItemFailures on the Lambda SQS Event Source MappingCorrect answer
  • BSet the SQS queue VisibilityTimeout to 0 seconds for every received message
  • CConvert the Lambda execution role into a Cognito User Pool token authorizer
  • DReturn a JSON payload listing failed itemIdentifier IDs in batchItemFailuresCorrect answer

Answers: A. Enable ReportBatchItemFailures on the Lambda SQS Event Source Mapping; D. Return a JSON payload listing failed itemIdentifier IDs in batchItemFailures

To enable partial batch responses on an SQS-to-Lambda Event Source Mapping, you must enable ReportBatchItemFailures in the Event Source Mapping configuration (functionResponseTypes: ["ReportBatchItemFailures"]) (A) and have the Lambda handler return a JSON object listing the failed message IDs under batchItemFailures: [{ "itemIdentifier": "<msgId>" }] instead of throwing an unhandled error (D).

Why the other options are wrong

  • B. Set the SQS queue VisibilityTimeout to 0 seconds for every received message — Setting VisibilityTimeout to 0 makes messages immediately visible to other consumers while still executing, causing duplicate processing.
  • C. Convert the Lambda execution role into a Cognito User Pool token authorizer — Cognito User Pools authenticate end-user JWTs on API Gateway, not SQS batch retry semantics.

All Development with AWS Services questions and the topic overview →

AWS and Amazon Web Services are trademarks of Amazon.com, Inc. PrepIQ Hub is not affiliated with, endorsed by, or sponsored by Amazon Web Services.