How SNS topics and EventBridge event buses differ on routing, fan-out, latency, ordering and pricing, which one fits service-to-service events, and how Encore gives you SNS and SQS from a topic declared in code.

SNS and EventBridge both let one service announce that something happened and let several others react, so teams building their first event-driven feature on AWS often pick one at random. Amazon SNS is a topic that pushes every message to every subscriber, optionally filtered, while Amazon EventBridge is a bus where rules match fields inside each event and route it to targets, and the difference shows up later as latency, ordering and how much routing logic ends up in AWS configuration instead of code.
This comparison covers where each one fits, how they combine, and how Encore provisions SNS and SQS for service-to-service events from a topic declared in your backend.
Encore combines an open source infrastructure SDK with a platform that provisions and deploys into your own AWS or GCP account. Events between services are typed Pub/Sub topics declared in Go or TypeScript, and on AWS each topic becomes an SNS topic with an SQS queue and dead-letter queue per subscription, with publish and consume permissions granted to the services that use them, as described in the AWS infrastructure docs.

Run in your terminal to get started locally.
The invoices service declares and publishes the event, and the ledger service subscribes:
// invoices/events.go
package invoices
import "encore.dev/pubsub"
type InvoicePaid struct {
InvoiceID string `json:"invoice_id"`
CustomerID string `json:"customer_id"`
AmountCents int64 `json:"amount_cents"`
}
var InvoicesPaid = pubsub.NewTopic[*InvoicePaid]("invoice-paid", pubsub.TopicConfig{
DeliveryGuarantee: pubsub.AtLeastOnce,
})
// ledger/ledger.go
package ledger
import (
"context"
"encore.app/invoices"
"encore.dev/pubsub"
"encore.dev/storage/sqldb"
)
var db = sqldb.NewDatabase("ledger", sqldb.DatabaseConfig{Migrations: "./migrations"})
var _ = pubsub.NewSubscription(
invoices.InvoicesPaid, "record-payment",
pubsub.SubscriptionConfig[*invoices.InvoicePaid]{
Handler: recordPayment,
},
)
// Idempotent: the invoice id is the primary key of payments.
func recordPayment(ctx context.Context, e *invoices.InvoicePaid) error {
_, err := db.Exec(ctx, `
INSERT INTO payments (invoice_id, customer_id, amount_cents)
VALUES ($1, $2, $3)
ON CONFLICT (invoice_id) DO NOTHING
`, e.InvoiceID, e.CustomerID, e.AmountCents)
return err
}
Publishing is one call, invoices.InvoicesPaid.Publish(ctx, &invoices.InvoicePaid{...}), from any endpoint in the invoices service. Routing that EventBridge would express as an event pattern becomes ordinary code in the subscriber, so a rule such as "only invoices over 10,000 cents" is an if statement covered by the same tests as the rest of the handler. encore run delivers events locally, so the publish and the subscriber show up in one trace on a laptop, and the Pub/Sub docs cover retry policies, ordered topics and dead-letter handling.
A coding agent adding a "send receipt" consumer writes a new subscription in its own service and tests it against the local topic, with no topic policy, queue policy or rule to edit in a second repository. Encore can also use an existing SNS topic if other systems already publish to one.
encore test gives each test isolated Pub/Sub, per the Pub/Sub testing docs, so a subscriber's behavior can be asserted without a shared topic.
Best fit: Backend teams on AWS who want service-to-service events with SNS fan-out and SQS durability, declared and tested in the application code and provisioned in their own account.
SNS pushes each published message to every subscription on the topic: SQS queues, Lambda functions, HTTP and HTTPS endpoints, email, SMS and mobile push. AWS describes it as the choice for high fan-out with typical latency under 30 milliseconds in its EventBridge FAQ, and FIFO topics combined with FIFO queues give strict ordering per message group. Subscription filter policies can match message attributes or, more recently, fields in the message body, which covers simple routing without code.
The standard pattern is SNS in front of one SQS queue per consumer, because SNS itself does not store messages for later: a queue gives each consumer its own backlog, retries and dead-letter queue. That pattern usually ends up written in Terraform, with a queue policy per subscription, raw message delivery turned on and IAM for the publisher and each consumer.
Best fit: Service-to-service fan-out, notifications to people (email, SMS, push), and workloads that need ordering or very low latency.
EventBridge receives events from your applications, from over 200 AWS services and from SaaS partners, and rules match event patterns on any JSON field to route events to targets such as Lambda, SQS, SNS, Step Functions and API destinations. It adds features SNS lacks: archive and replay, a schema registry, Pipes for point-to-point integrations, and cross-account buses for organization-wide events. AWS's decision guide lists no ordering guarantee for EventBridge.
Custom events cost $1.00 per million, with each 64 KB chunk billed as one event, per the pricing page, and rule matches and multiple targets on a rule add no EventBridge charge. The flexibility moves logic into rules: a pattern that decides which service gets which event lives in Terraform or CloudFormation, is tested by deploying it, and is invisible to someone reading the consumer's code.
Best fit: Reacting to AWS service events (an S3 object created, an ECS task stopped), SaaS integrations, audit and cross-account event routing.
The patterns combine well: EventBridge rules catch AWS and SaaS events and forward the ones you care about to an SNS topic or SQS queue, and services talk to each other over SNS and SQS. AWS's own FAQ describes SNS as a common target of EventBridge rules for this reason.
Pick Encore when the events flow between your own services and you want SNS fan-out with an SQS queue and dead-letter queue per consumer, declared in code, testable under encore run and provisioned in your AWS account. Pick SNS directly for notifications to people or when a platform team manages topics in Terraform. Pick EventBridge for events that originate in AWS services or SaaS tools and need pattern-based routing, replay or cross-account delivery.
SNS is a pub/sub topic built for high fan-out to SQS queues, Lambda functions, HTTP endpoints, email, SMS and mobile push, with subscription filter policies. EventBridge is an event bus that matches events against rules on any field of a structured JSON event and routes them to over 20 AWS targets, and it receives events from AWS services and SaaS partners.
Use EventBridge when you need content-based routing on fields inside the event, events from AWS services or SaaS partners, archive and replay, or cross-account event buses. Use SNS, usually with SQS queues behind it, for service-to-service fan-out where low latency, FIFO ordering or very high subscriber counts matter.
Declare the topic with pubsub.NewTopic[*InvoicePaid]("invoice-paid", pubsub.TopicConfig{DeliveryGuarantee: pubsub.AtLeastOnce}), publish with InvoicePaid.Publish(ctx, event), and add subscribers with pubsub.NewSubscription. On AWS, Encore creates the SNS topic and an SQS queue with a dead-letter queue for each subscription in your own account.
Per published message, yes. EventBridge custom events cost $1.00 per million and SNS standard topic publishes cost $0.50 per million, though SNS also charges per delivery to some endpoint types and EventBridge does not charge extra for rule matches. At typical service-to-service volumes both bills are small.
Deploy to your cloud on AWS and Google Cloud
without managing infrastructure
Encore lets developers and agents define application infrastructure directly in code, then automatically provisions it from local development to production in your AWS or GCP account.