Skip to main content

Amazon SNS

Along with SQS, Amazon Simple Notification Service (SNS) is a default choice for message-based integration between services in AWS. Like SQS, SNS is elastically scalable and fully serverless, and the two are often used together.

From Amazon docs:

Amazon SNS provides topics for high-throughput, push-based, many-to-many messaging. Using Amazon SNS topics, your publisher systems can fan out messages to a large number of subscriber endpoints for parallel processing, including Amazon SQS queues, AWS Lambda functions, and HTTP/S webhooks. Additionally, SNS can be used to fan out notifications to end users using mobile push, SMS, and email.

Key differences between SNS and SQS are:

  • SNS supports a 'push' mechanism for consumers, whereas SQS requires consumers to poll (except for Lambda consumers).
  • SNS does not persist messages. Messages are sent to whichever consumers are subscribed at the time a message arrives, and retried if delivery fails. Whether delivery succeeds or fails (after retries) the message is deleted. If no consumers are subscribed then the message is lost. SQS instead stores messages until they are retrieved and acknowledged, subject to retention limits.