AWS SNS (Simple Notification Service)

Learn via video courses


AWS Simple Notification Service (SNS) is a message delivery service that works on the publisher and subscriber models. AWS SNS allows delivery by publishing messages to a common logical access point known as a topic, to which multiple clients can subscribe to receive the notifications.

What is AWS SNS and How does it Work ?

AWS SNS is a publicly accessible service that allows publishers to send messages to subscribers.

Subscribers can receive the published messages over a number of channels, such as Amazon SQS, Kinesis Data Firehose, CloudWatch, AWS Lambda, HTTPS, email, and push notifications for mobile devices, SMS, etc.

The publisher-subscriber model (pub-sub), which is how Amazon SNS operates, entails publishers publishing event notifications or messages to the common logic point of communication, in this case, an AWS SNS Topic, and subscribers subscribing to that topic in order to receive the notifications and messages. Data is replicated among several availability zones as part of the regionally resilient AWS SNS service.


Features and Capabilities of AWS SNS

AWS SNS offers the following features and capabilities as messaging service:

  • Secure Messaging: AWS SNSdelivers an encrypted mechanism for publishing and storing the messages in SNS topics using encryption offered by AWS Key Management Service.

  • Reliable Delivery: AWS SNS retries message delivery on failure which guarantees reliable message delivery.

  • Application-to-application Messaging: Multiple applications such as Amazon SQS, Kinesis Data Firehose, CloudWatch, AWS Lambda, and HTTPS are supported by AWS SNS.

  • Application-to-person Messaging: Email, SMS and push notifications for mobile devices are also supported by SNS.

  • Message Filtering: Filter policies can be applied to topic subscriptions allowing subscribers to receive only opted messages within filter attributes.

Accessing AWS SNS

AWS SNS can be accessed and configured using one of the following ways:

  • AWS Management Console - AWS console offers an interactive user interface to create and manage SNS topics and configure additionally available configurations.
  • AWS CLI tool - AWS CLI tool can be also used to manage and configure the SNS service.
  • AWS SDKs - AWS offers SDKs in various programming languages such as Python, JavaScript, Go, etc. SDKs can be utilized to develop custom solutions developed using AWS as a messaging service.

How to Create AWS SNS?

The following steps will guide you on how to create and configure an SNS topic using the AWS Management Console:

  1. Login to your AWS account.
  2. Search and open the AWS SNS service console.
  3. Choose Topics and click on Create Topic.
  4. Click on Standard topic.
  5. Enter the name of the topic and click on Create topic.
  6. Next, choose Subscriptions and click on Create Subscription.
  7. Choose the previously created topic ARN in the list of topics filed.
  8. For now, choose Email as a protocol.
  9. Enter your email address in the Endpoint to receive email notifications.
  10. Click on Create Subscription.
  11. You will receive an email to Confirm your Subscription.

You created an SNS topic and subscribed to it using the Email protocol in the previous steps.The email address of the subscriber will receive any message published to the SNS topic as an email.

AWS SNS Pricing

There are no up-front costs associated with using AWS SNS, just like with all other AWS services.

The price is determined by the volume of messages broadcast, the number of API calls made to manage topics, subscriptions, data transfer, AWS KMS interaction, and worldwide SMS.

Common AWS SNS Scenarios

  1. Event Notifications: AWS SNS topics can be utilized by configuring event notifications whenever a dedicated event happens such as object delete in an S3 bucket, EC2 instance termination, auto-scaling initiation, CloudWatch alarms, etc. These notifications can be sent to a group of recipients using email or SMS as a medium.
  2. User Notifications: AWS SNS can be used to trigger user notifications such as promotional offers, discounts, order notifications, invoice delivery, etc.
  3. Push Notifications: Mobile applications reach their audience with the help of push notifications on applications. SNS can be used to deliver push notifications to mobile channels as well.
  4. AWS Service Integration: SNS can be integrated with other AWS services such as SQS, EC2, Lambda, Kinesis, S3, etc, and can be put to use in a wide number of use cases in the real world.

Difference between SQS and SNS

  1. The foundation of the services is where the main distinction lies. While SNS is a push-based service, SQS is a poll-based one.
  2. Another primary distinction between the two is that SNS supports numerous subscribers while SQS supports a single consumer.
  3. You can batch several messages into one using SQS while batching is not possible with SNS because it only processes one message at a time.
  4. SQS is best suited for notification queues primarily for a single consumer while SNS is suited for notification delivery to multiple subscribers at a time.

Benefits of SNS

Among all the features provided by AWS SNS, here are a few of its benefits as a messaging service: 1.Instantaneous delivery of messages: Instant distribution of the messages through multiple channels (e.g., e-mail, SMS, etc.) is possible with this service. 2. Message Filtering for the clients: The ability to filter the messages sent by you through the channels of your own choosing is also one of its benefits. 3. Highly reliable: With retry policies, message delivery is re-attempted on failure. 4. Secure and Encrypted Communication: Off-the-record communication is secure, private, and reliable. 5. Highly Available and Scalable: SNS is a regional service that allows our message delivery to be highly available and scalable.

How Does Amazon SNS Message Filtering Work?

In AWS SNS, a filter policy can be set up so that subscribers only receive a fraction of the messages that have been published. When a message is published, SNS compares the attributes with the filter policy and, based on the attributes, messages are filtered before being sent to the subscriber. If no filter policy is applied, all published messages are delivered to the subscribers. A messaging system's cost can be decreased by reducing its volume if a filter policy is set up so that subscribers only receive messages whose attributes match the necessary values.

The message filtering is done based on the payload message attributes, considering those attributes a JSON filter policy is created which accepts or rejects the published messages.

Steps to create filter policy:

  1. Log into the Amazon SNS interface.
  2. Select Subscriptions from the navigation panel to start.
  3. Select Edit after choosing a subscription.
  4. Expand the section titled "Subscription filter policy" on the Edit page.
  5. Give the JSON body of your filter policy in the JSON editor field.
  6. Select Save changes.


  • In this article, we learned about Simple Notification Service (SNS) and its features and characteristics
  • We also looked at the steps to create and configure an SNS topic on the AWS console
  • We also considered the SNS pricing and looked at workings of SNS filtering policy.