Bitzu

SAA-C03 ยท Decoupling and serverless patterns

Amazon SNS and fan-out

Publish/subscribe with SNS topics, subscriber types, the SNS-to-multiple-SQS fan-out pattern and message filtering.

Key points

  • SNS: publish/subscribe; a producer publishes once to a topic, SNS pushes a copy to every subscription.
  • Subscribers: SQS queues, Lambda, Amazon Data Firehose, HTTP/S endpoints, or people (email, SMS, mobile push).
  • Fan-out: several SQS queues on one topic; each service gets its own durable copy at its own pace.
  • Filter policy: a subscription receives only the messages it cares about.

Source: https://docs.aws.amazon.com/sns/latest/dg/sns-event-destinations.html

Practice questions

Single choice

A subscription to an SNS topic has no filter policy. Which messages does it receive?

  1. No messages until a filter policy is added
  2. Only messages that carry message attributes
  3. Every message published to the topic
  4. Only messages sent after it was confirmed twice
Show answer

Answer: C. Every message published to the topic

Without a filter policy a subscriber gets every message published to the topic. Filtering only happens when you attach a filter policy to that subscription.

Select all that apply

Which of these can be subscribed directly to an SNS standard topic?

  1. An Amazon SQS queue
  2. An AWS Lambda function
  3. An Amazon EBS volume
  4. An HTTPS webhook endpoint
  5. An Amazon RDS table
Show answer

Answer: A. An Amazon SQS queue, B. An AWS Lambda function, D. An HTTPS webhook endpoint

SQS queues, Lambda functions and HTTP/S endpoints are all supported application-to-application destinations. An EBS volume and an RDS table are storage, not subscription endpoints; to land messages there you need a consumer such as a Lambda function.

True or false

An SNS topic keeps published messages so that a subscriber which was offline can poll the topic later and collect them.

Show answer

Answer: False

False. SNS pushes messages to subscribers; there is no polling of a topic. For a consumer that may be offline, subscribe an SQS queue: the queue persists the copy until the consumer reads it.

Practice 8 questions on this topic in Bitzu

Short lessons, instant explanations and spaced review of what you get wrong. Free on iOS and Android.

Download on the App StoreGet it on Google Play

More SAA-C03 topics in this module