AWS Certified Solutions Architect - Associate / Question #1939 of 1019

Question #1939

A company is migrating from a monolithic architecture for a web application hosted on Amazon EC2 to a serverless microservices architecture. The company requires an event-driven, loosely coupled design using the publish/subscribe (pub/sub) pattern while minimizing costs. Which solution meets these requirements MOST effectively?

A

Configure an Amazon API Gateway REST API to invoke an AWS Lambda function that publishes events to an Amazon Simple Queue Service (Amazon SQS) queue. Configure subscribers to poll the queue for events.

B

Configure an Amazon API Gateway REST API to invoke an AWS Lambda function that publishes events to an Amazon Simple Notification Service (Amazon SNS) topic. Configure subscribers to receive events from the topic.

C

Configure an Amazon API Gateway WebSocket API to write events to an Amazon Kinesis Data Stream with enhanced fan-out. Configure subscribers to consume events from the stream.

D

Configure an Amazon API Gateway HTTP API to invoke an AWS Lambda function that publishes events to an Amazon Simple Notification Service (Amazon SNS) topic. Configure subscribers to receive events from the topic.

Explanation

Option D is the best choice because:
1. HTTP API vs. REST API: Amazon API Gateway HTTP API is cheaper than REST API, aligning with the cost-minimization requirement.
2. Pub/Sub with SNS: Amazon SNS natively supports the pub/sub pattern, enabling event-driven, loose coupling by pushing events to multiple subscribers (e.g., Lambda, SQS, HTTP endpoints).
3. Serverless Architecture: Lambda and SNS are serverless, reducing operational overhead.

Other options:
- A: Uses SQS (pull-based), which requires polling and lacks native pub/sub, increasing latency and cost.
- B: Uses REST API, which is more expensive than HTTP API.
- C: Kinesis with enhanced fan-out is costly and overkill for basic pub/sub use cases.

Key Points: Use HTTP API for cost savings, SNS for pub/sub, and serverless services for scalability and minimal management.

Answer

The correct answer is: D