EventBridge Integration Patterns — Building Event-Driven Systems at Scale
The event bus that connects everything#
AWS EventBridge is a serverless event bus that routes events between AWS services, SaaS applications, and your own microservices. It decouples producers from consumers at scale — without managing infrastructure.
This is article #314 in the Codelit engineering series.
Core concepts#
Event bus#
An event bus receives events and routes them to targets based on rules. EventBridge provides three types:
- Default event bus — receives events from AWS services automatically
- Custom event buses — you create these for your application events
- Partner event buses — receive events from SaaS partners like Shopify, Datadog, or Auth0
Event structure#
Every EventBridge event follows a standard envelope:
{
"source": "com.myapp.orders",
"detail-type": "OrderPlaced",
"detail": {
"orderId": "ord-12345",
"customerId": "cust-789",
"total": 149.99,
"currency": "USD"
},
"time": "2026-03-29T10:30:00Z",
"resources": []
}
The source and detail-type fields are your primary routing keys. The detail object carries your business payload.
Event bus patterns#
Single bus, multiple rules#
The simplest pattern. One custom event bus with rules that route events to different targets:
- Order events route to the fulfillment Lambda
- Payment events route to the billing SQS queue
- User events route to the analytics Kinesis stream
This works for small to medium systems with fewer than 50 event types.
Multi-bus domain separation#
For larger systems, create one event bus per domain:
- orders-bus — handles order lifecycle events
- payments-bus — handles payment and refund events
- inventory-bus — handles stock level changes
- notifications-bus — handles alert and messaging events
Cross-domain communication uses EventBridge rules that forward events between buses.
Fan-out pattern#
A single event triggers multiple independent consumers:
- OrderPlaced event goes to the fulfillment service, analytics pipeline, notification service, and fraud detection simultaneously
- Each consumer processes independently — failure in one does not affect others
- Dead letter queues catch failures per consumer
Event enrichment pattern#
Events pass through a Lambda that adds context before reaching the final target:
- Raw event arrives on the bus
- Rule routes to an enrichment Lambda
- Lambda queries a database for additional context
- Enriched event is published back to the bus (or sent directly to the target)
Schema discovery#
EventBridge Schema Registry automatically discovers and stores event schemas:
Automatic discovery#
Enable schema discovery on any event bus. EventBridge analyzes incoming events and generates OpenAPI 3.0 schemas automatically.
Benefits of schema registry#
- Code generation — download type-safe bindings for Java, Python, or TypeScript
- Schema versioning — track how event shapes evolve over time
- Documentation — auto-generated docs for every event type in your system
- Validation — consumers know exactly what fields to expect
Custom schemas#
Upload schemas manually for events that have not been published yet. This supports design-first event modeling where you define the contract before writing producers.
Content-based filtering#
EventBridge rules support sophisticated filtering without writing code:
Pattern matching#
{
"source": ["com.myapp.orders"],
"detail-type": ["OrderPlaced"],
"detail": {
"total": [{ "numeric": [">=", 100] }],
"currency": ["USD", "EUR"],
"customerId": [{ "prefix": "vip-" }]
}
}
Supported filter types#
- Exact match —
["value1", "value2"] - Prefix match —
[{"prefix": "prod-"}] - Suffix match —
[{"suffix": ".com"}] - Numeric range —
[{"numeric": [">=", 10, "<=", 100]}] - IP address match —
[{"cidr": "10.0.0.0/8"}] - Exists / does not exist —
[{"exists": true}]or[{"exists": false}] - Anything-but —
[{"anything-but": ["test", "staging"]}]
Nested filtering#
Filters work on deeply nested fields. Combine multiple conditions — all must match (AND logic). Use separate rules for OR logic across different field combinations.
Archive and replay#
EventBridge can archive every event and replay them later:
Use cases for archive and replay#
- Disaster recovery — replay events after a consumer failure
- New consumer bootstrap — replay historical events to populate a new service
- Testing — replay production events in a staging environment
- Debugging — investigate issues by replaying the exact event sequence
- Compliance — retain events for audit trails
Archive configuration#
- Retention — set retention from 1 day to indefinite
- Filtering — archive only events matching specific patterns
- Storage — archives are compressed and stored cost-effectively
Replay mechanics#
Start a replay by specifying a time window. Events replay to the same bus with original timestamps. Rate-limit replays to avoid overwhelming consumers.
Cross-account event patterns#
EventBridge supports routing events between AWS accounts:
Hub-and-spoke#
A central event bus in a shared-services account receives events from all application accounts:
- Application accounts grant
events:PutEventspermission to the central bus - Central bus routes events to the appropriate consumer accounts
- Simplifies governance and monitoring
Direct cross-account#
Account A sends events directly to Account B event bus:
- Account B creates a resource-based policy allowing Account A
- Account A creates a rule targeting Account B bus
- Lower latency than hub-and-spoke but harder to govern at scale
Organization-wide events#
Use AWS Organizations to share event buses across all accounts in an organization. Combined with Service Control Policies for access control.
SaaS integrations#
EventBridge partner integrations connect external services directly:
Available partners#
- Shopify — order, product, and customer events
- Auth0 — authentication and authorization events
- Datadog — alert and incident events
- Zendesk — ticket and customer support events
- Stripe — payment and subscription events (via custom integration)
Integration pattern#
- Create a partner event source in the SaaS provider dashboard
- Associate the partner event source with an event bus in your account
- Create rules to route partner events to your targets
- No polling, no webhooks infrastructure, no middleware
Custom SaaS integration#
For SaaS providers without native EventBridge support, use API Gateway as a webhook receiver that publishes to EventBridge:
- API Gateway receives the webhook POST
- Lambda validates the payload and signature
- Lambda publishes a normalized event to your custom bus
Performance and limits#
Key numbers to design around:
- Throughput — soft limit of 10,000 PutEvents requests per second per account per region
- Event size — maximum 256 KB per event
- Rules per bus — 300 rules (soft limit, can be raised)
- Targets per rule — up to 5 targets
- Latency — typically under 500ms from publish to target invocation
- Retry policy — up to 185 retries over 24 hours with exponential backoff
When NOT to use EventBridge#
EventBridge is not the right choice for every scenario:
- High-throughput streaming — Kinesis or Kafka handle millions of events per second
- Sub-millisecond latency — direct service-to-service calls are faster
- Large payloads — the 256 KB limit means large data must use claim-check pattern
- Complex event processing — Flink or Spark Streaming for windowed aggregations
- Non-AWS environments — EventBridge is AWS-only; use Kafka for multi-cloud
Visualize your event architecture#
Map your event flows — try Codelit to generate an interactive diagram showing how EventBridge connects your producers, consumers, and SaaS integrations.
Key takeaways#
- Event buses decouple everything — producers never know about consumers
- Content-based filtering is powerful — route events without writing code
- Schema registry prevents contract drift — auto-discover and version your event shapes
- Archive and replay is a superpower — bootstrap new consumers, debug issues, recover from failures
- Cross-account patterns scale governance — hub-and-spoke for large organizations
- Know the limits — 256 KB events, 10K TPS soft limit, 500ms typical latency
This is article #314 in the Codelit engineering series. Explore all 314 articles at codelit.io/blog.
Try it on Codelit
Chaos Mode
Simulate node failures and watch cascading impact across your architecture
Cost Estimator
See estimated AWS monthly costs for every component in your architecture
Related articles
Try these templates
WhatsApp-Scale Messaging System
End-to-end encrypted messaging with offline delivery, group chats, and media sharing at billions-of-messages scale.
9 componentsGmail-Scale Email Service
Email platform handling billions of messages with spam filtering, search indexing, attachment storage, and push notifications.
10 componentsAWS Lambda Serverless Architecture
Event-driven serverless computing with API Gateway, Lambda functions, DynamoDB, S3, and SQS.
10 componentsBuild this architecture
Generate an interactive architecture for EventBridge Integration Patterns in seconds.
Try it in Codelit →
Comments