AWS EventBridge Cheat Sheet
Event bus rules, patterns, schedules, and SDK snippets for routing events between AWS services and SaaS apps.
2 PagesIntermediateFeb 10, 2026
Create a Rule with an Event Pattern
Route events matching a pattern to a target using the AWS CLI.
bash
# Create a rule that matches EC2 instance state changesaws events put-rule \ --name "ec2-state-change" \ --event-pattern '{ "source": ["aws.ec2"], "detail-type": ["EC2 Instance State-change Notification"], "detail": { "state": ["running", "stopped"] } }'# Attach a Lambda function as the targetaws events put-targets \ --rule "ec2-state-change" \ --targets '[{"Id": "1", "Arn": "arn:aws:lambda:us-east-1:123456789012:function:notify"}]'# Grant EventBridge permission to invoke the Lambdaaws lambda add-permission \ --function-name notify \ --statement-id eventbridge-invoke \ --action lambda:InvokeFunction \ --principal events.amazonaws.com \ --source-arn arn:aws:events:us-east-1:123456789012:rule/ec2-state-change
Custom Event Bus & PutEvents (SDK)
Publish a custom application event to a dedicated event bus using boto3.
python
import boto3, jsonclient = boto3.client("events")response = client.put_events( Entries=[ { "Source": "myapp.orders", "DetailType": "OrderPlaced", "Detail": json.dumps({"orderId": "o-123", "total": 49.99}), "EventBusName": "orders-bus", } ])print(response["Entries"]) # check for EventId / ErrorCode per entry
Scheduled Rule (cron / rate)
Trigger a target on a fixed schedule instead of an event pattern.
bash
# Every 15 minutesaws events put-rule \ --name "poll-every-15-min" \ --schedule-expression "rate(15 minutes)"# Cron: 8am UTC every weekdayaws events put-rule \ --name "weekday-morning-report" \ --schedule-expression "cron(0 8 ? * MON-FRI *)"
Core Concepts
The building blocks of EventBridge you'll reference constantly.
- Event bus- a router that receives events; default, custom, or partner (SaaS) buses
- Rule- matches events via an event pattern or a schedule expression
- Target- up to 5 destinations per rule (Lambda, SQS, SNS, Step Functions, etc.)
- Event pattern- JSON filter matched against source, detail-type, and detail fields
- Archive & Replay- store matched/unmatched events and replay them into a bus later
- Schema registry- infers and stores JSON schemas for events flowing through a bus
- Input transformer- reshapes the event JSON before it reaches the target
Pro Tip
Use content filtering operators like `anything-but`, `prefix`, and `numeric` ranges in event patterns instead of chaining multiple rules — it cuts costs and keeps routing logic in one place.
Was this cheat sheet helpful?
Explore Topics
#AWSEventBridge#AWSEventBridgeCheatSheet#CloudComputing#Intermediate#Create#Rule#Event#Pattern#CheatSheet#SkillVeris
Advertisement
Sri Hayavadhana Info-Tech
Professional Web Designing Services
- Responsive Websites
- E-commerce Solutions
- SEO Friendly Design
- Fast & Secure
- Support & Maintenance