Search code examples
amazon-web-servicesamazon-sqs

AWS SQS message concurrent processing


I have connected an SQS to a lambda(Lambda 1). The lambda(Lambda 1) makes API calls to a service. I have to seed 1000 messages at once. For that, I am sending 1000 messages to SQS with the help of another lambda(Lambda 2). The problem I am facing is that the SQS triggers 1000 lambda which makes 1000 API calls to my service leading to service unavailability.

Can I configure the SQS frequency for example, in 1 second the SQS should only process 10 or 100 messages?


Solution

  • Limiting a lambda function's allowed concurrency

    In short you set how many concurrent executions this lambda can have

    enter image description here

    Intro: https://aws.amazon.com/about-aws/whats-new/2017/11/set-concurrency-limits-on-individual-aws-lambda-functions/

    Docs: https://docs.aws.amazon.com/lambda/latest/dg/invocation-scaling.html