There is an SQS which acts as input trigger for a lambda. The batch size of the records to be fetched from the SQS is 10.
While processing these 10 records, if the lambda times out, will all these 10 records/ messages be available for processing again? Or will the ones that are processed get removed from the SQS?
I tried to look for this in a couple of docs: link1, link2. But couldn't find it.
If the 10 messages do become available for processing, then a possible solution I am thinking to implement is: Keep deleting the messages once they are processed. But even if I delete the messages, will they become available once the lambda times out?
The page on Visibility Timeouts which you linked to starts with this sentence:
When a consumer receives and processes a message from a queue, the message remains in the queue.
The Lambda function in your example is the "consumer" of messages from SQS. It receives and processes a batch of messages, but those messages are still in the queue.
There is also a page on Using AWS Lambda with Amazon SQS, which briefly mentions this:
Lambda reads messages in batches and invokes your function once for each batch. When your function successfully processes a batch, Lambda deletes its messages from the queue.
Here, the Lambda Event Source provides part of the "consumer" code, and deletes messages that it knows are processed. But it only has two states: your Lambda function succeeded, so the batch should be deleted; or your Lambda function failed, so the batch should not be deleted.
In order to have some messages "succeed" and some "fail", you would need to tell SQS that. There is no separate verb to "acknowledge" each message as you process it; quoting the Visibility Timeouts page again:
Thus, the consumer must delete the message from the queue after receiving and processing it.
So, if your Lambda function wants to mark individual messages as processed, it will need to call the DeleteMessage API.