What should the solutions architect do to resolve this issue with the LEAST operational overhead?
Set up long polling in the SQS queue by increasing the ReceiveMessage wait time to 30 seconds.
Change the SQS standard queue to an SQS FIFO queue. Use the message deduplication ID to discard duplicate messages.
Increase the visibility timeout in the SQS queue to a value that is greater than the total of the function timeout and the batch window timeout.
Modify the Lambda function to delete each message from the SQS queue immediately after the message is read before processing.
Explanations:
Long polling reduces the number of empty responses from the queue but does not prevent multiple invocations of the Lambda function due to the SQS queue delivering the same message multiple times.
While an SQS FIFO queue can prevent duplicate messages, it introduces additional complexity, and in this scenario, the issue is more related to Lambda retries, not message duplication.
Increasing the visibility timeout ensures that the message is not visible to other consumers while the Lambda function processes it, thus preventing multiple invocations.
Modifying the Lambda function to delete messages before processing could result in incomplete processing if the Lambda function crashes or takes too long. Proper message handling should be done in the SQS queue itself.