📣 Limited offer: subscribe to cloudonaut plus, get a t-shirt for free

📣 Limited offer: free cloudonaut t-shirt

Amazon EventBridge versus Amazon SNS: What's the difference?

Michael Wittig – 18 Nov 2020

Amazon EventBridge (formerly CloudWatch Events) and Amazon SNS provide a way to send events to multiple subscribers. From a high-level perspective, both services are similar. This leads to the question: But how are they different? What advantages do the services have? Should you choose SNS or EventBridge?

EventBridge versus SNS

From time to time, I scroll through major service announcements by AWS. One thing I noticed: EventBridge received four new major features (content filtering, schema registry, DLQs, replay & archival) this year already. SNS received one new feature (FIFO topics) in 2020 so far. On top of that, a nasty SNS bug forced me to look for alternatives. In this post, I present you the options and help you to choose the service for your use case.

SNS Standard

First of all, Amazon SNS comes in two flavors. SNS Standard (which was the only option until October 2020) and SNS FIFO. This section covers SNS Standard. The next section will talk about SNS FIFO.

SNS is a fully managed, publish/subscribe system. You send a message to a topic, and all subscribers to that topic will receive a copy of the message.

SNS

Subscribers are always push-based. For example:

  • SNS invokes an HTTP endpoint
  • SNS invokes a Lambda function
  • SNS sends a message to SQS
  • SNS sends an email/SMS/mobile push

It is not possible to pull messages as with Google’s PubSub.

A message can be any string that is not larger than 256 KB. If you want to filter messages, you have to add message attributes because SNS can not inspect the payload of messages.

It is important to note that messages might be delivered out of order and might be delivered more than once (at least once).

Operating SNS requires that you monitor the NumberOfMessagesPublished metric to be lower than the soft limit. The default soft limit is different for individual regions (in the range of 300 - 30,000). The hard limit is not disclosed.

SNS can be used to implement massive message fanout. A single topic can have millions of subscribers. Keep in mind that if a topic has zero subscribers, the message is sent into a black hole and disappears.

SNS pricing is based on the number of messages published and the number of messaged delivered. You pay $0.50 per 1 million requests. If your request is larger than 64 KB, you pay for each 64KB chunk of your request. No matter how small your request is, you always pay for one request. The maximum size of 256 KB will result in 4 requests on your bill. Depending on the subscriber type, you pay for deliveries as well. For example, an HTTP subscriber is charged $0.60 for 1 million messages while Lambda and SQS subscribers are free (Lambda and SQS charges apply).

Special offer: cloudonaut t-shirt

Do you love our blog posts and podcast episodes? Unlock our weekly videos and online events by subscribing to cloudonaut plus.

Special offer: Join cloudonaut plus before November 30th, and we will send you a cloudonaut t-shirt for free.

Subscribe now!

SNS’s typical latency is under 30 ms. AWS recommends using SNS for applications that react to high throughput or low latency messages.

SNS FIFO

SNS FIFO topics provide strict ordering of messages. SNS FIFO also provides a way to ensure that a message is not created twice if a producer retries in case of failures. Therefore, exactly once delivery is possible.

But there are downsides:

  • FIFO topics can only handle 300 messages per second or 3000 messages if you send messages in batches of ten but no more than 10 MB per second.
  • The only possible subscriber type for a FIFO topic is an SQS FIFO queue.
  • FIFO topics are more expensive. You pay per message and for the size of the payload.

EventBridge

Amazon EventBridge (formerly CloudWatch Events) is a fully managed, publish/subscribe system. The publisher sends a JSON event to an event bus. If you want to receive events, you create a rule. If the published event matches with a rule, the event is routed to up to five targets. More than 15 target types are supported (including SQS, SNS, Lambda). EventBridge guarantees are similar to SNS Standard: zero operational effort but no order guarantee and at least once delivery of messages.

EventBridge can be used to implement modest message fanout. A rule can trigger up to 5 targets. By default, you can create 300 rules per event bus (a soft limit that can be increased; the hard limit is not disclosed). Keep in mind that if an event does not match with a rule, it disappears unnoticed. You can optionally archive all events delivered to an event bus. Archived events can be replayed at any time.

EventBridge uses soft limits to throttle message producers. The default limits depend on the region. For example, in eu-west-1, the default limit is 2400 msg/sec. There is no metric to monitor this resource constraint. The hard limit is not disclosed. Keep in mind that invocations are also throttled according to soft limits. Monitor the Invocations metric.

Typical latency is about half a second. (from the FAQS: “Note that this can vary”)

You pay $1.00 per 1 million events published. The same 64KB chunk logic as with SNS applies.

cloudonaut plus

Want to learn more about the latest features of EventBridge? Subscribe to cloudonaut plus to get access to my exclusive video with a demo of the latest EventBridge features. Find a preview of the video below.

Subscribe to cloudonaut plus to get access to the full video.

Already a cloudonaut plus subscriber? Watch the full video.

Summary

Use the following comparison table to support your decision.

Amazon SNS Standard Amazon SNS FIFO EventBridge
Scaling not disclosed (soft limits apply) 3000 msg/sec (batch write) or 10 MB per second not disclosed (soft limits apply)
Max. message size 256 KB 256 KB 256 KB
Persistence archiving is possible
Replication Multi-AZ Multi-AZ Multi-AZ
Order guarantee
Delivery guarantee at least once exactly-once possible at least once
Pricing per message per message per message
Cost 💰 💰💰💰 💰💰
Protocols AWS Rest API AWS Rest API AWS Rest API
AWS Integrations Lambda, SQS, webhook SQS FIFO Lambda, SQS, SNS, and many more
License AWS only AWS only AWS only
Encryption at rest
Encryption in transit
Michael Wittig

Michael Wittig

I’m an independent consultant, technical writer, and programming founder. All these activities have to do with AWS. I’m writing this blog and all other projects together with my brother Andreas.

In 2009, we joined the same company as software developers. Three years later, we were looking for a way to deploy our software—an online banking platform—in an agile way. We got excited about the possibilities in the cloud and the DevOps movement. It’s no wonder we ended up migrating the whole infrastructure of Tullius Walden Bank to AWS. This was a first in the finance industry, at least in Germany! Since 2015, we have accelerated the cloud journeys of startups, mid-sized companies, and enterprises. We have penned books like Amazon Web Services in Action and Rapid Docker on AWS, we regularly update our blog, and we are contributing to the Open Source community. Besides running a 2-headed consultancy, we are entrepreneurs building Software-as-a-Service products.

We are available for projects.

You can contact me via Email, Twitter, and LinkedIn.

Briefcase icon
Hire me