Amazon EventBridge
Serverless event bus for connecting applications with real-time data
Think of EventBridge like a super-smart post office that doesn't just deliver mail; it reads the envelopes, sorts them by topic, and sends them to anyone who's subscribed to that kind of news. Instead of your application asking 'Did anything happen yet?' a million times (like a kid on a road trip asking 'Are we there yet?'), EventBridge tells your application the moment something interesting happens. It's pub-sub messaging, but with built-in pattern matching and routing to dozens of AWS services.
EventBridge has two bus designs: the Custom Event Bus (AWS's recommendation for new applications) and Custom Event Bus Classic. The Custom Event Bus retains events for 1 to 365 days and delivers them to subscribers you create; each subscriber filters, optionally transforms with JSONata, and delivers to one target, and retention lets a subscriber replay or resume in order. Classic routes JSON events with rules and targets: 'if an EC2 instance is terminated AND has tag Environment=Production, invoke Lambda X and notify SNS'; filtering happens server-side, so you don't pay for unneeded invocations. Pipes link one source to one target; Scheduler runs cron and one-time tasks.
Key Capabilities
- Routes JSON events from AWS services, custom applications, and SaaS partners (Salesforce, Zendesk, GitHub, DataDog, and more) to targets including Lambda, SQS, SNS, Step Functions, ECS, and API Gateway
- Content-based filtering matches events on any field in the JSON payload, so rules only trigger on the precise events you care about
- Custom event buses isolate application events from AWS service events; partner event buses connect directly to supported SaaS sources
- Schema Registry auto-discovers and stores event schemas from the event bus, and generates code bindings for multiple languages to speed up consumer development
- EventBridge Pipes provide point-to-point connections between a source and a target with optional filtering and enrichment in between, without writing glue code
- EventBridge Scheduler triggers one-time or recurring tasks using cron or rate expressions, replacing the need for CloudWatch Events cron rules or Lambda-based schedulers
Gotchas & Constraints
Gotcha #1: Classic delivers at-least-once; both buses retry; targets must be idempotent. Classic retries for up to 24 hours; a Custom Event Bus subscriber retries 5 times over 300 seconds by default, so raise MaxEventAgeInSeconds if you need the old window. Gotcha #2: Event pattern matching is case-sensitive and requires exact matches. Constraints: Classic allows 5 targets per rule and 300 rules per bus; a Custom Event Bus takes 500,000 events/second and 10,000 subscribers.
Illustrative scenario; figures are examples, not verified customer results.
An e-commerce platform needs to decouple order processing. When an order is placed, multiple downstream systems need to react: inventory must be reserved, payment processed, shipping labels generated, and analytics updated. Previously, the order service called each system synchronously, creating tight coupling and cascading failures. With EventBridge, the order service publishes a single 'OrderPlaced' event to a custom event bus. Four EventBridge rules listen for this pattern, each routing to different targets: Lambda for inventory, Step Functions for payment orchestration, ECS Fargate for label generation, and Amazon Data Firehose for analytics. If the shipping label service is down, it doesn't block order confirmation. Failed targets can use DLQs for retry logic. They also create rules for AWS service events: when an EC2 instance terminates unexpectedly, EventBridge triggers Lambda to investigate and send alerts.
The Result
decoupled architecture, resilient to failures, and easy to extend with new event consumers.