Amazon SQS, Amazon SNS, or Amazon EventBridge?
Understand the differences and pick the one that's right for you
Purpose |
Understand the differences between Amazon SQS, Amazon SNS, and EventBridge and determine which service is the best fit for your needs. |
Last updated |
July 31, 2024 |
Covered services |
Introduction
When building applications on AWS, you might want help in choosing the right service for handling messaging, event-driven architectures, and decoupling components. AWS offers three key services for these purposes—Amazon Simple Queue Service (Amazon SQS), Amazon Simple Notification Service (Amazon SNS), and Amazon EventBridge (formerly known as CloudWatch Events).
-
Amazon SQS is a fully managed message queuing service that enables decoupling and scaling of microservices, distributed systems, and serverless applications.
-
Amazon SNS is a highly available, durable, and secure pub/sub messaging service that allows decoupled applications to communicate with each other using a publish-subscribe model.
-
Amazon EventBridge is a serverless event bus designed to make it easier to build event-driven architectures by allowing you to connect applications using data from various sources and route it to targets like AWS Lambda.
While all three services facilitate communication between decoupled components, they differ in their underlying architecture, use cases, and capabilities.
Here's a high-level view of the key differences between these services to get you started.
Category | Amazon SQS | Amazon SNS | EventBridge |
---|---|---|---|
Communication model | Pull-based (consumers poll messages from the queue) | Push-based (subscribers receive messages when published) | Pushed-based. Event-driven (rules match events and route to targets) |
Persistence | Messages persist until consumed or expired | Messages do not persist; delivered in real-time to subscribers | Events do not persist; processed in real-time |
Delivery guarantees | At-least-once delivery | At-least-once delivery for HTTP/S, exactly-once for Lambda and Amazon SQS | At-least-once delivery |
Message ordering | FIFO (First-In-First-Out) queues ensure strict ordering | Amazon SNS FIFO topics guarantee order | No ordering guarantees |
Message filtering | Amazon SQS can’t decide consumer based on message. Use Amazon SNS message filtering with Amazon SQS to achieve. | Message filtering using subscription filter policies based on message metadata and for FIFO topics, message content | Complex event pattern matching and content-based filtering |
Supported subscribers | Pull-based consumers (such as Amazon EC2 or Lambda) | HTTP/S endpoints, email, SMS, mobile push, Lambda, Amazon SQS | AWS services, Lambda, API destinations, event buses in other AWS accounts |
Typical use cases | Decoupling microservices, buffering requests, processing tasks asynchronously | Fanout notifications, pub/sub messaging, mobile push notifications | Event-driven architectures, real-time stream processing, cross-account event sharing |
Integration with other AWS services | Lambda, CloudWatch, AWS KMS, IAM | Lambda, Amazon SQS, Mobile Push, AWS KMS, IAM | Lambda, Step Functions, Amazon SQS, Amazon SNS, Kinesis, SageMaker AI, CloudWatch, IAM |
Details on the differences
Explore differences between Amazon SQS, Amazon SNS, and EventBridge in eight key areas. These cover communication model, persistence, message ordering, filtering, integrations, use cases, scalability, and pricing.
Amazon SQS
-
Pull-based model where consumers actively poll messages from the queue, allowing for fine-grained control over message processing rates and independent scaling of consumers.
Amazon SNS
-
Push-based model where subscribers receive messages in real-time as they are published, enabling immediate message delivery to multiple subscribers.
Amazon EventBridge
-
Event-driven model where events are matched against predefined rules and routed to target services for processing, facilitating the building of reactive, event-driven architectures.
Use
-
Get started with Amazon SQS
Get step-by-step instructions on setting up and using Amazon SQS. It covers topics such as creating a queue, sending and receiving messages, and configuring queue properties.
-
Amazon SQS tutorial
Walk through a practical example of using Amazon SQS to decouple the components of a simple application. It demonstrates how to create a queue, send messages to the queue, and process messages from the queue using AWS SDKs.
-
Orchestrate Queue-based Microservices
Learn how to design and run a serverless workflow that orchestrates a message queue-based microservice.
-
Send Fanout Event Notifications
Learn how to implement a fanout messaging scenario using Amazon SQS and Amazon SNS.