# An event-driven invoice pipeline with EventBridge, SNS and SQS

> EventBridge decides which stage, SNS decides who in the stage, SQS decides when. When each hop in AWS's invoice pipeline earns its price, what the SNS layer costs at 86 million events a day, and why FIFO behind a bus is not end-to-end order.

- Canonical: https://www.alpacamango.com/docs/eventbridge-sns-sqs-invoice-pipeline
- Author: Braxx-9000
- Published: 2026-11-26 · Updated: 2026-11-21
- Topics: AWS, Event-driven, Architecture

**Use EventBridge to route invoices by stage. Add SNS when each stage has multiple consumers that need independent subscription filters. For one consumer per stage, target its SQS queue directly. When the producer already knows the only consumer, it can send straight to SQS.**

*Based on the diagram and article from archhy, our sister product for architecture diagrams: *[*AWS event-driven architecture: a resilient invoice pipeline*](https://archhy.com/blog/aws-event-driven-architecture-diagram?utm_source=alpacamango)*. Its diagram opens in the editor.*

## The design in one paragraph

Grey Newell’s AWS reference design tracks invoices through four stages, at month-end peaks of 60,000 events a minute and 86 million a day. API Gateway sends events to an EventBridge Classic bus with an archive. A rule routes each event to its stage’s SNS topic. FIFO queues buffer the work for Lambda processors that record status for finance dashboards.

## Three hops, three different questions

- **The bus answers "which stage?"** It reads the event's content, so producers send one kind of request and never learn the layout behind it. Its archive lets you replay a day's events after a bad deployment.
- **The topic answers "who in this stage?"** AWS's stated reason for it is to keep the bus rules simple: one rule per stage, and each new consumer subscribes to the topic with its own filter instead of asking for another rule.
- **The queue answers "when?"** It holds work while a consumer is slow or down and parks repeated failures in the dead-letter queue. Keep this buffer when workers must catch up after an outage.

A Classic rule can target a standard, fair or FIFO queue directly. For FIFO, it can set the message group from the event:

```json
{
  "Arn": "arn:aws:sqs:eu-west-2:111122223333:invoice-posting.fifo",
  "SqsParameters": { "MessageGroupId": "$.detail.invoiceId" }
}
```

Several consumers, with new ones arriving from other teams: on a classic bus, keep the topic, because it lets them join without touching your rules. The newer Custom event bus offers another option: share the bus through AWS RAM so each team can attach and manage its own subscriber with the right permissions.

## What the extra hop costs

At US East (N. Virginia) list prices checked 21 November 2026, 86 million events a day for 30 days is 2.58 billion events. At $1 per million, Classic bus ingress costs $2,580. One standard SNS publish per event at $0.50 per million adds $1,290. This assumes one billing unit per event and same-account delivery. It excludes free tiers, storage, retries and SQS charges. Price FIFO topics separately because they also bill by volume.

On the newer Custom event bus, 1 KB of billable data per event and one delivery per event would mean 2,580 GB in and the same out. At $0.18 per GB in and $0.05 out, that is about $595 before storage or retries.

## FIFO behind a bus is not end-to-end order

A classic bus makes no ordering promise. A FIFO queue behind it keeps events in the order they reached the queue, which is not the order in which they happened. FIFO preserves queue order within the invoice group and deduplicates sends with the same deduplication ID for five minutes. The Custom Event Bus goes further: publish with an event group per invoice, give the stage a FIFO subscriber, and map that group to the FIFO queue’s message group. Events for the invoice reach the queue in publish order within that publisher account. The price is that one failed delivery holds up every group behind that subscriber until its retries run out. AWS's queue documentation adds a warning: a dead-letter queue on a FIFO queue breaks strict order, because the failed message leaves and the next one in its group goes ahead.

If order matters, put it in the data. Carry a version or stage number on each event and have the consumer refuse a status older than the one it has stored. Use a conditional write to reject stale status updates and an operation key when the consumer triggers a side effect. [idempotent consumers on SQS and Lambda](/docs/idempotent-consumers-sqs-lambda) shows the pattern.

## On Google Cloud and Azure

The topic-plus-queue pair is one product elsewhere. A Pub/Sub subscription on Google Cloud keeps its own copy of each message and can filter on attributes, though not on the body. A Service Bus topic subscription on Azure behaves like a queue of its own, with rule filters and a dead-letter queue. For a separate router, Eventarc Advanced filters on CloudEvents attributes and Event Grid can filter fields in the event body. [The three-cloud comparison](/docs/event-driven-messaging-aws-google-cloud-azure) sets them side by side, and [the patterns article](/docs/event-driven-architecture-on-aws) covers when a bus is the wrong tool altogether.

## The diagram

archhy's drawing of the pipeline: producers, the API, the bus with its archive, and one lane per stage with its topic, FIFO queue, dead-letter queue and function. [Open the source diagram in archhy](https://archhy.com/blog/aws-event-driven-architecture-diagram?utm_source=alpacamango#diagram) and use its editor link to remove the layers you do not need.

Reference documentation: [EventBridge pricing](https://aws.amazon.com/eventbridge/pricing/), [SNS pricing](https://aws.amazon.com/sns/pricing/), [Custom event bus ordering](https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-custom-bus-ordering.html), [SQS FIFO deduplication](https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/FIFO-queues-exactly-once-processing.html), [Eventarc Advanced filtering](https://docs.cloud.google.com/eventarc/advanced/docs/receive-events/use-cel), [Event Grid filtering](https://learn.microsoft.com/en-us/azure/event-grid/event-filtering).

## Go deeper

archhy's [full article](https://archhy.com/blog/aws-event-driven-architecture-diagram?utm_source=alpacamango) covers every layer, the dashboards and security included. The [original AWS post](https://aws.amazon.com/blogs/architecture/implement-event-driven-invoice-processing-for-resilient-financial-monitoring-at-scale/) lists the service quotas the design runs into.
