Outline
Introduction to SNS in AWS
SNS Topics and Subscriptions
SNS Message Filtering
SNS Mobile Push Notifications
SNS Email Notifications
Benefits of SNS
Security and Compliance
Integration with Other AWS Services
Create Amazon Simple Notification Service (AWS SNS)
Introduction to SNS in AWS
Amazon Simple Notification Service (Amazon SNS) is a managed service that provides message delivery from publishers to subscribers (also known as producers and consumers). Publishers communicate asynchronously with subscribers by sending messages to a topic, which is a logical access point and communication channel. Clients can subscribe to the SNS topic 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 mobile text messages (SMS).
Application to Application (A2A)subscribers:
SNS Topics and Subscriptions
In SNS, messages are published to a topic, which is an access point for subscribers to receive notifications. A topic can have multiple subscriptions, each representing a unique endpoint that receives messages. Subscribers can be added or removed dynamically without affecting the publisher or other subscribers. This makes SNS highly flexible and scalable, allowing users to easily adapt to changing requirements.
SNS Message Filtering
SNS provides powerful filtering capabilities that allow subscribers to receive only relevant messages based on their interests. Filters can be based on message attributes, message content, or a combination of both.
This feature helps reduce unnecessary message processing and improves the efficiency of the system. It also enables targeted messaging, allowing users to send personalized messages to specific groups of subscribers.
SNS Mobile Push Notifications
SNS supports mobile push notifications for iOS, Android, Kindle Fire, and Windows devices. It provides a simple and cost-effective way to send push notifications to millions of mobile devices at scale.
SNS integrates with popular mobile application platforms such as Amazon Pinpoint, Firebase Cloud Messaging, and Apple Push Notification Service (APNs) to provide a seamless experience for developers.
SNS Email Notifications
SNS can also send notifications via email, allowing users to receive important updates directly in their inbox. It supports both HTML and plain text formats, and allows customization of the email subject and body. In addition, SNS provides built-in support for bounce and complaint handling, making it easy to manage email deliverability and maintain sender reputation.
Benefits of SNS
SNS provides several benefits to businesses, including high throughput, low latency, and scalability. With SNS, businesses can send millions of messages per second to multiple recipients without worrying about message loss or delay.
Moreover, SNS is highly available and durable, ensuring that messages are delivered reliably. Businesses can also use SNS to segment their customer base and send targeted messages based on user preferences.
Security and Compliance
SNS provides several security features, including encryption at rest and in transit, IAM roles and policies, and VPC endpoints. Businesses can also use SNS to comply with regulatory requirements such as HIPAA and GDPR.
Additionally, SNS provides detailed logging and monitoring capabilities, enabling businesses to audit message delivery and troubleshoot issues effectively.
Integration with Other AWS Services
SNS integrates seamlessly with other AWS services such as Lambda, EC2, and S3. For example, businesses can use SNS to trigger Lambda functions, which can perform custom actions based on the received message.
Moreover, SNS can be used to notify administrators of system events or errors, enabling them to take timely action to resolve issues.
Create Amazon Simple Notification Service (AWS SNS):
Step 1: Create a topic
Sign in to the Amazon SNS console: From the Amazon console in your AWS account management, select Simple Notification Service through the search box or through Services:
- The Amazon SNS dashboard displays resource details for the region selected in your account.
- On the Topics page, choose Create topic.
- In the encryption section, if you choose Enabling server-side encryption add at-rest encryption to your topic. Amazon SNS encrypts your message as soon as it is received. The message is decrypted immediately prior to delivery.
- In the Access Policy section, the policy defines who can access your topic. By default, only the topic owner can publish or subscribe to the topic.
- Scroll to the end of the form and choose Create topic.
The console opens the new topic Details page. And it tells us that the topic was created successfully.
Step 2: Create a subscription to the topic
- On the Subscriptions page, choose Create subscription.
-On the Create subscription page, choose the Topic ARN field to see a list of the topics in your AWS account.
-Choose the topic that you created in the previous step.
- For Protocol, choose Email (or any protocol you need).
- For Endpoint, enter an email address that can receive notifications.
- Choose Create subscription.
The console opens the new subscription's Details page. And tells us that the subscription was created successfully.
- Check your email inbox and choose Confirm subscription in the email from AWS Notifications.
- The sender ID is usually "no-reply@sns.amazonaws.com".
On the Subscription page: Subscription is pending.
Step 3: Publish a message to the topic
- In the left navigation pane, choose Topics.
- On the Topics page, choose the topic that you created earlier, and then choose Publish message.
-The console opens the Publish message to topic page.
-(Optional) In the Message details section, enter a Subject, such as: ‘ SNSTest’
- In the Message body section, choose Identical payload for all delivery protocols, and then enter a message body, such as: ‘ Hello Hello’
In the message attribute: choose the type and put the name and value
- Choose Publish message.
The message is published to the topic, and the console opens the topic's Details page.
- Check your email inbox and verify that you received an email from Amazon SNS with the published message.
Step 4: Delete the subscription and topic
- On the navigation panel, choose Subscriptions. -On the Subscriptions page, choose a confirmed subscription and then choose Delete.
Note: You can't delete a pending confirmation. After 3 days, Amazon SNS deletes it automatically.
- On the navigation panel, choose Topics.
- On the Topics page, choose a topic and then choose Delete.
Important
When you delete a topic, you also delete all subscriptions to the topic.
References:
https://docs.aws.amazon.com/sns/latest/dg/welcome.html
https://docs.aws.amazon.com/sns/latest/dg/sns-getting-started.html
Top comments (0)