Teamitek

AWS SNS (Simple Notification Service)

SNS is Simple Notification Service. SNS is an AWS managed web service which is easy to set up, operate, and send a notification from the cloud platform like AWS. It provides developers with the highly scalable, cost-effective, and flexible capability to publish messages from an application and send them to other applications.

Feature of SNS:

  • SNS is fast, flexible, fully managed push notification service.
  • It is a web service that coordinates and manages the delivery or sending of messages to subscribing endpoints or clients.
  • It allows for sending individual messages or fan-out messages to a large number of recipients or to other distributed AWS services.

→ Messages published to an SNS topics will be delivered to the    subscriber immediately

→ Inexpensive, pay as-you-go model with no upfront cost.

  • Reliable-At least three copies of the data are store across multiple AZ in same region.
  • It is a way of sending messages when you are using auto scaling, it triggers an SNS service which will email you that ‘’your EC2 instance is growing’’ or “your EC2 instance is reducing”.

Amazon SNS is a web service that manages sending messages to the subscribing endpoint. In AWS SNS we have two clients:

  • Subscribers
  • Publisher

Publisher:

Publisher are also known as producers that produce and send the message to the SNS. Publisher is the one who has all privileges which can manage who can send messages on topic.

Subscribers:

Subscribers are those who receive the messenger notifications from AWS SNS (Webservers, email address, Amazon SQS Queues, AWS Lambda).

SNS TOPIC

  1. It is a logical access point and communication channel.
  2. Each topic has a unique name.
  3. A topic name is limited to 256 alphanumeric characters.
  4. The topic name must be unique within the AWS account
  5. Each topic is assigned and AWS ARN once it gets created.
  6. A topic can support subscribers and notification deliveries over multiple protocols.

Delivery Formats/Transport protocols (Endpoints)

  • SMS
  • Email
  • HTTP/HTTPS
  • SQS
  • AWS Lambda

Limitations of AWS SNS:

  1. By default, only the topic owner (who created it) can publish to the SNS topic.
  2. The owner can set/change permissions to one or more users (with valid AWS ID) to publish this topic.
  3. Only the owner of the topic can grant/change permissions for the topic.
  4. Subscribers can be those with/without AWS ID. Only subscribers with AWS ID can request Subscription.
  5. Both publishers and subscribers can use SSL to help secure the channel to send and receive messages.

Supported Push Notification Platforms:

  1. Amazon device messaging
  2. Apple push notification service
  3. Google cloud messaging
  4. Windows push notification service
  5. Baidu cloud push for android

SNS Topic can have subscribers from any supported push notification platform as well as any other endpoint type such as SMS or Email.

When you publish a notification to a topic, SNS will send identical copies of that message to each endpoint subscribed to the topic.

Amazon SNS alternatives:

  1. Amazon Kinesis Data Stream
  2. Amazon Managed Queue Service (AWS MQ)
  3. Apache Kafka
  4. Twilio(Third Party)
  5. Pusher(Third Party)

Amazon SNS Pricing

  1. Publish action- Each 64kb of request payload count as one request so, 256kb payload will changed as four request.
  2. Mobile push notification- For e.g. $0.50/million request.
  3. SMS- Price depends on country
  4. Email – $2/100,000
  5. HTTP/s Notification – $0.60/million
  6. SQS and lambda calls are free. These are charged at SQS and

Lambda roles

  • Data transfer.

AWS SNS SETUP

  1. Login to your amazon console is in the services tab you will find SNS click on it.
  2. Now we need to create a topic. Basically it is a message channel when you publish a message to a topic it fans-out the message to all subscribed endpoints.
  3. After the topic is created it will be shown to you in your next tab and the rest of the basic details you can set as default.
  4. Now in the access policy section we need to define who can publish the topic. In my case I am taking default only the topic owner can publish option.
  5. Now define who can subscribe to this topic in my case I am taking everyone can subscribe.
  6. Now in section delivery retry policy I am using the default options.
  7. Now in delivery status logging I am using default options because we don’t want to collect logs and the tags this time we are not giving any tag to this service. Once it is done click create topic.
  8. Once it is created you will see a successful message that topic is created successfully now you can create subscription and send messages to them from this topic.
  9. Now click on create subscription to create subscription.
  10. Now create a subscription select protocol which you want to choose. In my case I am taking email.
  11. In the endpoint enter your email on which we want a message. And rest of the options use default. Once it is done click create subscription.
  12. Now on your email you will receive a mail for subscription. So click on confirm subscription.
  13. Once subscription is confirmed the status will be changed to confirm.
  14. Now select subscription and then click on publish message to send messages.
  15. Now fill the subject and message body whatever message we want to send to our subscribers.
  16. Once all the details fill click on publish message.
  17. Once you receive a message published to a topic successfully then we will receive mail in your inbox. So in this way we can send messages to our subscribers.

Send text messaging from SNS

Amazon SNS lets you send SMS text messages to any phone number.

  1. For sending sms text messages select text messaging from the left panel in the SNS service and click on publish text message.
  2. In the next tab you will have to choose message type (i.e. Transactional & promotional) I am using promotional messages for now.
  3. After this fill the mobile number and message you want to deliver to your customer.
  4. Once you click publish message it will send a message on your phone number.

If you need help in configuring this cluster, feel free to email us victor@teamitek.com or call us at +1 810 214 2572.