In this post, we provide an overview of AWS Simple Notification Service (SNS), dive into its core concepts, and explore how to publish messages, manage subscriptions, and utilise message filtering.
What is AWS SNS?
AWS Simple Notification Service (SNS) is a fully managed messaging service designed for high-throughput, push-based communication. SNS allows you to send notifications to a large number of recipients simultaneously, using different communication channels such as SMS, email, and HTTP/S endpoints.
SNS (Simple Notification Service) provides a notification service based on Pub/Sub strategy.
It’s a way of publishing messages to one or more subscribers through endpoints. Is that confuse?
Let’s go deeper a little more about this theme. Usually the term Pub/Sub is related to event-driven architectures. In this architecture publishing messages can be done through notifications to one or more destinations already known, providing an asynchronous approach. For a destiny to become known, there must be a way to signal that the destination becomes a candidate to receive any message from the source.
But how does subscriptions work? For SNS context, each subscriber could be associated to one or more SNS Topics. Thus, for each published message through Topic, one or more subscribers will receive them.
We can compare when we receive push notifications from installed apps in our smartphones. It’s the same idea, after an installed app we became a subscriber of that service. Thus, each interaction from that application could be done through notifications or published messages.

The above example demonstrates a possible use case that SNS could be applied. For the next sections we’ll discuss details for a better understanding.
Key Features
- Scalability: Automatically scales to handle millions of messages per day.
- Flexibility: Supports multiple protocols (HTTP/S, email, SMS, SQS, Lambda).
- Reliability: Built on AWS’s robust infrastructure with high availability and durability.
- Security: Integrates with AWS Identity and Access Management (IAM) for fine-grained access control.
- Cost-Effective: With a pay-as-you-go pricing model, AWS SNS allows you to pay only for the messages you send and receive.
Basic Concepts
Topics are logical endpoints that works as an interface between Publisher and Subscriber. Basically Topics provides messages to the subscribers after published messages from the publisher.
Topic
There are two types of Topics, Fifo and Standard:
- Fifo: Fifo type allows messages ordering (First in/First out), has a limit up to 300 published messages per second, prevent messages duplication and supports only SQS protocols as subscriber.
- Standard: It does not guarantee messages ordering rules and all of the supported delivery protocols can subscribe to a standard topic such as SQS, Lambda, HTTP, SMS, EMAIL and mobile apps endpoints.
Limits
AWS allows to create up to 100.000 topics per account.
Publishers
Publishers are the entities responsible for sending messages to SNS topics. They can be application servers, microservices, or any other component capable of making HTTP or HTTPS requests.
Subscribers
Subscribers are the endpoints that receive messages from topics. Depending on the use case, these endpoints may include:
- HTTP/HTTPS endpoints – such as web servers or applications
- Email addresses – for sending message content via email
- SMS numbers – to deliver text messages to mobile devices
- Amazon SQS – to forward messages to queues for further processing
- AWS Lambda – to automatically trigger functions when new messages arrive
Messages
A message is the actual data that a publisher sends to a topic. It can be as simple as a text string or a structured payload such as JSON. By routing through topics, messages can reach multiple subscribers efficiently and reliably.
Publishing Messages
Publishing messages in AWS SNS involves creating a topic, publishing a message to that topic, and optionally using the AWS SDK to automate the process. Let’s break this down step by step.
Create a Topic
Go to the SNS Dashboard in the AWS Management Console.

Click on “Create topic”.

Choose a topic type (Standard or FIFO), provide a name, and configure settings as needed.
Standard Topic: Offers high-throughput message delivery with best-effort ordering, meaning messages might not be delivered in the exact order they are sent, but they are delivered at least once.
FIFO (First-In-First-Out) Topic: Ensures that messages are delivered in the exact order they are sent and guarantees exactly-once message delivery, making it suitable for applications where the order of operations is critical.
Publish a Message
Navigate to the topic you created.

Click on “Publish message”.
Enter the message details (subject and body).

Optionally add any message attributes.
Click “Publish message”.

Subscriptions
To receive messages from an SNS topic, you need to subscribe endpoints to that topic. We already mentioned endpoints can be various types, including email addresses, SMS numbers, Amazon SQS queues, AWS Lambda functions, and HTTP/S webhooks.
Add a Subscription:
Go to the SNS topic in the console.

Click on “Create subscription”.

Choose the protocol (HTTP, email, SMS, etc.). And Enter the endpoint (URL, email address, phone number).

Click “Create subscription”.

Depending on the protocol, you may need to confirm the subscription. For example, email subscriptions require the recipient to click a confirmation link.

Now again publish message and verify email you will get an notification on email .

Message Filtering
SNS allows you to filter messages based on their attributes, ensuring subscribers only receive relevant messages.
Set Message Attributes:
When publishing a message, include attributes to categorise or label the message.
Create Filter Policies:
You can assign filter policies to subscriptions by specifying attribute names, and adding a list of one or more values to each name. A subscription accepts a message only if the message contains attributes that match those specified in the subscription’s filter policy.
An example of a filter policy:
{
"Type": ["Order", "Shipping"]
}
Apply Filter Policies:
To apply filter policies in AWS SNS, navigate to the subscription settings in the SNS console. Within the subscription settings, locate the section for message attributes and add the filter policy JSON. This allows you to define specific criteria for messages, ensuring that subscribers receive only the relevant notifications based on the attributes specified in the filter policy.
Use Case Examples
- Alerting Systems: Send real-time alerts and notifications to system administrators or end-users. For instance, you can notify on-call engineers when a server goes down.
- Application Integration: Decouple and coordinate microservices by using SNS topics to send messages between different parts of your application.
- User Notifications: Send promotional messages, order updates, and personalised alerts to users via SMS or email.
- IoT Communication: Relay messages from IoT devices to backend services or other devices.
Conclusion
AWS SNS is a powerful service for sending notifications and messages across distributed systems. By understanding the basics of topics, publishers, subscribers, and message filtering, you can build robust, scalable communication systems that enhance your application’s responsiveness and user experience.