AWS – Simple Notification Service

AWS can provide you a LOT of functionality.  Some of what it can provide is so powerful because you can automate given actions.  It isn’t necessary to monitor your EC2 instances to see if your machines are running at a high load, it is possible to configure the autoscaling to start up and shutdown instances based on the machine loads.

If you have ever setup the perfect system, program or script you realize it is still important to keep your finger on the pulse to prevent any unexpected surprises.

Amazon assists you in this by their simple notification service (SNS) which can be configured to send off messages when certain activities or thresholds are crossed.  Unsurprisingly, you cannot use/subscribe to the SNS until you have configured it with topics that interest you.

Configuring Simple Notification Service

The simple notification service, or SNS, is just a clever implementation of the standard publish and subscribe pattern that you may have experienced at some e-commerce site or other interactive system.

One example of this would be to subscribe to a web site that suggests it has notify you when more articles relating to your interests are available.  Another example might be in a realtime trading system you subscribe to which stock or currency prices you wish to follow so your client will then receive that information as new information becomes available.

All that is necessary for using SNS is to create a topic.

The topic setup is actually two different names.  The topic field is up to 256 alpha-numeric characters while the display name is both more friendly except it is limited to 10 characters.

Subscribing to the service

Setting up the service itself is very quick and easy but in order for a person or system to receive any of these notifications they need to subscribe to SNS for that topic.

To subscribe simply select which topic you wish to subscribe to and select “subscribe to topic” from the actions button.  The rest is to simply fill out this dialog.

The topic ARN will be filled from the topic you selected.  Amazon will provide a sample endpoint depending on which protocol you choose.  Fill this in with the proper value for your protocol, in this example a valid email address for receiving the emails.

Amazon has done a nice little twist in that this service is a bit more generic, it can send these messages to interested parties via one of the following methods.

  • Http
  • Https
  • Email
  • Email JSON
  • Amazon SQS
  • AWS Lambda
  • SMS

Note: SMS seems to be a new feature and is not yet rolled out to all regions.

That is all you need to do in order to create the topic and subscribe to it, however, just like almost every other mailing list or system AWS requires that the email address ( in this case) confirms this request.

It is not possible to edit these pending confirmations, they need to be confirmed by the account that they were sent to.  It is possible to manually confirm these requests from the topic overview page.  Simply select the topic to be confirmed which will open up a new dialog box asking for the proper confirmation URL.

In the case of responding to an email confirmation it is actually much easier to simply select the URL from the email which will perform the confirmation.

Testing setup

Once all of the previous steps are done then it is possible to “queue up” a message for the simple notification service to test out that the recipient will receive his or her message.  Simply select the topic from the list and press the “publish to topic” button.  You will be rewarded with the following dialog which can then be filled in with any test data you wish to send.

Once you press the publish button then the message will be sent out.

This is all the setup in order to create a SNS topic which can be used to notify yourself or your systems with information about the running state of your “machines” but all of this setup will not send a single message anywhere without further setup.


This entry was posted in Setup From Scratch and tagged , , . Bookmark the permalink.