
Answer-first summary for fast verification
Answer: Use an API Gateway integration to send a message to an Amazon Simple Queue Service (Amazon SQS) FIFO queue when the application receives an order. Configure the SQS FIFO queue to invoke an AWS Lambda function for processing.
## Explanation **Correct Answer: B** **Why Option B is correct:** 1. **SQS FIFO queues guarantee first-in-first-out (FIFO) delivery** - This is the key requirement for processing orders in the exact order they are received. 2. **FIFO queues maintain strict ordering** - Messages are processed in the exact order they are sent, which is essential for ecommerce order processing where sequence matters. 3. **API Gateway can integrate directly with SQS** - API Gateway has native integration with SQS, allowing it to send messages to SQS queues. 4. **SQS can trigger Lambda functions** - SQS FIFO queues can be configured to invoke Lambda functions for message processing. **Why other options are incorrect:** **Option A (SNS):** - SNS is a pub/sub messaging service that does not guarantee message ordering. - Multiple subscribers may receive messages in different orders. - SNS is designed for fan-out scenarios, not ordered processing. **Option C (API Gateway authorizer):** - API Gateway authorizers are for authentication/authorization, not for order processing. - Blocking requests while processing would create a bottleneck and poor user experience. - This approach doesn't solve the ordering problem; it just creates serial processing. **Option D (SQS Standard Queue):** - SQS Standard queues provide best-effort ordering but don't guarantee FIFO delivery. - Messages may occasionally be delivered out of order, which is unacceptable for order processing. - Standard queues are designed for high throughput, not strict ordering. **Key AWS Services Used:** - **Amazon SQS FIFO Queue**: Provides exactly-once processing and strict ordering - **API Gateway**: Receives HTTP requests and integrates with SQS - **AWS Lambda**: Processes messages from the SQS queue **Architecture Flow:** 1. Client → API Gateway (order request) 2. API Gateway → SQS FIFO Queue (message with order details) 3. SQS FIFO Queue → Lambda Function (triggered for processing) 4. Lambda processes order in exact FIFO sequence
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
No comments yet.
A company is building an ecommerce web application on AWS. The application sends information about new orders to an Amazon API Gateway REST API to process. The company wants to ensure that orders are processed in the order that they are received.
Which solution will meet these requirements?
A
Use an API Gateway integration to publish a message to an Amazon Simple Notification Service (Amazon SNS) topic when the application receives an order. Subscribe an AWS Lambda function to the topic to perform processing.
B
Use an API Gateway integration to send a message to an Amazon Simple Queue Service (Amazon SQS) FIFO queue when the application receives an order. Configure the SQS FIFO queue to invoke an AWS Lambda function for processing.
C
Use an API Gateway authorizer to block any requests while the application processes an order.
D
Use an API Gateway integration to send a message to an Amazon Simple Queue Service (Amazon SQS) standard queue when the application receives an order. Configure the SQS standard queue to invoke an AWS Lambda function for processing.