Event-driven patterns with EventBridge

Deploying Applications on AWS

Dunieski Otano

Amazon Web Services Solutions Architect

One order, four reactions

  • One order must reach billing, fulfillment, analytics, email
  • Direct calls to all four are brittle and slow
  • One event fans out to every consumer

One event fanning out from a central topic to multiple downstream services in parallel

Deploying Applications on AWS

Choosing the right messaging services

2x2 grid of AWS messaging services: SQS queue with producer-consumer flow, SNS pub-sub fanout to multiple subscribers, EventBridge event bus with rule-based routing, and Kinesis ordered shards with replay

  • SQS: one queue, one consumer group, at-least-once
  • SNS: pub/sub, push one message to many subscribers
  • EventBridge: route events by content to many targets
  • Kinesis Data Streams: ordered, replayable streaming
Deploying Applications on AWS

The fanout pattern

  • One event must reach several consumers at once
  • Publish to an SNS topic
  • Each SQS queue subscribes to the topic
  • Every consumer gets its own copy, decoupled

SNS-to-SQS fanout pattern: one SNS topic publishing to multiple SQS queues, each queue independently serving its own consumer at its own pace

Deploying Applications on AWS

Filtering so consumers get only what they need

  • Without filters, every subscriber gets every event
  • SNS subscription filter policies: filter by message attributes
  • EventBridge content filters: match on event fields
  • Each consumer receives only its relevant events

SNS subscription filter policy and EventBridge content filter: each consumer receives only events matching its filter rule, reducing unnecessary processing and cost

Deploying Applications on AWS

Routing with EventBridge

EventBridge routing diagram: event bus receiving events from multiple sources, rules matching event patterns, and matched events routing to Lambda, SQS, and other target services

  • Event bus: receives events from many sources
  • Rule: an event pattern that matches certain events
  • Target: where matched events are sent
  • One event can route to multiple targets
Deploying Applications on AWS

Streaming with Kinesis Data Streams

  • A continuous, real-time flow of records
    • Ordered records within a shard
    • Replayable: consumers re-read from any point
    • Multiple consumers read the same stream independently
    • Use for clickstream, telemetry, high-throughput data

Kinesis Data Streams architecture: producers write ordered records into numbered shards, three consumers independently read at different positions, with a rewind arrow showing replay capability

Deploying Applications on AWS

Lambda as an event consumer

  • Lambda can be triggered by SQS, SNS, EventBridge, Kinesis
  • Event source mapping polls SQS and Kinesis for you
  • SNS and EventBridge push events to Lambda
  • Near-real-time processing with no servers to manage

Lambda triggered by four event sources: event source mapping polling SQS and Kinesis in batches, while SNS and EventBridge push events directly to Lambda

Deploying Applications on AWS

Let's practice!

Deploying Applications on AWS

Preparing Video For Download...