DVA-C02 Question 56
Select 2You are developing a serverless application that processes customer orders. When a customer places an order, the system should trigger inventory updates, payment processing, and email notifications asynchronously. The response to the customer should not wait for these processes to complete. Which AWS service combination is the most appropriate to implement this event-driven architecture?
- A
Amazon Simple Notification Service (SNS) and AWS Lambda
- B
Amazon Simple Queue Service (SQS) and AWS Lambda
- C
Amazon DynamoDB Streams and AWS Lambda
- D
Amazon API Gateway and AWS Lambda
- E
Amazon Kinesis Data Streams and AWS Lambda
Show answer and explanation
Correct answers: A, B
Explanation
An event-driven architecture for customer orders can be effectively implemented using Amazon SNS and SQS with AWS Lambda. SNS allows event notifications to be sent to multiple subscribers asynchronously, while SQS enables decoupling and buffering of tasks, ensuring reliable delivery to processing systems like Lambda functions. These services provide the necessary scalability and flexibility for the given scenario.
- A. Correct.
Amazon SNS can be used to fan out events to multiple subscribers, such as AWS Lambda functions. This is suitable for asynchronous event-driven architectures where multiple systems need to react to a single event.
- B. Correct.
Amazon SQS is a message queue service that can decouple and buffer tasks between producers and consumers. Combined with AWS Lambda, it allows asynchronous processing of events, making it ideal for handling tasks like inventory updates and payment processing.
- C. Incorrect.
While DynamoDB Streams can trigger AWS Lambda for changes in a DynamoDB table, it is not the best fit for this scenario as the question does not specify that customer orders are stored in DynamoDB.
- D. Incorrect.
Amazon API Gateway is used to expose RESTful APIs but does not inherently support asynchronous event-driven processing. It is not a suitable choice for the given scenario.
- E. Incorrect.
Amazon Kinesis Data Streams is used for real-time data streaming but is more suitable for processing continuous data streams rather than discrete events like placing an order.