Lambda and SQS

Here’s how to avoid lambda throttling when lambda concurrency is limited:

The maximum concurrency setting limits the number of concurrent instances of the function that an Amazon SQS event source can invoke.

You can configure maximum concurrency on new and existing Amazon SQS event source mappings.

Link: https://docs.aws.amazon.com/lambda/latest/dg/with-sqs.html

Introducing maximum concurrency of AWS Lambda functions when using Amazon SQS as an event source

Reserved concurrency for lambda

Reserved concurrency – Reserved concurrency is the maximum number of concurrent instances you want to allocate to your function. When a function has reserved concurrency, no other function can use that concurrency. There is no charge for configuring reserved concurrency for a function.

SQS Overpull issue (lambda throttles when reserved concurrency is reached)

Put simply, if maximum concurrency is higher than the available concurrency, you will still experience the SQS overpull issue.

Configure maximum concurrency using the Lambda console

  • Open the Functions page of the Lambda console.
  • Choose the name of a function.
  • Under Function overview, choose SQS. This opens the Configuration tab.
  • Select the Amazon SQS trigger and choose Edit.
  • For Maximum concurrency, enter a number between 2 and 1,000. To turn off maximum concurrency, leave the box empty.
  • Choose Save.

Set in cloudformation

event source mapping ->scaling config->maximum concurrency