I read through this reference but I still don’t understand when somebody would prefer EventBridge over SNS?
Let’s say I want to build a messaging hub, such as Event → SNS → SQS → Lambda with custom logic. I understand that I could substitute SNS for EventBridge. But why would I do that?
What advantages does EventBridge have over SNS? Is it considered the “modern SNS”?
So there’s a couple reasons. If you wanted to do custom routing based on message content. Say you want purchase events to go to this queue vs that, you could annotate the event and create a rule to route to the intended queue. You can add a different rule later if you also want it to go to firehose or whatever.
One of the other really nice thing is replaying events. You can replay events from the past number of days either targeting a particular rule or all rules. Super helpful if a bug is introduced, remediated, and the events need to be backfilled with the fixed code.
That is a really helpful answer. For a rather simple messaging hub, I think it might be overkill compared to SNS?
Or turning the question around: is there any good reason why somebody would prefer SNS over EventBridge? It seems like EventBridge can do all what SNS can (besides ordering) and much more…
It’s a completely different ball game. I use EventBridge for a cross-account async messaging backbone, think of this as an **inter-**application messaging platform.
You define a message schema, an ingestion lambda to process it, and use this as a backbone.
SNS and SQS are arguably better suited to **intra-**application messaging use cases within a single account.
This video and other stuff by Luc van Donkersgoed is good on this topic.
Different use cases, if the AWS link doesn’t make sense some common scenarios are:
SQS - used mostly inside your application, front end throws jobs - many to many - back end picks them up. Task dispatch.
SNS - delivers app events, not jobs. One to many - file uploaded, user signed in, data processing failed etc - any microservice that needs to take action, go. Can also directly call lambads, send email etc.
Eventbridge - Think of this as infrastructures event plane. Your app can signal it but where the target isn’t your app, it’s something else. “my dependant service/api/s3 call is failing”, “this IP has too many failed login attempts, ban it on the WAF” etc it can independantly take action and or notify humans.
How about when you need to put a FIFO SQS as a destination of the EB Rule or SNS Filter? If I’m receiving multiple events for multiple ids, and only want to FIFO based on the id, I know SNS-SQS supports that. Is there a way to do that with EB as well?
I feel they reached full capability of SNS and more complex use cases kept coming up that SNS wasn’t capable of without a massive rewrite. What to do? Make a new service and long term deprecate the old one.
Yeah exactly, it seems like the only difference according to the docs are that eventbridge and SNS supports slightly different targets (although many overlap). For example, EB supports Step functions as a target.
Other than that, the docs only mention EB supports “Complex event pattern matching and content-based filtering”… whatever that means
This lists underlying functional differences. I got here looking for differences in use cases because that helps me understand the higher level context of each.