AWS — Amazon SNS Overview

Introduction to Amazon Simple Notification Service

Image for post
Amazon SNS

TL;DR:

AWS SNS is a web service that coordinates and manages the delivery or sending of messages to subscribing endpoints or clients.

And makes it easy to set up, operate, and send a notification from the cloud.

It provides developers with the highly scalable, cost-effective, and flexible capability to publish messages from an application and sends them to other applications.

  • It follows the publish-subscribe(pub-sub) messaging paradigm with notification being delivered to the client using a push mechanism that eliminates the need to periodically check or poll for new information and updates.
  • To prevent the message from being lost, all messages published to Amazon SNS are stored redundantly across multiple Availability Zones.
  • SNS can also send the messages to devices by sending push notifications to Apple, Google, Fire OS, and Windows devices, as well as Android devices in China with Baidu Cloud Push.
  • Amazon SNS allows you to group multiple recipients using topics where the topic is a logical access point that sends the identical copies of the same message to the subscribe recipients.

SNS has three major components

Publisher

  • The entity that triggers the sending of a message(e.g. CloudWatch Alarm, Any application or S3 events)
  • Publishers are also known as producers that produce and send the message to the SNS which is a logical access point

Topic

  • Object to which you publish your message
  • Subscriber subscribe to the topic to receive the message
  • By default, SNS offers 100,000 topics per account (Soft limit)
  • With the exception of SMS messages, Amazon SNS messages can contain up to 256 KB of text data, including XML, JSON and unformatted text

Subscriber

  • An endpoint to a message is sent. Message are simultaneously pushed to the subscriber
  • Subscribers such as web servers, email addresses, Amazon SQS queues, AWS Lambda functions receive the message or notification from the SNS over one of the supported protocols (Amazon SQS, email, Lambda, HTTP, SMS)
  • Subscriber subscribe to the topic to receive the message
  • By default, SNS offers 10 million subscriptions per topic (Soft limit)

Amazon SQS and SNS are lightweight, fully managed message queue and topic services that scale almost infinitely and provide simple, easy-to-use APIs. You can use Amazon SQS and SNS to decouple and scale microservices, distributed systems, and serverless applications, and improve reliability.

Benefits of SNS

  • Instantaneous delivery
    SNS is based on push-based delivery. This is the key difference between SNS and SQS. SNS is pushed once you publish the message in a topic and the message is delivered to multiple subscribers.
  • Flexible
    SNS supports multiple endpoint types. Multiple endpoint types can receive the message over multiple transport protocols such as email, SMS, Lambda, Amazon SQS, HTTP, etc.
  • Inexpensive
    SNS service is quite inexpensive as it is based on pay-as-you-go model, i.e., you need to pay only when you are using the resources with no up-front costs.
  • Ease of use
    SNS service is very simple to use as Web-based AWS Management Console offers the simplicity of the point-and-click interface.
  • Simple Architecture
    SNS is used to simplify the messaging architecture by offloading the message filtering logic from the subscribers and message routing logic from the publishers. Instead of receiving all the messages from the topic, SNS sends the message to subscriber-only of their interest.