The Twelve Days of AWS: SNS

12 Days of AWS Day 6 written around snowflakes with a penguin holding a lollipop

Simple Notification Service (SNS) is another great tool for distributed operations but is different from SQS in various ways including:

  • Push mechanism rather than pull: it can be used to push out an email or a webhook.
  • Messages are sent out in real-time, with no persistence, to anything that will receive the notification. This means that any service that is subscribed can respond to a notification but anything that is not available at that time will not receive the notification later on.

You can send out a notification that a new MP3 was uploaded to a site, and it might fire an email to the site admin, notify a Lambda process to do audio compression, and a webhook to update a webpage.

At first, I did find SNS and SQS easily confused, so I would recommend that in deciding which one to use, I would ask myself, am I trying to do various different tasks on one event (SNS) or chaining up two parts of a decoupled architecture (SQS).