SAA-C03 · Question #584
A company is migrating from a monolithic architecture for a web application that is hosted on Amazon EC2 to a serverless microservices architecture. The company wants to use AWS services that…
The correct answer is B. Configure an Amazon API Gateway REST API to invoke an AWS Lambda function that publishes. A company is migrating a monolithic web application to a serverless microservices architecture, requiring an event-driven, loosely coupled system using a publish/subscribe pattern, with the most cost-effective solution.
Question
A company is migrating from a monolithic architecture for a web application that is hosted on Amazon EC2 to a serverless microservices architecture. The company wants to use AWS services that support an event-driven, loosely coupled architecture. The company wants to use the publish/subscribe (pub/sub) pattern. Which solution will meet these requirements MOST cost- effectively?
Options
- AConfigure an Amazon API Gateway REST API to invoke an AWS Lambda function that publishes
- BConfigure an Amazon API Gateway REST API to invoke an AWS Lambda function that publishes
- CConfigure an Amazon API Gateway WebSocket API to write to a data stream in Amazon Kinesis
- DConfigure an Amazon API Gateway HTTP API to invoke an AWS Lambda function that publishes
How the community answered
(37 responses)- A3% (1)
- B81% (30)
- C11% (4)
- D5% (2)
Why each option
A company is migrating a monolithic web application to a serverless microservices architecture, requiring an event-driven, loosely coupled system using a publish/subscribe pattern, with the most cost-effective solution.
This option is very similar to the correct answer but specifies 'multiple Amazon API Gateway REST APIs' for publishing. For a single entry point that initiates a pub/sub flow, using a single API Gateway REST API is typically more cost-effective than managing multiple separate APIs, making option B generally more efficient.
This solution effectively implements a serverless publish/subscribe pattern using cost-effective AWS services. Amazon API Gateway provides a RESTful entry point, an AWS Lambda function processes the request and publishes messages to an Amazon SNS topic, and multiple other Lambda functions can subscribe to the SNS topic for asynchronous, event-driven processing, ensuring loose coupling and cost-efficiency.
Using an Amazon API Gateway WebSocket API is for persistent, bidirectional communication and is generally more expensive and complex than a standard REST API for a one-way publish/subscribe pattern. Amazon Kinesis Data Streams, while excellent for high-throughput streaming, is also typically more expensive than Amazon SNS for broadcast-style pub/sub for loosely coupled event-driven architectures.
While an Amazon API Gateway HTTP API is a cost-effective API type, publishing to an Amazon SQS queue primarily supports point-to-point messaging or work queues, not the fan-out 'publish/subscribe (pub/sub) pattern' explicitly requested, which is best handled by Amazon SNS for broadcasting to multiple subscribers.
Concept tested: Serverless pub/sub, event-driven architectures, cost optimization
Source: https://aws.amazon.com/sns/ ; https://aws.amazon.com/lambda/ ; https://aws.amazon.com/api-gateway/
Community Discussion
No community discussion yet for this question.