SNS (Simple Notification Service)

Amazon SNS is a fully managed pub/sub messaging service that enables you to decouple microservices, distributed systems, and event-driven serverless applications.
More Information
How It Worksโ
- A publisher sends a message to an SNS topic
- The topic delivers the message to all its subscribers
- SNS follows the publish-subscribe (pub/sub) messaging pattern
More Information
Topic Typesโ
Standard Topicโ
- Default topic type
- Nearly unlimited throughput
- At-least-once message delivery
- Best-effort ordering
FIFO Topicโ
- Strict message ordering (first-in-first-out)
- Exactly-once message delivery
- Up to 300 publishes per second (or 10 MB per second)
- FIFO topic names must end with the
.fifosuffix - Can only have SQS FIFO queues as subscribers
More Information
Subscriptionsโ
Supported subscription protocols:
- HTTP/HTTPS: delivers messages to a specified URL
- Email/Email-JSON: sends messages via email
- Amazon SQS: delivers messages to an SQS queue
- AWS Lambda: invokes a Lambda function
- Amazon Kinesis Data Firehose: delivers messages to a Firehose delivery stream
- SMS: sends text messages to phone numbers
- Platform application endpoint: delivers messages to mobile devices (push notifications)
More Information
Message Filteringโ
- By default, a subscriber receives every message published to the topic
- A subscription filter policy can be applied so the subscriber only receives messages that match specific attributes
- Filter policies can be applied to message attributes or to the message body
More Information
Fanout Patternโ
- A common pattern where an SNS topic is combined with multiple SQS queues
- A message published to the topic is delivered to all subscribed queues, allowing parallel asynchronous processing
- Useful for decoupling systems that need to react to the same event independently
More Information
Dead-Letter Queueโ
- An SQS queue that an SNS subscription can target for messages that could not be successfully delivered to subscribers
- Useful for debugging and isolating undeliverable messages
- Configured per subscription, not per topic
Encryptionโ
- Server-side encryption (SSE) protects the contents of messages published to a topic using AWS KMS keys
- Messages are encrypted as soon as they are received by SNS and stored in encrypted form
- Messages are decrypted just before delivery to subscribed endpoints
Access Controlโ
- Topic access can be controlled via:
- IAM policies
- SNS access control policies (resource-based policies)
- By default, only the topic owner can publish or subscribe to a topic