Overview of AWS SNS Service

Amazon offers some really great developer services.  One of those is AWS Simple Notification Services, also known as SNS.  It’s the trumpet of the AWS symphony.

In SNS, you create a “Topic” which you can think of as the subject of the notification.  You will publish a message (think “record”) to the topic, and AWS sends the notification to the subscribers automatically.

Let’s take an example.  You’re a zombie, and you’re shuffling around an abandoned farm.  Or so you think.  You hear a gunshot in the distance, and a gunshot means survivors, and … brainz!  Since you’re a good zombie and have been taught to share, you get on your fancy $1000+ iPhone X  and send a message to your zombie horde letting them know there are survivors near your location.  This could  be done with SNS!

When you send a message to SNS, this is referred to as “Publishing”.  Anyone who listens for a new message is “Subscribing”.  This is sometimes called the “Pub/Sub” model.

So let’s say we send a record into an SNS topic.  From there, the service can notify anyone who is subscribed to it.  Some of the subscription types can be a text message, email message, a web service, a lambda function (think serverless code), or a queue.

Let’s talk about these various subscribers a bit:

  • Text message: this is sending an SMS message to a device like a phone
  • Email message: this allows you to send a message via email to a recipient
  • Web Service: you can send a message to an http or https endpoint as a POST request
  • Lambda function: AWS has a way for us to run serverless code through Lambda functions
  • Queue: AWS has a queue process called SQS (Simple Queue Service) that can be used to queue up messages for work by another application

You can have multiple subscribers to your SNS topic. Each of the subscribers can perform whatever processing they desire on the information they receive.  This allows each to perform some sort of additional processing on the information.

We will explore SNS and how to use it over various posts in this blog.  The reason I wanted to mention it early is SNS was the service that sold me on AWS.  It made me realize the power and ability of stringing together various AWS services to accomplish tasks that programmers often struggle with.