{"id":175616,"date":"2023-12-22T22:47:01","date_gmt":"2023-12-22T21:47:01","guid":{"rendered":"https:\/\/liora.io\/en\/?p=175616"},"modified":"2026-02-06T08:40:06","modified_gmt":"2026-02-06T07:40:06","slug":"amazon-sns-the-messaging-service-connected-to-aws","status":"publish","type":"post","link":"https:\/\/liora.io\/en\/amazon-sns-the-messaging-service-connected-to-aws","title":{"rendered":"Amazon SNS: The messaging service connected to AWS"},"content":{"rendered":"<h2>Amazon SNS is a service for sending push notifications from an application to the end user or other programs.<\/h2>\t\t\n\t\t<p>It&#8217;s a comprehensive messaging service that enables communication between applications (<b>A<\/b>application<b> T<\/b>o <b>A<\/b>application &#8211; <b>A2A<\/b>) or persons (<b>A<\/b>application <b>T<\/b>o <b>P<\/b>erson &#8211; <b>A2B<\/b>). It allows you to create topics (i.e. subjects) that will be the logical access and communication channel. <\/p><p>SNS uses the <b>pub\/sub<\/b> paradigm (<b>publish \/ subscribe<\/b>) for message delivery. This principle establishes that publishers (<b>publishers<\/b>) send messages via common communication channels called &#8220;topic&#8221; (<b>topic<\/b>), while subscribers (<b>subscribers<\/b>) automatically receive messages corresponding to the topics for which they are subscribed.<\/p><p>We can visualize the <b>topics<\/b> as a virtual &#8220;mailbox&#8221; that allows individual subscribers to retrieve messages without having to communicate directly with the editors. In this way, each subscriber can specify the types of messages they wish to receive, via their various subscriptions.<\/p>\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t<figure>\n\t\t\t\t\t\t\t\t\t\t<img decoding=\"async\" src=\"https:\/\/liora.io\/app\/uploads\/2023\/03\/image4-5.png\" title=\"\" alt=\"\" loading=\"lazy\">\t\t\t\t\t\t\t\t\t\t\t<figcaption>Source : aws.amazon.com<\/figcaption>\n\t\t\t\t\t\t\t\t\t\t<\/figure>\n\t\t\t<h3>Definition of important terminology <\/h3>\t\t\n\t\t<p>It&#8217;s important to understand certain terms related to messaging services before proceeding. The<strong> table below will help you understand these key terms:<\/strong><\/p>\t\t\n\t\t\t<style type=\"text\/css\">\n.tg  {border-collapse:collapse;border-spacing:0;}\n.tg td{border-color:black;border-style:solid;border-width:1px;font-family:Arial, sans-serif;font-size:14px;\n  overflow:hidden;padding:10px 5px;word-break:normal;}\n.tg th{border-color:black;border-style:solid;border-width:1px;font-family:Arial, sans-serif;font-size:14px;\n  font-weight:normal;overflow:hidden;padding:10px 5px;word-break:normal;}\n.tg .tg-mn8v{background-color:#9b9b9b;border-color:inherit;font-weight:bold;text-align:center;vertical-align:top}\n.tg .tg-3jt2{background-color:#9b9b9b;border-color:inherit;font-size:20px;font-weight:bold;text-align:center;vertical-align:top}\n.tg .tg-0pky{border-color:inherit;text-align:left;vertical-align:top}\n<\/style>\n<table>\n<thead>\n  <tr>\n    <th>Term<\/th>\n    <th>Description<\/th>\n  <\/tr>\n<\/thead>\n<tbody>\n  <tr>\n    <td>Publisher<br><img decoding=\"async\" src=\"https:\/\/liora.io\/app\/uploads\/2023\/03\/image7-5.png\" alt=\"Image\" width=\"50\" height=\"50\"><\/td>\n    <td>\n        <ul>\n            <li>The publisher is the entity responsible for sending messages on various topics and endpoints. We can think of a publisher as a person who sends messages to a mailbox.<\/li>\n        <\/ul>\n        <ul><ul>\n            <li>Endpoints can be emails, SMS, HTTP, mobile applications, or other Amazon services (such as Lambda or SQS).<\/li>\n        <\/ul><\/ul>\n    <\/td>\n  <\/tr>\n  <tr>\n    <td rowspan=\"3\">Subscriber<br><img decoding=\"async\" src=\"https:\/\/liora.io\/app\/uploads\/2023\/03\/image12-1.png\" alt=\"Image\" width=\"50\" height=\"50\"><\/td>\n    <td rowspan=\"3\">\n        <ul>\n            <li>The subscriber is the entity that receives published messages on a topic. We can think of the subscriber as a person who retrieves their mail from their mailbox.<\/li>\n        <\/ul>\n        <ul><ul>\n            <li>Subscribers subscribe to a topic in order to receive messages.<\/li>\n            <li>By default, SNS offers 10 million subscriptions per topic.<\/li>\n        <\/ul><\/ul>\n    <\/td>\n  <\/tr>\n  <tr>\n  <\/tr>\n  <tr>\n  <\/tr>\n  <tr>\n    <td rowspan=\"3\">Topic<br><img decoding=\"async\" src=\"https:\/\/liora.io\/app\/uploads\/2023\/03\/image13-1.png\" alt=\"Image\" width=\"50\" height=\"50\"><\/td>\n    <td rowspan=\"3\">\n        <ul>\n            <li>The topic is the communication channel that allows publishers to publish their messages and subscribers to receive them. We could imagine this as a shared mailbox among several people, where each person can receive letters addressed to them.<\/li>\n        <\/ul>\n        <ul><ul>\n            <li>By default, SNS offers 100,000 topics per account.<\/li>\n            <li>Except for SMS messages, Amazon SNS messages can contain a maximum of 256 KB of text data, including XML, JSON, or plain text format.<\/li>\n        <\/ul><\/ul>\n    <\/td>\n  <\/tr>\n  <tr>\n  <\/tr>\n  <tr>\n  <\/tr>\n<\/tbody>\n<\/table>\n\t\t<p>The diagram below perfectly illustrates the elements provided above:<\/p>\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t<figure>\n\t\t\t\t\t\t\t\t\t\t<img decoding=\"async\" src=\"https:\/\/liora.io\/app\/uploads\/2023\/03\/image8-1.png\" title=\"\" alt=\"\" loading=\"lazy\">\t\t\t\t\t\t\t\t\t\t\t<figcaption>Source : aws.amazon.com<\/figcaption>\n\t\t\t\t\t\t\t\t\t\t<\/figure>\n\t\t\t<h3>What are the features of AWS SNS?<\/h3>\t\t\n\t\t<p>Here are some of the key features of AWS SNS:<\/p><ul><li><strong>Scaling:<\/strong> the service automatically adapts to growing message volume requirements.<\/li><li><strong>Message encryption:<\/strong> message protection is a priority SNS protects all messages according to encryption models. They are automatically decrypted once transmitted to the recipient&#8217;s endpoint.<\/li><li><strong>Message filtering:<\/strong> the subscriber can change the filtering policy to receive only relevant notifications.<\/li><li><strong>Replication:<\/strong> when a message is sent to a topic, it is replicated on several endpoints.<\/li><li><strong>Mobile notification:<\/strong> actions from the application (initiated by your users) or from cloud-based business logic can be triggered<\/li><li><strong>Email<\/strong>: Amazon SNS can send mail messages (SMTP)<\/li><\/ul>\t\t\n\t\t\t\n<div class=\"wp-block-buttons is-layout-flex wp-block-buttons-is-layout-flex is-content-justification-center\"><div class=\"wp-block-button \"><a class=\"wp-block-button__link wp-element-button \" href=\"\/formation\/cloud-dev\/aws-solutions-architect\">Ma\u00eetriser les fonctionnalit\u00e9s d&#8217;AWS SNS<\/a><\/div><\/div>\n\n\t\t\t<h3>Comparison between SNS and SQS<\/h3>\t\t\n\t\t<p>These are two messaging services offered by Amazon Web Services. The table below will help you understand the differences:<\/p>\t\t\n\t\t\t<style type=\"text\/css\">\n.tg  {border-collapse:collapse;border-spacing:0;}\n.tg td{border-color:black;border-style:solid;border-width:1px;font-family:Arial, sans-serif;font-size:14px;\n  overflow:hidden;padding:10px 5px;word-break:normal;}\n.tg th{border-color:black;border-style:solid;border-width:1px;font-family:Arial, sans-serif;font-size:14px;\n  font-weight:normal;overflow:hidden;padding:10px 5px;word-break:normal;}\n.tg .tg-axxb{background-color:#c0c0c0;border-color:inherit;color:#000000;font-weight:bold;text-align:center;vertical-align:top}\n.tg .tg-gib6{background-color:#c0c0c0;border-color:inherit;font-size:20px;font-weight:bold;text-align:center;vertical-align:top}\n.tg .tg-3xi5{background-color:#ffffff;border-color:inherit;text-align:center;vertical-align:top}\n<\/style>\n<table>\n<thead>\n  <tr>\n    <th>Feature<\/th>\n    <th>Amazon SNS<br><img decoding=\"async\" src=\"https:\/\/liora.io\/app\/uploads\/2023\/03\/image2-4.png\" alt=\"Image\" width=\"60\" height=\"60\"><\/th>\n    <th>Amazon SQS<br><img decoding=\"async\" src=\"https:\/\/liora.io\/app\/uploads\/2023\/03\/image1-6.png\" alt=\"Image\" width=\"60\" height=\"60\"><\/th>\n  <\/tr>\n<\/thead>\n<tbody>\n  <tr>\n    <td>Model<\/td>\n    <td>Pub \/ Sub<\/td>\n    <td>Queue<\/td>\n  <\/tr>\n  <tr>\n    <td>Primary Use<\/td>\n    <td>Sending messages and notifications to multiple recipients<\/td>\n    <td>Queue management for message delivery<\/td>\n  <\/tr>\n  <tr>\n    <td>Distribution<\/td>\n    <td>All subscribers receive messages<\/td>\n    <td>Messages are consumed by one consumer at a time<\/td>\n  <\/tr>\n  <tr>\n    <td>Communication Protocols<\/td>\n    <td>HTTP, HTTPS, email, SMS, mobile, push, etc.<\/td>\n    <td>Amazon SQS, HTTP, HTTPS<\/td>\n  <\/tr>\n  <tr>\n    <td>Message Format<\/td>\n    <td>JSON, XML, plain text, etc.<\/td>\n    <td>JSON, XML, plain text, etc.<\/td>\n  <\/tr>\n  <tr>\n    <td>Message Processing<\/td>\n    <td>No built-in processing, but can be coupled with Amazon AWS Lambda<\/td>\n    <td>Built-in processing via customizable processing workers<\/td>\n  <\/tr>\n  <tr>\n    <td>Capacity Management<\/td>\n    <td>Dynamically adjustable<\/td>\n    <td>Managed by the number of workers and the number of queues<\/td>\n  <\/tr>\n<\/tbody>\n<\/table>\n\t\t<p>In short, Amazon SNS is designed to send messages to multiple recipients via a pub\/sub messaging model, while Amazon SQS is designed to manage message queues, with a FIFO (first-in, first-out) messaging model.<\/p>\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t<figure>\n\t\t\t\t\t\t\t\t\t\t<img decoding=\"async\" src=\"https:\/\/liora.io\/app\/uploads\/2023\/03\/image10-1.png\" title=\"\" alt=\"\" loading=\"lazy\">\t\t\t\t\t\t\t\t\t\t\t<figcaption><\/figcaption>\n\t\t\t\t\t\t\t\t\t\t<\/figure>\n\t\t<p>They can be <strong>used together to create a complex, highly scalable messaging architecture.<\/strong><\/p><p>As we have just seen, <strong>SNS enables a message to be published to different supported endpoints. When an SQS queue subscribes to an SNS topic<\/strong>, every message sent by that SNS topic joins the queue, along with the message body and its various attributes.<\/p><p>The message is then almost guaranteed to be correctly distributed. &#8220;Almost&#8221;, because the SQS queue may be unavailable. In this case, Amazon SNS will make new attempts (exactly 100,010 attempts over 23 days) before the message is deleted.<\/p><p>If your queue is unavailable for such a long time, you most likely have a problem with your messaging infrastructure.<\/p><p>For more information on Amazon SQS, read our article on the subject.<\/p>\t\t\n\t\t\t<h3>How can I integrate AWS SNS? \n<\/h3>\t\t\n\t\t<p>As you probably know, one of the great strengths of Amazon AWS is the possible integration and joint operation between its various services. SNS is no exception to this rule, and can be easily integrated with different AWS services to create a complete system. Here are a few examples of possible integrations.<\/p>\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img decoding=\"async\" src=\"https:\/\/liora.io\/app\/uploads\/2023\/03\/image5-5.png\" title=\"\" alt=\"\" loading=\"lazy\">\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t<p>Amazon SNS messages can be used as triggers for AWS Lambda functions that perform various operations.<\/p>\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img decoding=\"async\" src=\"https:\/\/liora.io\/app\/uploads\/2023\/03\/image1-7.png\" title=\"\" alt=\"\" loading=\"lazy\">\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t<p>As we&#8217;ve just discussed, Amazon SNS and SQS are often used together, one for publishing messages, the other for queuing them.<\/p>\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img decoding=\"async\" src=\"https:\/\/liora.io\/app\/uploads\/2023\/03\/image3-5.png\" title=\"\" alt=\"\" loading=\"lazy\">\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t<p>If an EC2 instance, database or other resource fails, Amazon SNS can be used to alert system administrators via Cloudwatch.<\/p>\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img decoding=\"async\" src=\"https:\/\/liora.io\/app\/uploads\/2023\/03\/image6-5.png\" title=\"\" alt=\"\" loading=\"lazy\">\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t<p>Amazon SNS can publish notifications of events related to the infrastructure (AWS Elastic Beanstalk service, for example).<\/p>\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img decoding=\"async\" src=\"https:\/\/liora.io\/app\/uploads\/2023\/03\/image11-1.png\" title=\"\" alt=\"\" loading=\"lazy\">\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t<p>Your users using your S3 resources can be notified of new events (uploading or modifying information in an S3 bucket, for example).<\/p>\t\t\n\t\t\t<h3>Conclusion<\/h3>\t\t\n\t\t<p>AWS SNS is a powerful and versatile messaging tool that enables messages to be sent to multiple endpoints (such as email, SMS, SQS queues, mobile applications, etc.). Amazon SNS can also be integrated with other AWS services to create resilient, scalable communication architectures.<\/p><p>&nbsp;<\/p><p>?Related articles:<\/p><table dir=\"ltr\" border=\"1\" cellspacing=\"0\" cellpadding=\"0\" data-sheets-root=\"1\"><colgroup><col width=\"656\"><\/colgroup><tbody><tr><td data-sheets-value=\"{&quot;1&quot;:2,&quot;2&quot;:&quot;AWS Elastic Load Balancer: The solution that distributes network traffic&quot;}\" data-sheets-hyperlink=\"https:\/\/liora.io\/en\/aws-elastic-load-balancer-the-solution-that-distributes-network-traffic\"><a href=\"https:\/\/liora.io\/en\/aws-elastic-load-balancer-the-solution-that-distributes-network-traffic\" target=\"_blank\" rel=\"noopener\">AWS Elastic Load Balancer: The solution that distributes network traffic<\/a><\/td><\/tr><tr><td data-sheets-value=\"{&quot;1&quot;:2,&quot;2&quot;:&quot;Jam AWS: The playful Amazon learning platform&quot;}\" data-sheets-hyperlink=\"https:\/\/liora.io\/en\/jam-aws-the-playful-learning-platform-from-amazon\"><a href=\"https:\/\/liora.io\/en\/jam-aws-the-playful-learning-platform-from-amazon\" target=\"_blank\" rel=\"noopener\">Jam AWS: The playful Amazon learning platform<\/a><\/td><\/tr><tr><td data-sheets-value=\"{&quot;1&quot;:2,&quot;2&quot;:&quot;AWS Lambda: Introduction to the Serverless Function&quot;}\" data-sheets-hyperlink=\"https:\/\/liora.io\/en\/aws-lambda-introduction-to-the-serverless-function\"><a href=\"https:\/\/liora.io\/en\/aws-lambda-introduction-to-the-serverless-function\" target=\"_blank\" rel=\"noopener\">AWS Lambda: Introduction to the Serverless Function<\/a><\/td><\/tr><tr><td data-sheets-value=\"{&quot;1&quot;:2,&quot;2&quot;:&quot;AWS Certification: What is it and how do I get it? &quot;}\" data-sheets-hyperlink=\"https:\/\/liora.io\/en\/aws-certification-what-is-it-and-how-do-i-get-it\"><a href=\"https:\/\/liora.io\/en\/aws-certification-what-is-it-and-how-do-i-get-it\" target=\"_blank\" rel=\"noopener\">AWS Certification: What is it and how do I get it? <\/a><\/td><\/tr><tr><td data-sheets-value=\"{&quot;1&quot;:2,&quot;2&quot;:&quot;AWS SageMaker: A guide for using the platform&quot;}\" data-sheets-hyperlink=\"https:\/\/liora.io\/en\/aws-sagemaker-a-guide-for-using-the-platform\"><a href=\"https:\/\/liora.io\/en\/aws-sagemaker-a-guide-for-using-the-platform\" target=\"_blank\" rel=\"noopener\">AWS SageMaker: A guide for using the platform<\/a><\/td><\/tr><tr><td data-sheets-value=\"{&quot;1&quot;:2,&quot;2&quot;:&quot;5 AWS launches and announcements making developers\u2019 life easy in 2022&quot;}\" data-sheets-hyperlink=\"https:\/\/liora.io\/en\/5-aws-launches-and-announcements-making-developers-life-easy-in-2022\"><a href=\"https:\/\/liora.io\/en\/5-aws-launches-and-announcements-making-developers-life-easy-in-2022\" target=\"_blank\" rel=\"noopener\">5 AWS launches and announcements making developers\u2019 life easy in 2022<\/a><\/td><\/tr><\/tbody><\/table><p>Now that you know everything there is to know about Amazon SNS, you can start learning. To do so, take a look at the Liora training course dedicated to Amazon Web Service.<\/p>\t\t\n\t\t\t\n<div class=\"wp-block-buttons is-layout-flex wp-block-buttons-is-layout-flex is-content-justification-center\"><div class=\"wp-block-button \"><a class=\"wp-block-button__link wp-element-button \" href=\"\/en\/courses\/cloud-dev\/aws-solutions-architect\">Discover AWS training from Liora<\/a><\/div><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Amazon SNS is a service for sending push notifications from an application to the end user or other programs. It&#8217;s a comprehensive messaging service that enables communication between applications (Aapplication To Aapplication &#8211; A2A) or persons (Aapplication To Person &#8211; A2B). It allows you to create topics (i.e. subjects) that will be the logical access [&hellip;]<\/p>\n","protected":false},"author":76,"featured_media":175617,"comment_status":"open","ping_status":"open","sticky":false,"template":"elementor_theme","format":"standard","meta":{"_acf_changed":false,"editor_notices":[],"footnotes":""},"categories":[2434],"class_list":["post-175616","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cloud-dev"],"acf":[],"_links":{"self":[{"href":"https:\/\/liora.io\/en\/wp-json\/wp\/v2\/posts\/175616","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/liora.io\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/liora.io\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/liora.io\/en\/wp-json\/wp\/v2\/users\/76"}],"replies":[{"embeddable":true,"href":"https:\/\/liora.io\/en\/wp-json\/wp\/v2\/comments?post=175616"}],"version-history":[{"count":1,"href":"https:\/\/liora.io\/en\/wp-json\/wp\/v2\/posts\/175616\/revisions"}],"predecessor-version":[{"id":206159,"href":"https:\/\/liora.io\/en\/wp-json\/wp\/v2\/posts\/175616\/revisions\/206159"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/liora.io\/en\/wp-json\/wp\/v2\/media\/175617"}],"wp:attachment":[{"href":"https:\/\/liora.io\/en\/wp-json\/wp\/v2\/media?parent=175616"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/liora.io\/en\/wp-json\/wp\/v2\/categories?post=175616"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}