I recently set up an SQS queue that is populated by a lambda. The queue then triggers instances of another lambda which does some calculations/DynamoDB writes. I tested the queue by populating it with 1000 messages. I was monitoring the queue and noticed that there were 1600 messages ‘in flight’. How is that possible? Are some messages sent more than once?
Quite possibly. SQS guarantees that messages will be sent AT LEAST once. If your app requires ONLY once then you have to add a unique ID to the messages and a system to track said unique IDs. Though 600 seems to be high.
600 does seem very high. OP, how is your lambda function processing the messages on the queue? Are you changing the message visibility, processing the message, then deleting it? If not, I would take a look into this, as well as the visibility timeout setting on your queue.
You could also look into using a FIFO queue. These queues provide exactly-once processing.