AWS Certified Developer – Associate (DVA-C02) — Question 271
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?
Answer options
- A. Configure a provisioned concurrency of two on the Lambda function.
- B. Configure a batch size of two on the Amazon SQS event source mapping for the Lambda function.
- C. Configure Lambda event filtering to process two messages from Amazon SQS at every invocations.
- D. Configure a maximum concurrency of two on the Amazon SQS event source mapping for the Lambda function.
Correct answer: D
Explanation
Configuring the maximum concurrency on the Amazon SQS event source mapping restricts the number of concurrent Lambda instances that can be invoked to process messages, ensuring the third-party API is not overwhelmed. Provisioned concurrency (Option A) only pre-warms execution environments and does not cap maximum concurrent executions, while batch size (Option B) only limits the number of records sent in a single invocation. Event filtering (Option C) is used for routing and discarding irrelevant messages rather than controlling execution concurrency.