Amazon SNS Tutorial

A portrait painting style image of a pirate holding an iPhone.

by The Captain

May 19, 2023

Amazon SNS Tutorial - An Overview of Simple Notification Service

The Amazon Simple Notification Service (SNS) is a fully managed service that enables the sending and receiving of messages from one or multiple subscribers. Using SNS, you can send messages to multiple recipients, including email, SMS, HTTP/HTTPS, AWS Lambda, and more.

Why Use SNS?

SNS is a powerful tool for triggering automated actions based on events or notifications occurring across AWS services and third-party services. You can use SNS to:

  • Send alerts or notifications to multiple subscribers (applications, users, devices, and services) in near real-time
  • Decouple and scale microservices that need to exchange messages with each other
  • Integrate event-driven architectures for serverless data processing with AWS Lambda, Amazon Kinesis, and other services
  • Ensure high availability and durability of messages across regions and availability zones

How SNS Works

The SNS architecture is based on four main components: topics, publishers, subscribers, and endpoints.


A topic is an entity that represents a subject or category of messages. Publishers can publish messages to a topic, and subscribers can subscribe to receive messages from that topic. Topics are identified by name, which can contain up to 256 characters with alphanumeric characters, hyphens, and underscores. Topics can be created, updated, and deleted using the SNS web console, AWS CLI, or SDKs.


A publisher is an entity that sends messages to a topic. Publishers can be applications or services running on AWS or third-party platforms. Messages can be of various formats, such as text, JSON, or XML. Publishers must have the permission to publish messages to a topic, which can be granted using AWS Identity and Access Management (IAM).


A subscriber is an entity that receives messages from a topic. Subscribers can be applications, services, or users consuming messages sent via email or SMS. Subscribers must have the permission to subscribe to a topic, which can be granted using IAM. Subscribers can receive messages in various formats, such as email, SMS, HTTP/HTTPS, Lambda function invocation, or other AWS services.


An endpoint is the destination of a message sent from a publisher to a topic. Endpoints can be physical devices, mobile applications, web servers, or Lambda functions. Endpoints must be created and registered by subscribers, and must be associated with a topic they want to receive messages from. Endpoints are identified by an Amazon Resource Name (ARN) that includes the topic and the protocol used to receive messages.

Getting Started with SNS

To get started with SNS, you need to create a topic and subscribe endpoints to it. Here are the general steps:

  1. Login to the AWS console and navigate to the SNS service
  2. Create a topic by clicking the "Create topic" button
  3. Choose a name for your topic and create it
  4. Subscribe an endpoint to your topic using one of the supported protocols (e.g. email, SMS, Lambda, HTTP/HTTPS)
  5. Test your subscription by publishing a message to your topic


Amazon SNS is a powerful messaging service that can simplify and scale your application notification and event-driven architecture. With SNS, you can decouple your microservices, trigger automated actions, and ensure high availability and durability of messages. If you need to use SNS within your application, you can use the AWS management console, the AWS CLI, or any of the many supported SDKs such as Nodejs and Python.