CLF-C02 Practice Question 48: Fan Out Notifications
AWS Certified Cloud Practitioner (CLF-C02) · Test 5 · question 8 of 10
When a customer places an order, an application must send the same order message to three places: an Amazon SQS queue used by the warehouse, an AWS Lambda function that updates analytics, and the sales team's email addresses. The developers want the application to publish each message only once. Which service should they use?
Show answer and explanation
Answer:
Amazon SNS delivers messages from publishers to subscribers through a *topic*. The application publishes the order to the topic once, and SNS pushes a copy to every subscriber. This pattern is called fanout. A single topic can have subscribers of different types, including SQS queues, Lambda functions, HTTP(S) endpoints, email, SMS and mobile push, so the warehouse queue, the analytics function and the sales team's inboxes all receive the message.
Option A, Amazon SQS, is a queue that consumers *poll*. A message in one queue is processed by one consumer, so SQS alone cannot copy a message to a Lambda function and an email list. It is usually a *subscriber* to an SNS topic in this design, not a replacement for one. Option B, AWS Step Functions, runs a sequence of steps as a workflow. You could build this with it, but it is orchestration, not a way to publish once and let independent subscribers receive copies. Option D, Amazon SES, sends email, but it cannot deliver to an SQS queue or a Lambda function.
Reference: What is Amazon SNS?