1When to use EventBridge?
Use SNS when you need high-throughput pub/sub fan-out to SQS. Use EventBridge when you need complex JSON pattern matching, third-party SaaS integration, or scheduled Cron jobs.
2Step-by-Step Breakdown
What is EventBridge?. Formerly known as CloudWatch Events, EventBridge is a serverless event bus that makes it easy to connect applications together using data from your own apps, SaaS apps, and AWS services.
The Event Bus. An event bus receives events. The default bus receives events from AWS services (e.g., 'EC2 instance terminated'). You can create custom buses for your own application events.
Rules and Targets. You create Rules that match specific incoming events. When an event matches the rule, EventBridge routes it to a Target (like a Lambda function or SQS queue).
Event Patterns. Rules use JSON-based Event Patterns to filter messages. For example, match only events where 'source' is 'aws.ec2' and 'state' is 'running'.
Knowledge Check. In EventBridge, what component evaluates incoming events against a JSON pattern and routes them to a destination?
- →Event Bus
- →Event Rule
Scheduled Events (Cron Jobs). EventBridge is the AWS standard for running scheduled tasks. You can create a rule that triggers a Lambda function every Monday at 8 AM using standard Cron syntax.
Rate Expressions. If you don't need exact times, you can use simple Rate expressions to trigger targets at regular intervals.
SaaS Integration. EventBridge can ingest events directly from third-party SaaS partners like Zendesk, Datadog, or Shopify without needing custom webhooks.
Schema Registry. EventBridge can automatically discover and store the JSON schema of the events passing through it, allowing developers to generate strong types in Java/TypeScript.
Summary. Use EventBridge for cron jobs and deep event-driven architectures.
