When we moved our order processing platform from a monolith that relied on direct HTTP calls to an event-driven model, the first version used a central SQS queue with Lambda fan-out logic we wrote ourselves. It worked until it didn't — a single malformed message from the inventory service poisoned the queue, retry storms took down our checkout API, and adding a new consumer meant redeploying the router. Replacing that router with AWS EventBridge didn't just remove code; it forced us to rethink how services communicate, how failures propagate, and how you evolve contracts without coordinated deploys. In my experience, EventBridge is deceptively simple to get started with and surprisingly easy to misuse at scale. This article covers the patterns that have held up in production for 15M+ events per day and the anti-patterns that caused pages at 2 AM.
Why EventBridge Replaced Our Central SQS Fan-Out: Decoupling at Scale
Before EventBridge, most teams build what I call the "smart router" anti-pattern: a Lambda or ECS service that polls a queue, inspects a payload, and forwards to the right downstream system. It seems flexible until you realize you've recreated a message broker with worse observability, no schema enforcement, and your own retry logic to maintain.
EventBridge inverts that responsibility. Producers put events onto a bus without knowledge of consumers. Consumers define rules that filter on event structure. The bus itself handles routing, retries, archiving, and cross-account delivery. That decoupling is organizational as much as technical — the team that owns payments can emit a PaymentAuthorized event without opening a ticket for the team that owns loyalty points to consume it.
I've found that the most durable architecture uses a central event bus per environment plus dedicated custom buses for bounded contexts that have stricter compliance needs. For example, we keep PCI-scoped payment events on a payments-bus with tighter resource policies and KMS encryption, while most domain events flow through the default bus. This maps cleanly to a Multi-Account AWS Strategy: Landing Zones, Control Tower and Organization Units where workload accounts forward selected events to a central observability or audit bus in the management account via resource policies, rather than allowing every account to subscribe to everything.
The Producer Contract Matters More Than the Bus
A bus is only as reliable as the events you put on it. We enforce three non-negotiables for every producer: a namespaced source (e.g., com.retail.orders), a versioned detail-type (e.g., OrderCreated.v1), and a detail payload that validates against a published JSON Schema in the EventBridge Schema Registry. Without that, filtering becomes string matching on hopes and prayers.
// Producer: PutEvents with structured detail-type and idempotency key
import { EventBridgeClient, PutEventsCommand } from "@aws-sdk/client-eventbridge";
const eb = new EventBridgeClient({ region: "us-east-1" });
await eb.send(new PutEventsCommand({
Entries: [{
EventBusName: "main-bus",
Source: "com.retail.orders",
DetailType: "OrderCreated.v1",
Detail: JSON.stringify({
eventId: "ord_01HKG2..._v1", // ULID for deduplication
orderId: "ord_12345",
customerId: "cust_987",
totalAmount: 149.98,
currency: "USD",
createdAt: new Date().toISOString()
}),
Time: new Date()
}]
}));
If you skip the registry and treat EventBridge as a schemaless pipe, you will pay for it six months later when a producer renames customerId to customer_id and three downstream consumers silently stop matching. Register the schema, enable discoverability, and break builds when producers emit non-conforming events.
Designing Event Schemas That Survive Team Boundaries and Time
Schema design is where most event-driven projects lose maintainability. In my experience, teams obsess over transport and forget that the hard part is agreeing on what an event means.
We follow a few rules that have reduced breaking changes dramatically. First, events are facts, not commands. Emit OrderCancelled.v1, not CancelOrder. Commands imply a receiver and create coupling. Facts describe something that already happened and can be consumed by zero to N subscribers without coordination. Second, every event includes a canonical envelope: eventId, eventTime, producer, schemaVersion, correlationId, and detail. Third, never reuse a detail-type for a breaking change — create OrderCreated.v2 and support both for a deprecation window.
For payload structure, prefer flat detail objects with explicit optionals over deeply nested graphs. A downstream rule can filter on $.detail.currency and $.detail.totalAmount efficiently, but it cannot efficiently filter on arrays of nested line items without resorting to prefix or anything-but filters that get brittle. If you need line items, include a summary for routing (e.g., itemCount, hasRestrictedItem) and let consumers fetch the full order from the source of truth if needed.
Schema Registry and Code Bindings in Practice
We store schemas in the EventBridge Schema Registry and generate bindings for TypeScript and Python producers during CI. The registry isn't just documentation; it integrates with EventBridge to validate events when you enable schema discovery on a bus. One anti-pattern I see constantly is hand-writing event interfaces in each service. Instead, generate them and fail the pipeline if code drifts from the registered schema.
The other anti-pattern is stuffing everything into detail as a stringified blob without typing. If you use Terraform to manage EventBridge resources, the Terraform Documentation shows how to manage schemas with aws_schemas_schema and aws_schemas_registry so schema creation is versioned alongside infrastructure. That gives you a Git history of schema evolution and allows policy checks (e.g., OPA/Conftest) to block removal of required fields.
Routing Realities: Content-Based Filtering, Archive/Replay and Cross-Account Event Buses
EventBridge rules look simple until you need to route on real business logic. Content-based filtering supports prefix, suffix, anything-but, numeric ranges, and exists checks, but it does not support regex or JSONPath beyond the detail object. That constraint is actually useful — it pushes you to emit routable attributes at the top level of detail instead of burying logic in payloads.
# Terraform: Rule with content-based filtering and input transformer
resource "aws_cloudwatch_event_rule" "high_value_orders" {
name = "route-high-value-usd-orders"
event_bus_name = aws_cloudwatch_event_bus.main_bus.name
event_pattern = jsonencode({
source = ["com.retail.orders"]
detail-type = ["OrderCreated.v1"]
detail = {
currency = ["USD"]
totalAmount = [{ numeric = [">=", 1000] }]
}
})
}
resource "aws_cloudwatch_event_target" "to_fraud_check" {
rule = aws_cloudwatch_event_rule.high_value_orders.name
event_bus_name = aws_cloudwatch_event_bus.main_bus.name
arn = aws_sqs_queue.fraud_review.arn
input_transformer {
input_paths = {
orderId = "$.detail.orderId"
amount = "$.detail.totalAmount"
}
input_template = "{\"orderId\": , \"amount\": , \"source\": \"eventbridge\"}"
}
dead_letter_config {
arn = aws_sqs_queue.event_dlq.arn
}
retry_policy {
maximum_event_age_in_seconds = 3600
maximum_retry_attempts = 3
}
}
Two features separate EventBridge from basic pub/sub: archives and replay. Every production bus we run has an archive enabled with a 7-30 day retention. When a consumer had a bug and dropped events for four hours last quarter, we didn't ask producers to resend — we replayed the archive to a new rule targeting the fixed consumer. Without archives, you're forced to build a custom outbox replay mechanism in every service.
Cross-Account and Cross-Region Done Safely
For cross-account fan-out, don't give every workload account PutEvents access to every bus. Use resource-based policies that allow only specific source values, and forward via explicit rules. For example, the orders account has a rule that forwards com.retail.orders.* to the central audit bus in the observability account. Enable encryption with a Customer Managed KMS key and enforce aws:SourceAccount conditions. I've found that global endpoints are useful for cross-region ingestion with automatic failover, but they add latency and cost — only use them if you genuinely need multi-region event ingestion. Otherwise, keep buses regional and replicate via explicit forwarding rules so you maintain visibility into replication lag.
Coupling EventBridge with Lambda, Step Functions and SQS: Choosing the Right Target
Not every EventBridge target behaves the same, and picking the wrong one creates either throttling or invisible failures. This is where understanding the underlying service quotas matters as much as the architecture diagram.
Lambda as a direct target is tempting but dangerous at scale. EventBridge will invoke Lambda synchronously and retry with backoff for up to 24 hours by default. If your Lambda throttles due to reserved concurrency, EventBridge retries amplify the load. I have moved almost all Lambda consumers behind SQS. EventBridge -> SQS -> Lambda gives you a buffer, batching, and a clear dead-letter queue for poison messages. Reserve Lambda concurrency per consumer so a flood of low-priority events doesn't starve critical handlers.
Step Functions works well when an event starts a workflow that requires state (e.g., order orchestration with compensation). Use EventBridge to trigger the state machine, not to choreograph each step. Over-choreographing with events — where each Step Functions state emits another event to trigger the next service — creates distributed tracing nightmares. For patterns like this, the guidance in Serverless Architecture Patterns: API Gateway, Lambda and Step Functions aligns with what we've seen: orchestrate where you need visibility, choreograph where you need decoupling.
| Target Pattern | Best For | Failure Handling | Scaling Consideration |
|---|---|---|---|
| EventBridge → SQS → Lambda | High-volume, bursty consumers needing buffering | SQS DLQ after max receives; visibility timeout controls retries | Batch size and concurrency control via SQS; isolates producer from consumer throttling |
| EventBridge → Lambda (direct) | Low-volume, low-latency handlers (<100 TPS) | EventBridge retry policy + DLQ on target; limited visibility | Limited by Lambda concurrency; retry storms can amplify |
| EventBridge → Step Functions | Multi-step workflows with compensation/sagas | State machine retry/catch; execution history | Express vs Standard choice affects cost and history retention |
| EventBridge → Kinesis / Firehose | Analytics, lake ingestion, streaming ETL | Stream retention and DLQ for failed transforms | Shard provisioning for Kinesis; Firehose auto-scales but has buffer delays |
| EventBridge → API Destination | Webhook delivery to SaaS / external HTTPS | Connection retry with rate limiting; invocation DLQ | Connection concurrency and external rate limits govern throughput |
API Destinations deserve special mention. We use them to deliver events to third-party fraud and shipping APIs without running a forwarder Lambda. Set the connection to use OAuth or API keys stored in Secrets Manager, configure the invocation rate limit to match the vendor's documented limits, and always attach a DLQ. Without rate limiting, a burst of events will get you blocked by the vendor.
The Failure Modes Nobody Warns You About: DLQs, Throttling and Idempotency Gaps
EventBridge guarantees at-least-once delivery to targets, not exactly-once. That one sentence explains half the production incidents I've debugged. Every consumer must be idempotent.
The simplest idempotency pattern we use is a DynamoDB table keyed by eventId with a conditional write and TTL. If the conditional write fails, the event is a duplicate and we return success without reprocessing. Without this, replaying an archive or retrying after a timeout results in double charges, duplicate emails, or inventory decrements applied twice.
// Node.js Lambda consumer with DynamoDB idempotency
import { DynamoDBClient, PutItemCommand } from "@aws-sdk/client-dynamodb";
const ddb = new DynamoDBClient({});
const TABLE = process.env.IDEMPOTENCY_TABLE;
export const handler = async (event) => {
const eventId = event.detail.eventId;
const ttl = Math.floor(Date.now() / 1000) + 86400; // 24h window
try {
await ddb.send(new PutItemCommand({
TableName: TABLE,
Item: {
pk: { S: eventId },
ttl: { N: ttl.toString() }
},
ConditionExpression: "attribute_not_exists(pk)"
}));
} catch (e) {
if (e.name === "ConditionalCheckFailedException") {
console.log(`Duplicate event ${eventId} skipped`);
return { status: "duplicate" };
}
throw e;
}
// ... business logic: update order, emit next event
};
Other failure modes are subtler. EventBridge has a soft limit of 300 rules per bus and a hard PutEvents limit of 10 entries per call and 256KB per entry. Batch your PutEvents calls and handle FailedEntryCount — partial failures are common when one entry exceeds size. Also, SQS targets have a 256KB message limit; if your detail payload is large, store the full payload in S3 and send a reference, or compress and use an input transformer to trim fields.
Dead-Letter Queues Are Not Optional
Every rule target should have a DLQ and a retry policy tuned to the consumer. The default of 185 retries over 24 hours is rarely what you want for a synchronous order flow. For critical paths, we set maximum_retry_attempts to 2 and maximum_event_age_in_seconds to 300, so failures surface to the DLQ quickly and trigger an alarm. Monitor FailedInvocations and DeadLetterInvocations metrics, and treat DLQ depth as a high-severity alert. One anti-pattern is using the same DLQ for every rule — you lose the ability to prioritize and route failures to the owning team.
Observability and Cost Control When Your Bus Handles Millions of Events
Once a bus exceeds a few million events per day, debugging without observability is impossible. We inject correlationId and traceId at the edge (API Gateway) and propagate them through every event. EventBridge doesn't automatically propagate X-Ray trace headers to targets like SQS or Lambda, so you must include the trace context in the event detail and restore it in the consumer. Enable CloudWatch metrics for each rule — MatchedEvents, TriggeredRules, and Invocations — and create a dashboard that shows event volume by detail-type derived from logs, not just bus totals.
For logging, don't log the entire event payload at INFO in every consumer; sample. Instead, log a structured JSON line with eventId, detail-type, source, and correlationId on entry and exit, and log full payloads only on error or when sampled at 1%. This keeps ingestion costs manageable in CloudWatch or your SIEM.
Cost is another blind spot. EventBridge charges per event published plus per-Invocation for cross-account and API Destinations, but the bigger cost driver is downstream invocations. A fan-out where one OrderCreated triggers 12 consumers will multiply Lambda and SQS costs quickly. Archive retention also accumulates — a bus archiving 20M events/day at ~2KB each retained for 30 days stores over 1TB of compressed events. Set retention based on your actual replay need (7 days is enough for most transactional systems) and expire old archives. In the context of the AWS Well-Architected Framework: Applying the Five Pillars in Practice, this is a clear trade-off across cost optimization and reliability — archives improve recovery but must be sized and expired intentionally.
Finally, enforce guardrails with service control policies. Block events:PutEvents without detail-type or with overly broad sources, and require bus encryption via SCPs. We lint Terraform for EventBridge resources in CI using checks from the Terraform Documentation registry provider — ensuring event_pattern is valid JSON, DLQs are attached, and archives are enabled on production buses. Without those guardrails, ad-hoc rules proliferate and you end up with a bus nobody understands or trusts.
Frequently Asked Questions
Should I use one central event bus or multiple custom buses?
Start with one central bus per environment and add custom buses only for clear isolation needs — PCI, PII, or distinct blast radius requirements. Multiple buses add operational overhead (policies, archives, monitoring per bus) and make cross-bus discovery harder. I've found that one or two well-governed buses serve 90% of use cases until you exceed organizational boundaries, at which point a hub-and-spoke forwarding model per account works better than a bus-per-service sprawl.
How do I prevent duplicate processing when EventBridge retries or replays?
Make every consumer idempotent using an external idempotency key. Use the producer-generated eventId (a ULID/UUID v4) as the key and store it in DynamoDB with a conditional write and TTL covering your retry window (24-72 hours). Do not rely on EventBridge deduplication — it guarantees at-least-once delivery. Replays and retries will redeliver events, so the consumer must detect duplicates and return success without side effects.
When should I choose EventBridge Pipes instead of an EventBridge rule?
Rules are for routing and filtering with enrichment via input transformers; Pipes are for point-to-point integration with filtering, enrichment, and transformation that includes stateful features like batching, ordering from SQS/Kinesis/DynamoDB Streams, and advanced filtering. Use Pipes when you need to poll a source (SQS, Kinesis, MSK) and map it to a target with transformations without writing a Lambda. Use rules when your sources are event producers calling PutEvents and you need fan-out to many targets.
How do I handle events larger than 256 KB?
Store the payload in S3 and put a reference pointer in the event detail (the claim-check pattern). Emit { "s3Bucket": "events-payloads", "s3Key": "orders/123/detail.json", "payloadHash": "sha256:..." } and have consumers fetch the object. Alternatively, compress or trim via input transformer, but the S3 approach is more robust for analytics and replay. Ensure the S3 object lifecycle and KMS permissions align with your event archive retention.