What is AWS SNS?

Bits Lovers
Written by Bits Lovers on
What is AWS SNS?

Let’s look at another AWS service for decoupling your applications. This one’s called Simple Notification Service, or SNS.

If you want to understand how SNS differs from SQS, check out my comparison post.

What we’ll go through:

  • What push-based messaging means
  • When SNS makes sense
  • Key settings you’ll deal with
  • How to create and test an SNS topic
  • Some exam tips

Let’s get started.

What is push-based messaging?

Here’s a simple way to think about it.

Poll-based messaging is like a mailbox. The mail carrier drops off letters, and you pick them up whenever you want. Push-based messaging works differently. The carrier doesn’t just leave the letter at your door. They knock, you answer, and they hand it directly to you. You don’t decide when to check. The message arrives the moment it’s ready.

That’s push-based messaging in a nutshell. The sender pushes it to you, and you need to be ready to receive it.

What is AWS SNS?

SNS is AWS’s push-based messaging service. When something publishes a message to an SNS topic, all subscribed endpoints receive it right away. This works well for alerting systems when specific events happen.

The good news: you don’t have to worry about scaling. AWS handles that.

Some typical use cases:

  • CloudWatch alarm triggers send you an SMS or email
  • An event occurs and multiple services need to react
  • One message needs to fan out to multiple SQS queues

Remember this: SNS means push-based messaging.

What is push-based messaging

What is push-based messaging?

One thing I prefer about SNS compared to SQS is the simpler configuration. SQS makes you deal with visibility timeouts and message locking. SNS messages arrive and go straight out to subscribers. Less to manage.

Subscribing to an SNS Topic

Here’s how it works: you create a topic, then attach subscribers to it. When a message hits the topic, SNS delivers it to everyone subscribed.

Subscriber types you can use:

  • HTTP/HTTPS endpoints
  • Email and Email-JSON
  • Amazon SQS queues
  • AWS Lambda functions
  • SMS text messages
  • Mobile push notifications (APNs, FCM, etc.)
  • Amazon Kinesis Data Firehose
  • Amazon SES

A common pattern is fan-out: one message to SNS, then SNS sends copies to multiple SQS queues. Different backend groups can process the same message independently.

SNS Message Size Limit

The message size limit is 256KB for both Standard and FIFO topics. This includes the entire JSON payload, structure and attributes.

AWS increased this from 64KB to 256KB back in 2021, so if you see older references to the 64KB limit, that’s outdated.

Dead-Letter Queue Support

SNS supports dead-letter queues, but not how you might expect. A dead-letter queue for SNS is just an SQS queue. When message delivery fails and retries are exhausted, the message goes to that SQS queue for later processing.

HTTP/HTTPS is the exception. For those, you can configure retry behavior directly. For everything else, SNS gives up after the retry policy and the message lands in your DLQ.

FIFO or Standard SNS

SNS gives you two topic types: Standard and FIFO.

Standard topics give you best-effort delivery. Messages might arrive out of order or with duplicates. FIFO topics guarantee ordering within message groups and exactly-once delivery.

One thing to note with FIFO: only SQS queues can subscribe to FIFO topics. If you need fan-out to other endpoint types, use a Standard topic.

Most SNS usage I see is Standard topics. FIFO is for specific ordering requirements like financial transactions.

SNS Encryption

SNS encrypts messages in transit by default. You can add encryption at rest by enabling SSE-KMS. The process is simple: check a box in the console or set an attribute via CLI, and choose a KMS key. AWS provides a default key at no extra cost, or you can use your own customer-managed key.

SNS Access Policy

SNS topics use IAM-style policies. You control who can publish to topics and who can subscribe. This works the same way as S3 bucket policies or SQS queue policies.

Console Walkthrough

Creating an SNS Topic

  1. Open the Amazon SNS console
  2. Go to Topics in the left menu
  3. Click Create topic
  4. Select Standard (FIFO is the default, so uncheck that)
  5. Give it a name like BitsLoversTopic
  6. Click Create topic

Creating a Subscription

  1. Go to Subscriptions in the menu
  2. Click Create subscription
  3. Select your topic ARN
  4. Choose a protocol (Email, SQS, Lambda, etc.)
  5. Enter the endpoint
  6. Click Create subscription

For email subscriptions, you’ll receive a confirmation email. Click the link to verify.

Publishing a Message

  1. Go to Topics
  2. Select your topic
  3. Click Publish message
  4. Add an optional subject
  5. Write your message body
  6. Click Publish

Check your email or endpoint to confirm delivery.

SNS Pricing

SNS has no upfront fees and no minimum commitments. You pay only for what you use.

Approximate pricing (US East-1):

  • $0.50 per million requests
  • First 100,000 notifications per month are free
  • Email notifications: $0.10 per million after the free tier
  • SMS: varies by destination country, around $0.06-$0.90 per 100 segments
  • SQS, Lambda, HTTP/S: no per-notification charge, data transfer rates apply

Check the AWS SNS pricing page for your specific region.

Exam Tips

Tip 1: When you see “alert” or “notification” in an exam scenario, think SNS. Push-based alerts pointing to multiple endpoints? That’s SNS.

Tip 2: Push-based notifications equal SNS. Remember that.

Tip 3: CloudWatch alarms use SNS for notifications. CloudWatch collects metrics and triggers alarms, but the actual alert delivery goes through SNS.

Tip 4: SES versus SNS for email. SES is for marketing and bulk email campaigns. SNS is for transactional notifications triggered by events. The exam will try to trick you with SES when SNS is the right answer for automated alerts.

Tip 5: Know your subscriber options. Know when you’d use SQS versus Lambda versus HTTP versus SMS. Each has a specific use case.

Tip 6: No retry for most protocols. SNS retries HTTP/HTTPS deliveries. For SQS, Lambda, and other protocols, failed deliveries go to your dead-letter queue. Plan for this.

What Changed Since 2021

A few updates to be aware of:

  • Message size: Increased from 64KB to 256KB in 2021. The post you’re reading was originally written around that change.
  • FIFO filtering: Message filtering on FIFO topics was added in 2022. You can now apply filter policies while maintaining ordering guarantees.
  • FIFO throughput: The soft limit for FIFO publishes increased from 150 to 300 per second in 2024.
  • HTTP DLQ improvements: Fine-grained DLQ control for HTTP subscriptions came in 2024. You can now configure retry count from 1-100.
  • AWS PrivateLink: VPC endpoints for SNS became available in 2023, enabling private connectivity without internet access.

Wrapping Up

SNS is a simple service. It pushes messages to subscribers when events happen. You don’t manage infrastructure, and it’s inexpensive for most use cases.

If you’re building decoupled architectures on AWS, SNS works well with SQS. SQS holds messages for asynchronous processing, and SNS pushes notifications for synchronous alerting. Both belong in your toolkit.

Go set up some topics and test it out.

Bits Lovers

Bits Lovers

Professional writer and blogger. Focus on Cloud Computing.

Comments

comments powered by Disqus