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

Reading Time: 6 minutes


Simple Notification Service is referred to as SNS. As a web service that coordinates and maintains the delivery and sending of messages to subscribing endpoints or clients, SNS is a quick, versatile, fully managed push notification service. It enables the delivery of a single message, a fan-out message, or other distributed services to a large number of recipients. SNS has push notification support as well. Simple Notification Service supports both First-in, First-out, and Standard services, and it has a unique encryption feature that enables you to save sensitive data in encrypted topics.

  • Topic: Provide a name for the topic, which will appear as the topic’s display name.
  • The subscribers will receive the message that has been published on SNS subjects right away in this affordable pay-as-you-go model with an upfront cost.
  • Reliable – Multiple AZs are used to keep at least three copies of the data in the same location.
  • When you use autoscaling, it activates an SNS service that will send you an email to let you know that “YOUR EC2 INSTANCE” is expanding.
  • Choose an endpoint type like HTTP OR HTTPS for the protocol.

Publisher: Messages are created or produced by publishers, also referred to as producers, and sent to the SNS, which serves as a logical access point.

Subscriber:– Web servers, email addresses, Amazon SQS queue, and AWS Lambda are a few examples of subscribers who get messages or notifications for SNS from (Amazon SQS, E-mail, Lamda, HTTPS, and SMS).

Types of Topics:-

Once a subject has been created, the topic type cannot be changed.


  • Message ordering using best efforts.
  • A message is transmitted at least once.
  • Highest publish/second throughput.
  • Subscription protocols include SQS, Lambda, HTTP, SMS, email, and endpoints for mobile applications.

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

  • Ordering of strictly maintained messages
  • delivery of messages only once.
  • high rate, up to 300 publishes per second
  • Subscription guidelines:
  • SQS:-


Enable Encryption:-You can save sensitive data in encrypted topics thanks to server-side encryption. Using a key controlled by the AWS key management service, SSE secures the contents of messages posted to Amazon SNS topics. Your communication is encrypted by Amazon SNS as soon as it is received, and it is promptly decrypted before being delivered.

Disable Encryption:- Disable the encryption by clicking on it if you don’t want to use any kind of encryption.

Access Policy:-


  • A fundamental access policy is defined using uncomplicated criteria.
  • Only the topic owner can publish the topic
  • Everyone and Anybody can publish
  • Only those AWS account IDs are allowed to publish the topic.


  • An advanced access policy is defined using a JSON object.
  • The only person who can subscribe to a topic is its owner.
  • Any AWS account and everyone can subscribe to the subject.
  • Only the AWS account IDs mentioned may subscribe to the subject.
  • Only users with specific endpoints may request.
  "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 outlines the procedures for Amazon SNS’s unsuccessful HTTP/S endpoint delivery retries.
  • Sometimes multiple tries are necessary for an Amazon SNS delivery to an HTTP/HTTPS endpoint to be successful.
  • The number of retries, the delay time, and the retry-backoff mechanism are all configured for you by Amazon SNS when you utilise the delivery retry policy default settings.


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

Delivery status logging:-

The following Amazon SNS endpoints are supported by Amazon SNS for logging the delivery status of notification messages issued to topics:

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

You can use it as IAM roles in this case just as you can employ different roles for successful and unsuccessful message deliveries. given that there are two categories:-

Use an existing service role – For this, we must choose an existing service role from your account.

Create a new service role -Your account needs a new service role to be created in order to accomplish this.

Support Push Notification Platform:

Subscribers to SNS Topics can come from any push notification platform that is supported as well as from other endpoint types like SMS or email. Several 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:-A request payload of 256 KB will be charged as four requests because each request payload of 64 KB counts as one request.
  • 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?

  • The console
  • Select Simple Notification Service by clicking on services.
  • Develop Topic -> Instance: (Covid caution) (Lack of Education) (Lack of Education)
  • Go to Subscription and select the method for sharing messages ( E-mail, Phone, etc)
  • If you decide to email someone, be sure to include their email address.
  • Select “send”
  • Whatever message was put in the email that was sent to the mail ID was received.
  • Visit Mail and choose CONFIRM.

First, pick SIMPLE NOTIFICATION SERVICE from the AWS dashboard.

After selecting an SNS Simply create a topic, type your message, and then pick whether to send it via email or SMS. For eg: – A Covid warning will appear with the phrase “Follow social distance.

If you select the SMS option, the message will be displayed on your mobile device’s contact number, and if you select the E-MAIL option, it will be displayed on your email address.

Publish message to topic:-

Navigate to Amazon SNS > Topics > Test > Create Message

Select The subject ARN and then click on the Subject. The message will then be displayed, and if you wish to select the topic ARN, do so.
TTL (Time To Live):- The number of seconds that the push notification service has to deliver the message to the endpoint.

Once it’s finished, simply type the message.

For same payload for all delivery protocols and custom payload for each delivery protocol, the message must be entered into the message body.

After typing the message in the box labeled “what to send,” click “publish message.”

Then, navigate to subscription and enter a message-sending email address. then send out the message via the mail. You are free to add as many numbers of emails as you like and send them all at once.


After selecting the topic, select the protocol that will be used to subscribe to the desired endpoint type. Then, as it filters the messages a subscriber receives, you can select the subscription policy in it.

Redrive policy (dead-letter queue):-

By defining the Amazon SQS queue that holds messages that are unsuccessfully delivered to subscribers, we can apply a Redrive policy to Amazon SNS subscriptions.

As a result, we have a policy that allows both Enabled and Disabled.

Just send the Mail once the entire process has been done.

When the procedure is complete, open the email you received and click the Confirm subscription button.
After receiving subscription confirmation, a message indicating the preferred method will be displayed in the email address. This method can either be done via email or mobile phone.