A serverless ecommerce workflow uses API Gateway to invoke a Lambda function that calls a third-party stock API. During peak load the third-party API fails when overwhelmed. The company needs a solution that prevents overwhelming the third-party API. Which design meets this need?
Choose an answer
Tap an option to check your answer.
Correct answer: Have API Gateway put requests into an Amazon SQS queue. Configure the Lambda function with reserved concurrency equal to the third-party API's threshold to process messages from the queue..
Why this is the answer
The correct solution uses Amazon SQS as a buffer and Lambda reserved concurrency to control the rate of calls to the third-party API. SQS decouples the API Gateway from the Lambda function, absorbing spikes in traffic and preventing requests from being lost. Lambda's reserved concurrency ensures that the function processing messages from the queue will not exceed a specified number of concurrent executions, effectively throttling calls to the third-party API to its known threshold. Incorrect options: Writing directly to DynamoDB and using a stream doesn't inherently throttle calls to the third-party API; the stream could still trigger the Lambda function too rapidly. Using Amazon SNS publishes messages to all subscribers simultaneously, which doesn't provide the necessary throttling mechanism for a single third-party API. Provisioned concurrency is for consistent, low-latency execution, not for throttling based on an external API's limit. Amazon Athena is an analytical query service for data in S3, not suitable for real-time request processing and routing to a third-party API.
Pass your exam — without the endless answer hunt
Get every verified question and explanation for this exam in one place, and save hours of prep. 1,000+ certifications · 20+ languages · free to start.
Pass your exam faster → No card needed