Table of Contents
ToggleAWS SNS | What is SNS ? Introduction to AWS SNS (Simple Notification Service):
AWS SNS is a messaging service. It allows applications to send messages to one or more subscribers using a mechanism called PUSH.
AWS SNS is a managed service that provides message delivery from publishers to subscribers (also known as producers and consumers) of the applications.
Publishers of message communicates asynchronously to subscribers through a topic, which is a logical communication point.
Clients can subscribe to these SNS topics and receive published messages using a supported endpoint type, such as Amazon Kinesis Data Firehose, Amazon SQS, AWS Lambda, HTTP, email, mobile push notifications, and SMS.
In Simpler words, SNS helps you send notifications from the CLOUD. It has low cost delivery of infrastructure and mass delivery of messages.
AWS SNS FEATURES:
A-A Messaging Application-Application Messaging: It Supports A-A messaging subscribers like SQS, Lambda Functions, Https endpoints, Event Fork pipelines, etc.
Application to Person: It supports application to person notifications like sending notification to a person’s email ID, phone number and Mobile Applications.
Standard And FIFO Topics: It supports both standard and FIFO. Using FIFO Topics it ensures that strict message ordering, to define message groups and prevent message duplication. Note: Only Amazon FIFO SQS can subscribe to FIFO Topics. Using Standard Topic, when message delivery order and duplication doesn’t matter.
Message Durability: SNS uses a few strategies that work together to provide message durability:Published messages are stored across multiple, geographically separated servers and data centres. If a subscribed endpoint isn’t available, Amazon SNS runs a delivery retry policy. To preserve any messages that aren’t delivered before the delivery retry policy ends, you can create a dead-letter queue.
Message Attributes: SNS Message attributes provides the metadata about the message such as name, type, value, etc.
Message filtering: By default, each subscriber receives every message published to the topic. To receive a subset of the messages, a subscriber must assign a filter policy to the topic subscription.
A subscriber can also define the filter policy scope to enable payload-based or attribute-based filtering. The default value for the filter policy scope is MessageAttributes.
When the incoming message attributes match the filter policy attributes, the message is delivered to the subscribed endpoint. Otherwise, the message is filtered out. When the filter policy scope is MessageBody, filter policy attributes are matched against the payload.
Message security: Server-side encryption protects the contents of messages that are stored in Amazon SNS topics, using encryption keys provided by AWS KMS. You can also establish a private connection between Amazon SNS and your virtual private cloud (VPC).
To configure and manage SNS topics and subscriptions, you can use Amazon SNS console, command line tools, or AWS SDKs.
Create a topic in SNS: You can create a topic in the SNS console, via the AWS CLI, or through the AWS SDKs.
Subscribe to the topic: In order to receive messages, you need to subscribe to the topic. You can subscribe an HTTP/HTTPS endpoint, email address, or an AWS service as a subscriber.
Publish a message: You can publish a message to the topic using the SNS console, the AWS CLI, or the AWS SDKs. The message can be in the form of text, JSON, or XML.
Here is an example of how you can publish a message using the AWS CLI:
aws sns publish –topic-arn arn:aws:sns:us-west-2:123456789012:my-topic –message “Hello There, SNS World!”
In this example, the topic-arn parameter specifies the ARN of the SNS topic, and the message parameter specifies the text message to be sent.
Note: Replace “us-west-2” and “1234567890” with the appropriate AWS Region and Account ID for your setup.
Next Topic : AWS SQS
Checkout Our Git More