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?

  1. Configure a provisioned concurrency of two on the Lambda function.
  2. Configure a batch size of two on the Amazon SQS event source mapping for the Lambda function.
  3. Configure Lambda event filtering to process two messages from Amazon SQS at every invocations.
  4. Configure a maximum concurrency of two on the Amazon SQS event source mapping for the Lambda function. Source Reference Answer

Community Votes

D
100%

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)

monishvster 👍 7 Selected: D
Should be D. Source: https://aws.amazon.com/blogs/compute/introducing-maximum-concurrency-of-aws-lambda-functions-when-using-amazon-sqs-as-an-event-source/
DeaconStJohn 👍 5 Selected: D
Didn't like the wording. A - provisioned concurrency keeps 2 functions on warm standby for critical work. this is a minimum. question is asking about a maximum of 2. B - Batch of 2 is fine. latency could see this fall flat on it's face though. lambda invocations between function and SQS are limited to 2, not strictly between lambda and vendor API. C - event filtering is completely irrelevant here. D - Maximum is what the question is asking for. this will limit the amount of requests made to the vendor API. I would much prefer to set the reserved concurrency at the lambda level but this can be overridden at the SQS event source mapping level so I guess this is the best answer.
ShakthiGCP 👍 1 Selected: D
Sqs event source mapping
65703c1 👍 1 Selected: D
D is the correct answer.
Abdullah22 👍 3 Selected: D
going with D
SerialiDr 👍 2 Selected: A
Controlled Execution: Provisioned concurrency ensures that a minimum number of Lambda execution environments are always available. Setting it to two guarantees that only two Lambda function instances can process messages from the SQS queue concurrently. Independent of Message Batch Size: Even if the SQS event source mapping delivers a batch of messages exceeding two, the provisioned concurrency limits the number of Lambda invocations happening simultaneously.
CrescentShared 👍 1 Selected: B
configuring a maximum concurrency of two on the SQS event source mapping, is not a valid option. The concept of maximum concurrency is not directly applicable to SQS event source mappings. Concurrency in the context of Lambda functions and SQS is controlled by the batch size and the function's reserved concurrency settings.
tgv 👍 5 Selected: D
Correct answer is D. The maximum concurrency setting on the Amazon SQS event source mapping for the Lambda function controls how many messages are sent to the Lambda function concurrently. By setting it to two, you ensure that only two messages are processed concurrently, preventing the Lambda function from overwhelming the third-party API with more than two concurrent requests.

Comments & Corrections

No comments yet — spotted an error or have a note? Share it below.

Log in to comment, report an error, or add a note about this question.

Submitted for moderation before publishing. Keep it helpful and respectful.

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.
Community consensus strongly supports Option D, with users confirming that the maximum concurrency setting on the SQS event source mapping is the correct mechanism to limit concurrent Lambda invocations triggered by SQS.

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 →

← Back to DVA-C02 Study Guide