Living Systems Handbook microservices as humans Bipin Singh
The ecosystem

The town square — EventBridge

2 min readChapter 18 of 34By Bipin Singh

In a town square, people pin announcements on a notice board. Anyone interested reads them and acts — the person who posted doesn't need to know who's reading. Amazon EventBridge is that notice board for microservices.

How the notice board works

  1. A human announces an event to an event bus (OrderPlaced from cafe.waiter).
  2. Rules on the bus match events by their content.
  3. Each rule delivers matching events to targets — another human's queue, a Lambda function, a Step Functions workflow, an API destination and more.
Waiter ──OrderPlaced──►  [ TOWN SQUARE bus ]
                            ├─ rule "chef hears new orders"      → SQS chef-inbox → Chef
                            ├─ rule "cashier hears new orders"   → SQS cashier-inbox → Cashier
                            └─ rule "archive everything"         → Firehose → S3 (history)

Writing rules in CDK

import * as events from "aws-cdk-lib/aws-events";
import * as targets from "aws-cdk-lib/aws-events-targets";
import * as sqs from "aws-cdk-lib/aws-sqs";

// The Chef's inbox, with a place for letters it can't handle
const chefDeadLetters = new sqs.Queue(this, "ChefDeadLetters", { retentionPeriod: Duration.days(14) });
const chefInbox = new sqs.Queue(this, "ChefInbox", {
  visibilityTimeout: Duration.seconds(60),
  deadLetterQueue: { queue: chefDeadLetters, maxReceiveCount: 3 },
});

// The Chef listens for new orders on the town square
new events.Rule(this, "ChefHearsNewOrders", {
  eventBus: townSquare,
  eventPattern: { source: ["cafe.waiter"], detailType: ["OrderPlaced"] },
  targets: [new targets.SqsQueue(chefInbox)],
});

Rules can also match on the event's content — e.g. only orders above a certain total, or only takeaway orders:

eventPattern: {
  source: ["cafe.waiter"],
  detailType: ["OrderPlaced"],
  detail: { total: [{ numeric: [">=", 1000] }] },   // big orders only
},

Why deliver to a queue instead of straight to a function?

A queue is a personal inbox. It:

The beauty of choreography

Tomorrow the café adds a Loyalty human that gives points for every order. You add one rule and one new human. The Waiter doesn't change at all. That's loose coupling: the society grows without surgery on existing humans.

The risks of choreography

Risk Mitigation
Nobody can see the whole story Correlation IDs in every event; tracing; an event archive; documented flows
Event schemas drift Schema registry; versioned, backward-compatible events
Loops (A reacts to B reacts to A…) Clear ownership of events; review new rules
Lost events Queues with DLQs; EventBridge archive and replay

Useful notice-board features

Key idea

The town square lets humans cooperate without knowing each other. Announce facts, route them with rules, deliver into inboxes — and new humans can join without anyone else changing.

Bipin Singh
Written by Bipin Singh

Senior Full-Stack Engineer · AI & AWS. I design and build serverless systems on AWS — and love explaining them simply.

Work with me