AWS SNS - Simple Notification Service

What is SNS?

AWS SNS is a key component in many AWS architectures, short for "Simple Notification Service".

SNS is a highly available and highly scalable (within a region) AWS service which also supports retries for achieving reliable delivery.

SNS is a pub / sub system i.e. services publish messages to an SNS topic and on the other hand, services (or devices, emails etc.) can subscribe to topics, get notified or do some task.

SNS is a push system i.e. it pushes notifications to subscribers saving subscribers from having to poll for new messages.

simple-notification-service
Simple Notification Service

Types of Subscribers

Example SNS topic subscribers might be:

  • Email
  • SQS (Simple Queue Service)
  • Mobile phones
  • HTTP endpoints
  • Lambda
  • ...

SNS has fanout capabilities. This means it can deliver one message to many subscribers (one to many).

Types of Notifications

A Pubsliher/Subscriber flow might be application-to-person i.e. user notifications or application-to-application or system to system notifications.

An application-to-person example would be an application publishing a notification of a new product which is then delivered to customer emails via SNS.

An application-to-application example would be e.g. an order service receiving a new customer order and publishing a message to SNS which then notifies maybe some lambda functions, some business inteligence service and other services which might be interested in order-created events. The benefit of this solution is your order service is decoupled from other services and you don't have to worry about scaling and durability issues.

Example SNS Scenarios

Promotional emails:

sns-promotional-emails
Sending out promotional emails to millions of customers

New Orders:

sns-application-decoupling
Handling new orders and decoupling services

RDS Snapshots:

sns-rds
Work with RDS data without direct access

These are just a few examples. There are many many more AWS SNS use cases.

Also check out my AWS SQS post for another fanout architecture example.

Other SNS Details

  • An SNS topic can have 10Mil subscribers by default
  • One AWS account can have 100,000 SNS topics
  • An SNS message can have up to 256 KB of text data
  • Pricing is based on published messages, delivered notifications and other SNS API calls
  • Access to topics can be controlled via policies
  • SNS offers encryption of data
Adnan Mujkanovic

Adnan Mujkanovic

Full Stack Overflow Developer / YAML Indentation Specialist / Yak Shaving Expert
Gotham City