Q48 — AWS DVA-C02 Ch.3
Question 48 of 100 | ← Chapter 3
A company receives food orders from multiple partners. It operates a microservices application using Amazon API Gateway APIs integrated with AWS Lambda. Each partner invokes a custom API exposed by API Gateway to submit orders. API invocations trigger a shared Lambda function to process orders. After processing, partners must receive notifications. Each partner must receive updates only for their own orders. The company wants to minimize code changes when adding new partners in the future. Which solution meets these requirements in the most scalable way?
- A. Create a separate Amazon Simple Notification Service (Amazon SNS) topic for each partner. Configure the Lambda function to publish each partner’s message to their respective SNS topic.
- B. Create a separate Lambda function for each partner. Configure each Lambda function to notify its partner’s endpoint directly.
- C. Create a single Amazon Simple Notification Service (Amazon SNS) topic. Configure the Lambda function to publish messages with specific attributes identifying the partner. Subscribe each partner to the SNS topic and apply appropriate subscription filter policies. ✓
- D. Create a single Amazon Simple Notification Service (Amazon SNS) topic. Subscribe all partners to the same SNS topic.
Correct Answer: C. Create a single Amazon Simple Notification Service (Amazon SNS) topic. Configure the Lambda function to publish messages with specific attributes identifying the partner. Subscribe each partner to the SNS topic and apply appropriate subscription filter policies.
Explanation
Option C is the most scalable: a single SNS topic with message attributes and subscription-level filtering allows new partners to be added simply by creating a new subscription with a filter policy — no code changes to the Lambda function or infrastructure reconfiguration. Option A creates operational overhead managing many topics. Option B violates separation of concerns and increases maintenance burden with each new partner. Option D lacks filtering, causing all partners to receive all messages — violating isolation and scalability. Thus, C is optimal.