
Answer-first summary for fast verification
Answer: Direct API Gateway requests to an Amazon SQS queue, set Lambda's reserved concurrency to the third-party API's threshold, and have Lambda process messages from the SQS queue.
Option B is the correct answer. By directing the API Gateway requests to an Amazon SQS queue, the third-party stock application API can be protected from being overwhelmed. Amazon SQS can handle large numbers of requests and buffer them, allowing the AWS Lambda function to consume them at a controlled rate. By configuring the Lambda function with a reserved concurrency that matches the third-party application's capacity, you ensure that the Lambda function processes the requests at a rate that the third-party service can handle. This effectively prevents the service from being overloaded during peak times.
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
No comments yet.
A company's serverless ecommerce application uses Amazon API Gateway for a REST API, which triggers an AWS Lambda function. This function processes orders and stores them in Amazon DynamoDB, then communicates with a third-party stock application API. During peak times, the third-party API sometimes fails due to high request volumes. The company seeks a solution to prevent overwhelming this third-party service.
A
Utilize API Gateway to input requests directly into DynamoDB, employ a DynamoDB stream for invoking the third-party API, and eliminate the Lambda function.
B
Direct API Gateway requests to an Amazon SQS queue, set Lambda's reserved concurrency to the third-party API's threshold, and have Lambda process messages from the SQS queue.
C
Send API Gateway requests to an Amazon SNS topic, set Lambda's provisioned concurrency to match the third-party API's threshold, and process messages from the SNS topic.
D
Input API Gateway requests directly into Amazon Athena, use SQL for data transformation with query results directed to both DynamoDB and the third-party API, and remove the Lambda function.