Event Buses & Rules
Build custom event buses, write content-based rules, and route events to Lambda, SQS, and CloudWatch Logs.
Mental model
EventBridge is a serverless event router. Events flow in, rules match them, targets receive them. Think of it as a post office, events are letters, rules are sorting criteria, targets are mailboxes. The post office never stores the letter, it routes it and moves on.
Prerequisites
What is EventBridge?
The core idea
EventBridge is AWS's serverless event bus. It receives events from three sources:
- AWS services: EC2 state changes, S3 object uploads, ECS task state changes, CodePipeline stage transitions, 100+ others. All emitted automatically.
- Your application: custom events you
PutEventsonto a custom bus. Your order placed, your user signed up, your payment processed. - SaaS partners: Datadog, Zendesk, Stripe, etc. can send events directly into your EventBridge bus.
You write rules that pattern-match incoming events. Matching events are routed to one or more targets: Lambda, SQS, SNS, ECS, Step Functions, another event bus, an HTTP endpoint, and more. What EventBridge is NOT:
- Not a queue (no retention, no polling, no consumer groups)
- Not a stream (no replay from offset, no ordering guarantee)
- Not a pub/sub topic (no fan-out to subscribers, that's SNS)
It is purely a router. Events in, matched events out to targets.
Event sources EventBridge Targets
┌──────────────┐ ┌────────────┐
│ AWS Services │ ─events─▶ │ Event Bus │ ─match─▶ Lambda
└──────────────┘ │ │ ─match─▶ SQS
┌──────────────┐ │ Rules │ ─match─▶ SNS
│ Your App │ ─events─▶ │ filter & │ ─match─▶ ECS
└──────────────┘ │ route │ ─match─▶ HTTP
┌──────────────┐ └────────────┘
│ SaaS (Stripe │ ─events─▶
│ Datadog...) │
└──────────────┘Default Event Bus + AWS Service Events
Goal
Observe real AWS-generated events flowing through the default event bus. Write your first rule. Capture matching events in CloudWatch Logs. Trigger events by performing real AWS actions.