Examples / AWS

How do you diagram SNS fan-out to Lambda and SQS?

Updated

Braces. SNS -> {Lambda Emailer, Lambda Analytics, SQS Archive} puts the three consumers in the column after SNS, one per row, and the animation sends three copies of the event out of the topic in the same instant. SNS delivers to every subscription, so three copies leaving together is the accurate picture; a choice with bars would send one copy per pass instead.
Pub/Sub Fan-Out Diagram: SNS to Lambda and SQS. SNS hands the same event to two Lambdas and a queue at the same time. Services drawn: SNS, Lambda Emailer, Lambda Analytics, SQS Archive.
A still of the animation above. Every export embeds the diagram source.

THE TEXT THAT DRAWS IT

SNS -> {Lambda Emailer, Lambda Analytics, SQS Archive}

Edit it in the box above and the diagram redraws as you type. Export it as an animated GIF, WebM, WebP or MP4 video, or a still PNG or PDF, every format free. WebM and PNG export here; the rest are in the app after a free sign-up. Every format embeds this text, so the file can be read back into the editor.

WHAT IT SHOWS

Fan-out is how a producer stops knowing about its consumers. Something writes to an SNS topic and is done. Three subscribers each get their own copy of the message, a Lambda that sends email, a second Lambda that records analytics, and an SQS queue that holds the raw event for replay.

{ } is what turns the line into a fan-out. Every name inside the braces lands in the same column, one row each in the order written, and every one of them receives the same message. This matches what SNS does. A topic does not round-robin; every subscription gets a delivery.

Animation is worth having on this particular pattern. Three copies leave the topic in the same instant. Drawn as a still, the same three arrows look exactly like a decision tree where only one path is ever taken, and you would need a legend to tell the two apart.

Adding a fourth consumer is adding a fourth name inside the braces. Nothing to the left of the braces changes, and neither does the producer.

QUESTIONS

What is the difference between {A, B} and |A, B| in the DSL?
{A, B} sends the message to A and to B in the same pass. |A, B| sends it to A on one pass and to B on the next, cycling through the list in the order written. SNS delivers to every subscription, so this page uses the braces.
Why mix Lambda and SQS subscribers on one SNS topic?
Because they do different jobs with the same event. A Lambda subscriber runs as soon as the message arrives, which suits email. An SQS subscriber holds the message until something reads it, which suits an archive or a batch job that runs later. SNS delivers to both and neither one knows the other exists.

MORE AWS PATTERNS

Also on this site: RAG pipeline diagram, Multi-agent router diagram, ReAct tool-calling diagram, Human-in-the-loop diagram, MCP architecture diagram and Cloudflare Workers diagram. See all 10 patterns.

Chartado is a text-to-diagram tool: you type lines like A -> B, it draws the architecture and animates the flow.