An event-driven pipeline on AWS

How API Gateway, EventBridge, SNS, SQS and Lambda let each stage of an invoice pipeline run, fail and scale on its own while you can still see what is stuck.

GazeekARCHITECTURE IDEAS·EPISODE 2
EPISODE 2

An event-driven pipeline on AWS

How API Gateway, EventBridge, SNS, SQS and Lambda let each stage of an invoice pipeline run, fail and scale on its own while you can still see what is stuck.

0:00 / 3:49

Diagrams in this video · 1Free in archhy

Copy and edit in archhy: An event-driven invoice pipeline (new tab)

The diagrams, full size

Copy any of them into archhy, free, and change it for your own system.

After this lesson you can

  • Trace an event from a producer through API Gateway, EventBridge, SNS, SQS and Lambda
  • Explain why the design uses both EventBridge and SNS
  • Describe what dead-letter queues and idempotent consumers protect against
  • Open the diagram in archhy and adapt it to your own pipeline
Transcript

An event-driven pipeline on AWS

Space Llama here, with Architecture Ideas. One diagram, one idea. Today, an event-driven pipeline on AWS, where each step runs, fails and scales on its own.

A process nobody can see

The example is invoices, passing through ingestion, reconciliation, authorization and posting. The stages live in different systems. When one stalls, finance finds out late. The AWS example handles over 86 million events a day. Yours may be smaller, but the shape is the same.

An event-driven invoice pipeline

It all sits in a Regional cell, a self-contained copy you can repeat by Region or account. Finance systems post events to Amazon API Gateway, the managed API front door, with one path per stage. AWS WAF, the web application firewall, filters requests. The API checks each event's schema and throttles noisy callers. Events go to one custom Amazon EventBridge bus, the event router. Rules on content pick each event's stage. Each stage is a lane. An Amazon SNS topic, the publish and subscribe service, feeds an Amazon SQS FIFO queue. The queue absorbs bursts. AWS Lambda functions, code without servers to manage, poll it in batches. A message that keeps failing moves to a dead-letter queue, where an Amazon CloudWatch alarm flags it. Long jobs go to AWS Fargate, containers without servers to manage. Status goes to Amazon Timestream, and Amazon QuickSight dashboards show where every invoice is. Reconciliation and authorization repeat the same lane.

EventBridge and SNS

Why both EventBridge and SNS? EventBridge routes centrally on event content, and its archive lets you replay after a bad deployment. SNS fans one topic out to many filtered subscribers, and retries failed deliveries. One consumer per stage? EventBridge can target the queue directly, saving a hop and a cost.

Things to watch

Retries happen in several layers, so a message can arrive twice. Make each consumer safe to run again. Check service quotas before the first month end. Month end waits for no llama. Timestream for LiveAnalytics is closed to new customers. AWS suggests Timestream for InfluxDB. And a short, strictly ordered workflow may suit an orchestrator, such as AWS Step Functions.

Draw it in archhy

Your turn. The link in the description opens this exact diagram in archhy. It's free, in your browser. Rename the stages for your process, or duplicate a lane for each one. Then export a PNG, or share a link. The full write-up, with costs and when not to use this, is on archhy's blog.

Recap

Recap. Give each stage its own lane: topic, queue, dead-letter queue and function. Route centrally on one EventBridge bus, with an archive to replay. SNS fans out, and SQS absorbs bursts. Alarm every dead-letter queue, and make consumers safe to run twice.

Practice and what's next

Open this diagram in archhy from the link in the description, and make it yours. Read the full article on archhy's blog. Next episode, retrieval-augmented generation with Amazon Bedrock. See you there.

Draw it in archhy

Open this episode's diagram in archhy, ready to change for your own system. Free, in the browser.