How to limit Lambda concurrency from an SQS queue?
A company uses an AWS Lambda function that reads messages from an Amazon Simple Queue Service (Amazon SQS) standard queue. The Lambda function makes an HTTP call to a third-party API for each message. The company wants to ensure that the Lambda function does not overwhelm the third-party API with more than two concurrent requests. Which solution will meet these requirements?
Community Votes
100% of anonymous learners picked answer D. Votes are pick records left by other test-takers — they are not the verified answer.
Community Insight
This question tests the ability to throttle Lambda concurrency specifically at the event source mapping level for SQS, rather than relying on global Lambda concurrency or batch size settings.
When an AWS Lambda function is triggered by an Amazon SQS standard queue, you can limit the number of concurrent invocations by configuring the maximum concurrency setting on the SQS event source mapping. This prevents the function from overwhelming downstream APIs with too many simultaneous requests.
Candidates often choose 'Configure a batch size of two' (Option B) or 'Configure a provisioned concurrency of two' (Option A), misunderstanding that batch size controls how many messages are processed per invocation, not the number of concurrent invocations, and provisioned concurrency sets a minimum, not a maximum limit.
Community Discussion (8 comments)
Comments & Corrections
No comments yet — spotted an error or have a note? Share it below.
Expert Analysis
The correct answer is D: Configure a maximum concurrency of two on the Amazon SQS event source mapping for the Lambda function.
AWS introduced the Maximum concurrency setting for SQS event source mappings to allow developers to throttle the number of concurrent Lambda invocations triggered by an SQS queue. By setting this value to 2, you ensure that no more than two Lambda function instances are processing messages at any given time, which directly addresses the requirement to avoid overwhelming the third-party API.
Why the other options are incorrect:
- Option A (Provisioned concurrency of two): Provisioned concurrency is used to keep a specified number of Lambda execution environments initialized and ready to respond to invocations. It sets a minimum capacity, not a maximum limit. It does not prevent Lambda from scaling beyond two concurrent invocations if the queue has more messages.
- Option B (Batch size of two): The batch size determines how many messages are retrieved from the SQS queue in a single polling request and passed to the Lambda function in one invocation. However, it does not limit the number of concurrent Lambda invocations. Multiple batches can still be processed concurrently, leading to more than two simultaneous HTTP calls to the third-party API.
- Option C (Event filtering): Event filtering allows you to control which messages are sent to the Lambda function based on message content. It does not control concurrency or the rate of processing, making it irrelevant to the requirement.
Official Reference
Exam Strategy
When a question involves limiting the rate or concurrency of Lambda invocations from an event source, focus on event source mapping configurations rather than global Lambda settings like provisioned concurrency. Always distinguish between batch size (messages per invocation) and concurrency (number of simultaneous invocations).
Related Analysis
Practice All DVA-C02 Questions
Access 100 questions with complete answers and detailed explanations.
View Full DVA-C02 Practice Test →