What is SNS (Simple Notification Service) How It Works?

Reading Time: 6 minutes


SNS stands for Simple Notification Service. SNS is a fast, flexible fully managed push notification service. as it is a web service that coordinates and manages the delivery and sending of messages to subscribing endpoints or clients. It allows for sending an individual message or fan-out message to a large number of recipients or to other distributed was services.SNS also supports a push notification platform. Simple Notification service allows the Standard as well as First-in, First-out service and there is a special function regarding encryption which allows you to store sensitive data in encrypted topics.

Topic:- Enter a Name for the topic which will present as the Display name for the topic.

Message – Published on SNS topics will be delivered to the subscribers immediately in this it is a cheap, pay-as-you-go model with an upfront cost.

Reliable – At least three copies of the data are stored across multiple AZ at the same place.

It is a way of sending messages when you are using autoscaling, it triggers an SNS service that will E-Mail you that “YOUR EC2 INSTANCE ” is Growing.

HTTP/S:- For Protocol, choose an endpoint type like HTTP OR HTTPS.

Publisher:-Publishers are also known as producers that produce or create the message to the SNS which is a logical access point.

Subscriber:– Subscribers such as webservers, E-mail addresses, Amazon SQS queue, and AWS Lambda, receive the message or notification for SNS from (Amazon SQS, E-mail, Lamda, HTTPS, SMS).

Types of Topics:-

Topic type cannot be modified after the topic is created.


  • Best-effort message ordering.
  • At least once a message is delivered.
  • Highest throughput in publish/second.
  • Subscription protocols: SQS, Lambda, HTTP, SMS, email, mobile application endpoints.

FIFO (First-in, First-out):-

  • Strictly-preserved message ordering
  • Exactly-once message delivery
  • High throughput, up to 300 publishes/second
  • Subscription protocols:- SQS


Enable Encryption:– Server-side encryption lets you store sensitive data in encrypted topics. SSE protects the contents of messages in Amazon SNS topics using key managed in AWS key management service. Amazon SNS encrypts your message as soon as it is received and the message is decrypted immediately prior to delivery.

Disable Encryption:- If you don’t want to put any type of encryption then disable the encryption by clicking on disable encryption.

Access Policy:-

BASIC:- It uses simple criteria to define a basic access policy.

  • Only the topic owner can publish the topic
  • Everyone and Anybody can publish
  • Only the specified AWS account IDs can publish the topic

ADVANCED:- It uses a JSON object to define an advanced access policy.

  • Only the topic owner can subscribe to the topic.
  • Everyone and Any AWS account can subscribe to the topic.
  • Only the specified AWS account IDs can subscribe to the topic.
  • Only requesters with certain endpoints.
  "Version": "2008-10-17",
  "Id": "__default_policy_ID",
  "Statement": [
      "Sid": "__default_statement_ID",
      "Effect": "Allow",
      "Principal": {
        "AWS": "*"
      "Action": [
      "Resource": "arn:aws:sns:us-east-1:141837438119:my test",
      "Condition": {
        "StringEquals": {
          "AWS:SourceOwner": "141837438119"

Delivery retry policy (HTTP/HTTPS):-

  • This policy defines how Amazon SNS retries failed deliveries to HTTP/S endpoints.
  • A successful Amazon SNS delivery to an HTTP/HTTPS endpoint sometimes requires more than one attempt. 
  • When you use the default settings for the delivery retry policy, Amazon SNS configures the number of retries, the delay time, and the retry-backoff function for you. 


  "http": {
    "defaultHealthyRetryPolicy": {
      "numRetries": 3,
      "numNoDelayRetries": 0,
      "minDelayTarget": 20,
      "maxDelayTarget": 20,
      "numMinDelayRetries": 0,
      "numMaxDelayRetries": 0,
      "backoffFunction": "linear"
    "disableSubscriptionOverrides": false

Delivery status logging:-

Amazon SNS supports logging the delivery status of notification messages sent to topics with the following Amazon SNS endpoints:

  • HTTP
  • Lambda
  • Amazon SQS
  • Application
  • Platform application endpoint
  • Amazon Kinesis Data Firehose.

In this, you can use it as IAM roles as you can use separate roles for successful and failed message deliveries. as these are of 2 types;-

Use existing service role – In this we have to choose an existing service role from your account only.

Create a new service role – in this, we have to create a new service role in your account.

Support Push Notification Platform:

SNS Topic can have subscribers from any supported push notification platform as well as other endpoint types such as SMS or E-mail. Few platforms are:-

  • Amazon Device Messaging
  • Google Device Messaging
  • Google Cloud Messaging
  • Windows Push Notification Service

Amazon SNS Alternative:-

  • Amazon Kinesis Data Stream
  • Aws Managed queue Service
  • Apache Kafka
  • Twilio
  • Pusher

Amazon SNS Pricing:-

  • Publish Action:– Each 64 KB of request payload count as one request, so 256 KB payload will be charged as four requests.
  • Mobile Push Notification:-0.50/Millions Request
  • E-Mail:– $2/100,000
  • SMS:- Price Depend on the Country
  • HTTPS Notification :- $ 60 /Million

How does it Work?

  • Go to console
  • Click on services -> Select Simple Notification Service
  • Create Topic -> For eg (Covid warning) (Lack of Education)
  • Go to Subscription and choose the way you want to share Messages ( E-mail, Phone, etc)
  • If you choose to E-Mail type the E-mail id to whomsoever you want to share.
  • Click on send
  • Mail has been received to the mail id with whatever the message had been typed in it.
  • Go to Mail and click on CONFIRM.

Firstly, Go to the AWS console and select SIMPLE NOTIFICATION SERVICE.

After Choosing the SNS Just create a topic and write the message and choose the E-Mail process or SMS to share the message. For eg:Covid-warning and the message will be ” Follow social distance”

If You are choosing the Sms option then the message will be displayed on your Contact number or if you choose the E-MAIL option then the message will be displayed on Your mail ID.

Publish message to topic:-

Go to Amazon SNS -> Topics -> test -> Publish Message

Choose The topic ARN after that click on the Subject whatever you want to type the message will be displayed and therefore if you want to choose the
TTL (Time To Live):- The number of seconds that the push notification service has to deliver the message to the endpoint.

Once the process is over type the message in raw form.

The message has to be typed in the message body it can be sent in for identical payload for all delivery protocols and custom payload for each delivery protocol.

The message will be typed in the box as what to send once the message is typed click on publish message.

After that go to subscription and write an E-mail Id to send the message. and after that publish the message in the mail. You can add several numbers of mail as much as you want and send in a single go.


Choose the Topic ARN and after that Choose the protocol through which type of endpoint is to subscribe. After that, you can choose the subscription policy in it as it filters the messages that a subscriber receives.

Redrive policy (dead-letter queue):-

We can assign a Redrive policy to Amazon SNS subscriptions by specifying the Amazon SQS queue that captures messages that can’t be delivered to subscribers successfully. 

Therefore we have a policy to Enabled as well as Disabled.

Once all the process is completed just send the Mail.

Once all the process is over you will receive the mail open it and click on Confirm subscription.
After getting confirmation of the subscription the message will be displayed in the E-mail id as to which process has been chosen it can be done via E-mail as well as Mobile-phone.