1️⃣ Don’t forget to delete message from SQS, it won’t be deleted automatically if Lambda fails.
2️⃣ Value of the timeout parameter in Lambda should always be less than the visibility_timeout parameter in SQS. As a best practice, set the visibility_timeout value to six times the Lambda function timeout.
3️⃣ While using batching, remember that all messages in a failed batch return to the queue. So even if you have successful messages in a batch, they will return to the queue.
4️⃣ If Lambda function throws errors, it will be scaled down automatically even when messages remain in the queue. Use SQS dead-letter queue to process failed messages to avoid such behaviour.
5️⃣ Pay attention that despite the fact SQS is bottomless, it has inflight limits of 120,000 messages so it can be a bottleneck for your Lambda.
You can use Serverless Land CDK patterns to deploy Lambda + SQS
If you like this post, you can share APAWS newsletter with friends:
🙌 great, create a blog on aws Identity Centers and IAM