Event buses, rules, and patterns
EventBridge receives structured events and matches them against rule patterns. Matching events go to configured targets; event content is data, not an instruction to execute arbitrary code. Rules can select source, detail-type, and fields inside detail. Delivery retry and dead-letter settings help protect targets from transient failures. For example, match source com.shop and detail-type OrderCreated, then route only orders whose detail.region is eu to an appropriate processing target.
Match source com.shop and detail-type OrderCreated, then route only orders whose detail.region is eu to an appropriate processing target.
A payment service emits an event with source com.store.payments, detail-type PaymentSettled, and a detail object containing currency and orderId. EventBridge receives it on a bus and evaluates configured rule patterns. One rule targets finance processing for a selected currency; another targets order completion. The publisher need not call either consumer directly.
An event bus receives events. A rule connects a matching pattern to targets. An event pattern tests selected fields using EventBridge's matching rules rather than executing arbitrary expressions from the payload. Develop examples before attaching a target: a matching event, a wrong source, and a missing required field. A target may receive a transformed payload, so test that mapping too. Delivery can fail after a successful put-event request, requiring target retries and dead-letter handling. Event routing creates flexible coupling, but schema drift can silently remove expected matches unless contract tests and observability identify accepted events that never reach intended consumers.
Clear event schemas and narrow matching rules make routing reviewable and keep unrelated events from unexpectedly triggering costly or privileged downstream workflows in production.
Treating a pattern as a full JSON equality comparison misses EventBridge matching semantics; test sample matching and nonmatching events before connecting a live target.