Simple Notification Service (SNS)

Notifications in major communications medium as a service; like e-mail, text, or some social media platforms.

Essentials

  • Coordinates and manages the sending and delivery of messages to subscribers

  • Receive notifications when AWS events occur

  • Integrated into many AWS services, so it is easy to setup notifications based on events that occur in those services

  • With Cloudwatch and SNS, a full-environment monitoring solution can be created that notifies admins of alerts, capacity issues, downtime, changes in the environment and more!

  • Can also be used for mobile push messages

Components

  • Topic:

    • Object to which you publish your message (<= 256KB)

      • Too small for documents (maybe with S3 pre-signed URL) or large emails with many images/attachments

      • Also consider SES (Simple E-mail Service)

    • Subscribers subscribe to the topic to receive the message

  • Subscriber:

    • Endpoint to a message is sent. Messages are simultaneously pushed to subscribers

    • Available endpoints:

      • HTTP

      • HTTPS

      • Email

      • Email-JSON

      • SQS

      • Application, Mobile APP notifications (IOS/Android/Amazon/Microsoft)

      • Lambda

      • SMS (cellular text)

    • Up to 10 million per topic (soft limit)

  • Publisher:

    • "Entity" that triggers the sending of a message

    • Examples:

      • Application

      • S3 event

      • Cloudwatch Alarm

Implementation

  • While it integrates simply with Amazon Services, some like S3 require you to modify the SNS policy to give access to that bucket, for example

{
        "Effect": "Allow",
        "Principal": {
            "AWS": "*"
    },
        "Action": "SNS:Publish",
        "Resource": "SNS_ARN_REPLACE_ME",
        "Condition": {
            "StringEquals": {
                "aws:SourceArn": "S3_BUCKET_ARN_REPLACEME"
            }
        }
    },

Last updated

Was this helpful?