AWS -Simple Notification Service

Abhishek Shukla
5 min readAug 9, 2022

--

Simple Notification Service

Amazon SNS stands for Simple Notification Service, which can push messages from the application to the subscribing ends or other applications. It is a completely managed messaging service for both applications-to-application (A2A) and application-to-person (A2P) communication. It provides the ability to create a Topic that is a logical access point and communication channel. Each topic has a different name that identifies the SNS endpoint for publishers to post messages and subscribers to register for notifications.

SNS is a distributed publish-subscribe system. Messages are pushed to subscribers as and when they are sent by publishers to SNS.

With Amazon SNS, you can send push notifications to Apple, Google, Fire OS, and Windows devices , as well as to Android devices in China with Baidu Cloud Push. You can use SNS to send SMS messages to mobile device users in the US or to email recipients worldwide.

SNS Publishers and Subscribers

AWS SNS publisher subscribers

Publishers

Publishers are also known as producers that produce and send the message to the SNS which is a logical access point.

Service that can pulish to AWS SNS

AWS CloudWatch: CloudWatch can generate alarms based on defined conditions, and you can configure these alarms to publish messages to SNS topics. This allows you to receive notifications when specific events or conditions occur.

AWS CloudTrail: CloudTrail can generate event logs for API activity within your AWS account. You can configure CloudTrail to publish these logs to an SNS topic, enabling you to receive notifications about API activity and changes in your account.

AWS S3 (Simple Storage Service): S3 can generate events for object operations such as object creation, deletion, and restoration. You can configure S3 event notifications to publish messages to an SNS topic, allowing you to receive notifications about changes in your S3 bucket.

AWS Lambda: Lambda functions can directly publish messages to SNS topics. You can include SNS publish API calls within your Lambda functions to trigger notifications or send updates to subscribers.

AWS Step Functions: Step Functions is a serverless workflow service. You can configure Step Functions to publish task state change events to an SNS topic, providing notifications about the progress and status of your workflows.

Custom Applications and Services: You can integrate your own applications and services with SNS by using AWS SDKs or making HTTP/HTTPS API calls. This allows you to programmatically publish messages to SNS topics from your custom applications or services.

Subscribers

Subscribers such as web servers, email addresses, Amazon SQS queues, AWS Lambda functions receive the message or notification from the SNS over one of the supported protocols (Amazon SQS, email, Lambda, HTTP, SMS).

AWS SNS subscribers

Amazon SQS (Simple Queue Service): You can subscribe an SQS queue to an SNS topic. When a message is published to the topic, it will be sent to the subscribed queue.

AWS Lambda: You can subscribe a Lambda function to an SNS topic. When a message is published to the topic, it will trigger the Lambda function, allowing you to process the message or perform custom actions.

HTTP/HTTPS Endpoints: You can subscribe an HTTP or HTTPS endpoint to an SNS topic. When a message is published to the topic, it will be sent as an HTTP POST request to the subscribed endpoint, allowing you to handle the message within your own application.

Email and SMS: You can also subscribe email addresses or phone numbers to receive notifications via email or SMS messages, respectively. These subscribers can be individuals or groups who want to receive notifications directly to their email addresses or mobile devices.

Mobile Push Notifications: AWS SNS supports mobile push notifications for platforms such as iOS, Android, Amazon Device Messaging (ADM), and Baidu Cloud Push. You can subscribe mobile devices to receive notifications using platform-specific protocols and APIs.

Benefits of AWS SNS

AWS SNS (Simple Notification Service) offers several benefits for building scalable and reliable notification systems:

AWS SNS benifits

Reliable message delivery: SNS ensures reliable message delivery by automatically retrying failed deliveries and employing exponential backoff techniques. It also supports message deduplication, which prevents duplicate messages from being sent to subscribers.

Simple and flexible integration: SNS provides integration with various AWS services and protocols, making it easy to connect with other AWS offerings such as Lambda, SQS, HTTP/HTTPS endpoints, mobile push notification services, and more. This flexibility allows you to create dynamic and event-driven architectures.

Scalability: SNS is highly scalable and can handle large volumes of messages and subscribers. It automatically scales to accommodate increasing message throughput without any additional configuration or provisioning.

Multi-protocol support: SNS supports multiple protocols for message delivery, including HTTP/HTTPS, email, SMS, mobile push notifications, and Amazon SQS. This allows you to send notifications to subscribers via their preferred communication channels.

Topic-based publish-subscribe model: SNS follows a publish-subscribe model, where publishers send messages to topics, and subscribers receive notifications from those topics. This decoupled architecture allows for easy management of message distribution and reduces dependencies between components.

Filtering and message transformation: SNS provides filtering capabilities, allowing subscribers to receive only the messages they are interested in based on attribute filtering. Additionally, SNS can transform messages into different formats, enabling compatibility with various subscriber endpoints.

Monitoring and observability: AWS CloudWatch integration allows you to monitor and collect metrics on SNS topics, subscriptions, and message deliveries. You can set up alarms and receive notifications for specific events, enabling proactive monitoring and troubleshooting.

Cost-effective: With a pay-as-you-go pricing model, you only pay for the resources you use, and there are no upfront costs or minimum fees. SNS offers a free tier that includes a certain number of messages and subscriptions each month, making it cost-effective for small-scale applications.

Summary

Overall, AWS SNS simplifies the process of building scalable and reliable notification systems by providing a flexible messaging platform, multiple delivery protocols, seamless integration with AWS services, and robust monitoring capabilities.

--

--

Abhishek Shukla

Having 20+ years of IT experience , Enterprise architect . Azure Solution architect expert, Microsft certified trainer, AWS cloud practioner (CLF-C01)