Q14 — AWS DVA-C02 Ch.2

Question 14 of 100 | ← Chapter 2

A company has built a serverless application for its e-commerce workload. The application includes a REST API in Amazon API Gateway that invokes an AWS Lambda function. The Lambda function processes data and stores it in an Amazon DynamoDB table. The Lambda function also calls a third-party stock fulfillment application API to process orders. After order processing completes, the Lambda function returns an HTTP 200 status code to the client with no response body. During peak periods, when API calls exceed a defined threshold, the third-party stock fulfillment application sometimes fails to process requests and returns error messages. The company requires a solution that prevents overwhelming the third-party stock fulfillment application. Which solution meets these requirements?

Correct Answer: B. Configure the REST API in Amazon API Gateway to write requests directly to an Amazon Simple Queue Service (Amazon SQS) queue. Set the Lambda function's reserved concurrency to match the third-party stock fulfillment application's threshold. Configure the Lambda function to process messages from the SQS queue.

Explanation

Option A suggests using a DynamoDB stream to invoke the third-party stock fulfillment application API, which could overload the third-party application because every DynamoDB write triggers an invocation — thus it is not a suitable solution. Option B recommends writing requests to an Amazon SQS queue and setting the Lambda function’s concurrency limit to match the third-party application’s threshold. This avoids direct overload and leverages SQS for asynchronous, buffered processing — making it appropriate. Option C proposes using Amazon SNS, but SNS is designed for publish/subscribe messaging and is not ideal for ordered, reliable, or rate-limited request processing in this scenario. Option D suggests using Amazon Athena, which is intended for ad-hoc querying of data stored in Amazon S3, not for transactional request handling or integration with external APIs — hence unsuitable.