Blog

  • Home
  • AWS
  • Amazon Simple Notification Service (AWS SNS)

Amazon Simple Notification Service (AWS SNS)

  • (4.0)
  • | 1394 Ratings |
  • Last Updated November 01, 2017

Amazon Simple Notification Service (AWS SNS)

The developers while building a technological solution to build highly functional and structurally complex applications that support their business objectives providing the instant event messaging facility. 

For example: When a subscriber expresses interest to know about certain topics or procedure of business operation, the company publishers send the relevant information immediately. 

What are the unique features of AWS SNS?

  • The users can push messages to Windows, Google, Apple kind of smart devices along with IoT devices. 
  • One can send messages for multiple times to any number of recipients directly. 
  • One gets immediate notifications on errors occurred in the system. 
  • Integrating and providing access indirectly with an external system. 
  • Send duplicate messages to n, no of devices associated. 
  • If the size of the message is more than the required, SNS does not cut the words and push, instead, it   sends the whole message limiting its push action to 1600 bytes
  • It also manages pub/sub messaging service where the event is notified immediately when there are changes made in independent building block made to form a single application.
Deep dive into the world of Amazon Web Services through Mindmajix AWS Training.

How SNS works?

The company owns the topics along with giving access permissions to the topic.  Subscribers are clients registered who wanted to receive notifications on specific topics that interest them.

Publishers send messages to topics. SNS matches the topic with the list of subscribers interested in the topic and delivers the message to each and every one of them. Here’s how it all fits together:

AWS SNS

What are the main functions operating in AWS SNS

The SNS API has a certain list of functions making the whole operation successful.:

1.CreateTopic function -creates a new topic.

Topics are groups of events or access points prepared for identifying a specific subject or content. Each topic is given with a unique reference identifier (URI).  Topic names are  256 characters log written in upper and lower case letters combined with numbers, and hyphens. A user can create 100,000 distinct topics. Create a topic in the Amazon SNS console,

Create Topic function

 2. AddPermission function - establish the access permissions on the Topic  
These are in the form of a statement. They act as access control policies on each topic.
Syntax:

sns-add-permission TopicArn  //  the statement of access policy// 
--aws-account-id  value[,value...]  // the users to whom the statement should apply// 
--action-name value[,value...]  //actions to which the users should be granted access//
--label  value   //unique short name for the new policy statement.//


3. The Subscribe function - expresses the interest in receiving messages on a particular topic.

Create Subscription

4. The Publish function to post messages.

Publish a Message

Frequently Asked Amazon Web Services Interview Questions


How much does this solutions cost?

AWS SNS provides pay-as-you-go-pricing with no upfront installation charges. It is free for the first 100,000 SNS requests per month, first 1000,000 HTTPS notifications and the first 1,000 email notifications. More details on pricing are given in SNS page.

What are a different type of Operations provided in AWS SNS?

User
Operator Name Description
Owner  Create Topic To create a Topic
  Delete Topic Deleted previous Topic
  List Topic Provides list of topics associated to a User
  ListSubscriptionsByTopic  
  SetTopic Attributes You can set, update, modify attributes to a publisher. subscriber
  SetTopicAttribute Set, Update,Modiy attributes on Topic
  GetTopicAttributes To view an attribute.
  Add & Remove Permission For access control permissions
Subscriber  Subscriber  
  ConfirmSubscriber  
  UnSubscribe  
  List Subscribers  
Publisher Publish  

What are the limitations to AWS SNS?

1. It supports a message of size 256kb only or up to 140 bytes.
2. When a message is not delivered immediately, the messages are held in a queue which is called as a dead-letter queue. AWS SNS does not support this system.
3. Data retention - storing the data records for business purposes is not supported by AWS SNS.
4. FIFO ( First in First Out) of message ordering system is not supported by AWS SNS.
5. Does not support two-way SMS feature.
6. Amazon SNS cannot determine a delivery model as a mobile phone, VOIP or landline
7. It does not even support scheduled message delivery feature

How to send a message to a Mobile number?

You can send SMS from your  AWS Management Console account or one of AWS SDKs. Both support Promotional messages for marketing and Transactional messages that support customer interactions and transactions. 

Using Amazon Console,

1. Sign in to https://console.aws.amazon.com/sns/v2/home.
2. Select the geographical region you want to send the message.
3. Choose Message Type from Text Messaging Tab.
4. Type the Number, Message or Custom ID of the sender and 
5. Send the Message.

Using AWS SDK, 
Use the following syntax 
Map smsAttributes =
        new HashMap();
smsAttributes.put("AWS.SNS.SMS.SenderID", new MessageAttributeValue()
        .withStringValue("mySenderID")   //The sender ID shown on the device.
        .withDataType("String"));
smsAttributes.put("AWS.SNS.SMS.MaxPrice", new MessageAttributeValue()
        .withStringValue("0.50") //Sets the max price to 0.50 USD.
        .withDataType("Number"));
smsAttributes.put("AWS.SNS.SMS.SMSType", new MessageAttributeValue()
        .withStringValue("Promotional") //Sets the type to messagel.
        .withDataType("String"));

How to send a message to HTTP endpoints?

Subscribe an HTTP or HTTPS endpoint by following the steps below.

1. Sign in to the AWS Management Console and open the Amazon SNS console at                                       https://console.aws.amazon.com/sns/v2/home.
2. Click Topics to select the topic.
3. Click the Other actions drop-down list and select Subscribe to a topic.
4. In the Protocol drop-down list, select HTTP or HTTPS.
5. In the Endpoint box, paste in the URL for the endpoint that you want the topic to send messages to and then click Create Subscription.
6. For the Subscription request received! a message, click Close.
7. Your Subscription ID displays. 

You can also provide Delivery retry policy to SMS if failed to deliver in the first attempt. However, by default, AWS SNS makes 3 attempts to deliver a message.

You can also give access permissions to publish or send a message to your end users by defining a control access policy to the topic or to the user ID.

And finally, open the Amazon SNS console at https://console.aws.amazon.com/sns/.

1. Slick Topics and select a Topic.
2. Click the Publish to a topic button.
3. In the Subject box, enter a subject (for example, Inbound Marketing Course with Internship)
4. In the Message box, enter the message
5. Click the Publish message.

Explore AWS Sample Resumes! Download & Edit, Get Noticed by Top Employers!Download Now!

Amazon SNS console

List Of AWS Courses Offered By Mindmajix:


Subscribe For Free Demo

Free Demo for Corporate & Online Trainings.


DMCA.com Protection Status