Ravindra BagaleCourses & study guides मराठी Track your progress

What Is Amazon EventBridge? Event Bus, Rules and Schedules Explained

Your shop has a doorbell, a WhatsApp group, and a wall calendar. Amazon EventBridge is all three for AWS: something happened (doorbell), rules decide who to wake (WhatsApp), and Scheduler rings the calendar on time.

What you'll learn in this chapter

  • Why event-driven beats polling forever
  • Default bus vs custom bus vs partner bus
  • Rules, targets, content filters, Scheduler
  • EventBridge vs SQS vs cron on EC2
  • Lab, errors, FAQ, interview

1. Everyday example first

Why do we need this?

A hospital LIS uploads a lab report to S3. Billing, SMS, and the doctor app all need to know. Polling S3 every minute wastes money and is late. One event, many targets.

What is it?

Amazon EventBridge is a serverless event bus. Producers put events on a bus; rules match fields and send to targets (Lambda, SQS, Step Functions, API Destination, and more). EventBridge Scheduler fires one-time or recurring schedules without managing servers.

S3 report fan-outS3 Object CreatedEventBridge rule matchTargets: Lambda + SQS + SFNEach consumer does its job
Producers never hard-code consumer URLs.

2. Buses and rules

PieceMeaningWhen
Default busAWS service events land hereS3, EC2, CloudTrail patterns
Custom busYour app events, isolatedSaaS product domain events
Partner busSaaS partners push inZendesk, Auth0 style sources
RuleEvent pattern or schedule → targetsdetail-type = OrderPlaced
Schedulercron / rate / one-time to a targetNightly report at 2:00 IST

3. EventBridge vs SQS vs EC2 cron

  • SQS: buffer work for one consumer group; great decoupling + retries.
  • EventBridge: publish once, fan-out to many heterogeneous targets with filters.
  • EC2 cron: old habit; patching and missed runs hurt. Prefer Scheduler.
  • Step Functions: use when the reaction itself is a multi-step workflow.

Ravindra Bagale's Tip

Name detail-type and source like APIs: stable strings, version when you break shape.

4. Industries

  • Ecommerce: OrderPlaced → inventory, invoice, loyalty, analytics.
  • Fintech: PaymentCaptured → ledger, risk, receipt email.
  • Edtech: LessonCompleted → certificate Lambda + CRM.
  • IoT factory: TemperatureAlarm → SNS + maintenance ticket.
  • Gov/citizen apps: ApplicationSubmitted → SLA timers via Scheduler.

5. Filter pattern sketch

How to do it (step by step)

  1. Decide source (com.myapp.orders) and detail-type (OrderPlaced).
  2. Write a rule event pattern for those fields (and maybe amount > 0).
  3. Add targets: Lambda for fast work, SQS for heavy, SFN for workflows.
  4. Enable the rule; put a sample event with PutEvents.
  5. Check metrics: TriggeredRules, Invocations, FailedInvocations.
{
  "source": ["com.myapp.orders"],
  "detail-type": ["OrderPlaced"],
  "detail": {
    "amount": [{"numeric": [">", 0]}]
  }
}

6. Mini lab: custom bus + rule + Lambda

Do this in ap-south-1 (Mumbai) unless your org forbids it. Set a budget alert first.

How to do it (step by step)

  1. Create a custom event bus named lab-orders.
  2. Create a rule on that bus matching source com.lab.orders.
  3. Target a tiny Lambda that prints the event.
  4. aws events put-events with a matching entry.
  5. Confirm Lambda log in CloudWatch.

Cleanup (stop billing)

  1. Delete the rule, bus, and lab Lambda.
  2. Remove any leftover log groups if your org wants.

7. Common errors and fixes

Each row is a real mistake students and juniors hit. Read the fix before you panic.

Error / symptomFix
Rule never firesPattern too strict or wrong bus; test with matched sample.
Infinite Loop warningTarget writes events that rematch the same rule — add filter.
PutEvents FailedEntrySize, detail JSON, or quota — read FailedEntryCount.
Scheduler vs Rules cron confusionOne-time/flexible schedules → Scheduler; AWS events → Rules.
Target not authorizedEventBridge needs iam:PassRole / resource policy on target.
Cross-account delivery failsUse event bus policy + correct role.
Wrong timezone on cronScheduler expressions need timezone field for IST.
DLQ empty but failuresCheck target permissions first; DLQ only after invoke fail.
Partner bus emptyPartner not enabled / wrong region.
High FailedInvocationsFix Lambda errors; add DLQ + alarm.

8. Troubleshooting checklist

  1. Confirm events land on the bus you think (default vs custom).
  2. Paste a known-good sample into the rule tester.
  3. Check CloudWatch metrics on the rule.
  4. Read Lambda errors if target is Lambda.
  5. Verify IAM for PutEvents and for the target.

9. FAQ

Q. Is EventBridge the old CloudWatch Events?

Same family; EventBridge adds buses, partners, richer targets.

Q. EventBridge vs SNS?

SNS is pub/sub for notifications; EventBridge is event routing with rich filters and SaaS partners.

Q. Can I archive events?

Yes — archives + replay for recovery drills.

Q. Max targets per rule?

Multiple; design with fan-out limits in mind — see current quotas.

Q. Do I need Schema Registry?

Helpful for teams discovering event shapes.

10. Interview Q&A

Q. What is an event bus?

A channel where producers put events and rules route them to targets.

Q. Default vs custom bus?

Default for AWS services; custom for your domain events.

Q. EventBridge vs SQS?

Bus fan-out with filters vs durable queue for workers.

Q. What is Scheduler for?

One-time or recurring invokes without EC2 cron.

Q. How do you avoid poison loops?

Tighten patterns; never emit the same detail-type from the target carelessly.

Q. Idempotent consumers?

Consumers must tolerate at-least-once delivery.

11. Tips in English, Marathi and Hindi

Ravindra Bagale's Tip (EN)

Stable source and detail-type names are public APIs. Rename carefully.

Ravindra Bagale's Tip (MR)

source व detail-type = public API. नाव बदलताना काळजी.

Tip (HI)

source और detail-type पब्लिक API हैं — नाम बदलते समय सावध रहो।

Try at home

  1. List 5 events your college app could emit.
  2. Draw bus → rule → 3 targets on paper.
  3. Compare one cron job you know with Scheduler.

In short

  1. EventBridge routes events from producers to many targets.
  2. Use custom buses for your app domain.
  3. Scheduler replaces most EC2 cron needs.
  4. Filter tightly; watch FailedInvocations.

Revision, interview and comparison cards

Revise this lesson in a few minutes. Save the cards on your phone or download them as PNG files. The QR code on each card opens this lesson.

Revision card: What is Amazon EventBridge?. Many apps need “when X happens, do Y” without hard-wiring every producer to every consumer. EventBridge is a serverless event bus: producers put events, rules match, targets run (Lambda, SQS, Step Functions…). Create a bus (or use default) → write a rule with event pattern → set a target → give EventBridge invoke rights. PutEvents with detail-type OrderPlaced; matching rule invokes the pack Lambda.
Revision card: What is Amazon EventBridge? · Download PNG · Open card page
Revision card: Event patterns. A rule that is too wide floods targets; too narrow never fires. An event pattern is JSON that must match fields like source, detail-type, and detail keys. Match source myapp.orders and detail-type OrderPlaced; optionally detail.status = PAID. Only paid orders hit the ship target; draft orders do not.
Revision card: Event patterns · Download PNG · Open card page
Revision card: Scheduler vs cron rules. Nightly cleanup and one-off reminders are different scheduling jobs. EventBridge rules can run on a cron/rate. EventBridge Scheduler adds one-time and timezone-aware schedules at scale. Use a rate(1 day) rule for daily reports; use Scheduler for “remind me at 2026-11-01 09:00 IST”. CloudWatch metrics show Invocations on the schedule; target Lambda logs the run time in IST.
Revision card: Scheduler vs cron rules · Download PNG · Open card page
Revision card: Archive and replay. A bug in a consumer drops a day of order events; you need those events again. Archive stores events from a bus; replay sends them again to selected rules. Enable archive on the bus with a retention period; after a fix, start a replay for the failed window. Replay metrics show events re-delivered; ship Lambda processes the missed OrderPlaced set.
Revision card: Archive and replay · Download PNG · Open card page
Revision card: EventBridge vs SNS/SQS. Teams often pick the first messaging service they know and paint themselves into a corner. SNS: fan-out notifications. SQS: durable queue for one consumer group. EventBridge: rich content filters, many AWS targets, SaaS partners. Use EventBridge when you need pattern matching across services; use SQS when one worker pool must not lose jobs. OrderPlaced to analytics + fraud + email: EventBridge rules. Payment worker pool: SQS.
Revision card: EventBridge vs SNS/SQS · Download PNG · Open card page
Comparison: EventBridge vs SNS. EventBridge: Content filters, many AWS targets, archive/replay. SNS: Simple pub/sub fan-out to email/HTTP/SQS/Lambda.
Comparison: EventBridge vs SNS · Download PNG · Open card page
Comparison: EventBridge rule (cron) vs EventBridge Scheduler. EventBridge rule (cron): Cron/rate on a rule targeting a bus target. EventBridge Scheduler: One-time and timezone-aware schedules at scale.
Comparison: EventBridge rule (cron) vs EventBridge Scheduler · Download PNG · Open card page
Interview card: EventBridge vs SNS?. EventBridge: content filters, many AWS targets, archive/replay, partner sources. SNS: simple pub/sub fan-out. Choose EventBridge for application events across services; SNS for notifications to email/SMS/HTTP. OrderPlaced to three Lambdas with different filters → EventBridge.
Interview card: EventBridge vs SNS? · Download PNG · Open card page
Interview card: How do you version events?. Put a version field in detail; use Schema Registry when teams share contracts. Consumers should ignore unknown fields and gate on version for breaking changes. detail.version=2 adds discountCode; v1 consumers keep working.
Interview card: How do you version events? · Download PNG · Open card page
Interview card: What if a target fails?. Configure DLQ (SQS) and retry policy on the target; alarm on InvocationsFailed. Fix the consumer, then drain or replay from archive/DLQ. Pack Lambda errors go to DLQ; after patch, replay archived OrderPlaced.
Interview card: What if a target fails? · Download PNG · Open card page
Interview card: Default bus vs custom bus?. Default bus receives many AWS service events; custom buses isolate app domains and permissions. Put app events on a custom bus with least-privilege PutEvents. orders bus only allows the order service role to PutEvents.
Interview card: Default bus vs custom bus? · Download PNG · Open card page

More cards: Ravi Sir's Cards.

Practice Tasks

About this scenario

Vidarbha Cotton Mills is a textiles business in Nagpur. Ganesh Wankhede looks after its IT and cloud work. They count money in INR and run their AWS resources in the ap-south-1 Region. In the tasks below you do real jobs for them using what this lesson teaches. All names, account IDs, IP addresses and numbers are made up for practice.

0 / 16

Easy List event buses

Why: See custom buses.

What to do: List event buses in ap-south-1.

How:
  1. Read the task and decide which AWS service it is about.
  2. Write aws, then the service name, then the operation (the action word).
  3. Add each needed flag (--name) followed by its value from the task.
  4. Flags can be in any order. Click Check answer.

Easy Create an event bus

Why: Isolate app events.

What to do: Create event bus named vidarbhacotton-orders.

How:
  1. Read the task and decide which AWS service it is about.
  2. Write aws, then the service name, then the operation (the action word).
  3. Add each needed flag (--name) followed by its value from the task.
  4. Flags can be in any order. Click Check answer.

Easy List rules on a bus

Why: Inventory automation.

What to do: List rules on event bus vidarbhacotton-orders.

How:
  1. Read the task and decide which AWS service it is about.
  2. Write aws, then the service name, then the operation (the action word).
  3. Add each needed flag (--name) followed by its value from the task.
  4. Flags can be in any order. Click Check answer.

Easy Describe a rule

Why: Check schedule and state.

What to do: Describe rule vidarbhacotton-nightly on bus default.

How:
  1. Read the task and decide which AWS service it is about.
  2. Write aws, then the service name, then the operation (the action word).
  3. Add each needed flag (--name) followed by its value from the task.
  4. Flags can be in any order. Click Check answer.

Easy Delete a rule

Why: Clean lab rules.

What to do: Delete rule vidarbhacotton-nightly from bus default.

How:
  1. Read the task and decide which AWS service it is about.
  2. Write aws, then the service name, then the operation (the action word).
  3. Add each needed flag (--name) followed by its value from the task.
  4. Flags can be in any order. Click Check answer.

Easy List targets for a rule

Why: See who receives events.

What to do: List targets for rule vidarbhacotton-nightly on bus default.

How:
  1. Read the task and decide which AWS service it is about.
  2. Write aws, then the service name, then the operation (the action word).
  3. Add each needed flag (--name) followed by its value from the task.
  4. Flags can be in any order. Click Check answer.

Easy Default buses per account/region

Why: Every account has one default.

What to do: How many default event buses exist per account per region?

How:
  1. Write down the numbers the task gives you.
  2. Work it out step by step on paper.
  3. Type only the final answer in the box.
  4. Click Check answer.

Easy rate(5 minutes) number

Why: Schedules use rate or cron.

What to do: In rate(5 minutes), what is the number 5?

How:
  1. Write down the numbers the task gives you.
  2. Work it out step by step on paper.
  3. Type only the final answer in the box.
  4. Click Check answer.

Medium Put a schedule rule

Why: Cron-like triggers.

What to do: Put rule vidarbhacotton-nightly on bus default with schedule cron(0 18 * * ? *).

How:
  1. Read the task and decide which AWS service it is about.
  2. Write aws, then the service name, then the operation (the action word).
  3. Add each needed flag (--name) followed by its value from the task.
  4. Flags can be in any order. Click Check answer.

Medium Put Lambda target on a rule

Why: Wire rule to action.

What to do: Put target Id t1 Arn arn:aws:lambda:ap-south-1:108737854657:function:vidarbhacotton-job on rule vidarbhacotton-nightly.

How:
  1. Read the task and decide which AWS service it is about.
  2. Write aws, then the service name, then the operation (the action word).
  3. Add each needed flag (--name) followed by its value from the task.
  4. Flags can be in any order. Click Check answer.

Medium Put a custom event

Why: Publish domain events.

What to do: Put events Entries Source vidarbhacotton.orders DetailType OrderPlaced Detail '{"id":"1"}' EventBusName vidarbhacotton-orders.

How:
  1. Read the task and decide which AWS service it is about.
  2. Write aws, then the service name, then the operation (the action word).
  3. Add each needed flag (--name) followed by its value from the task.
  4. Flags can be in any order. Click Check answer.

Medium Remove targets from a rule

Why: Must remove targets before delete.

What to do: Remove targets t1 from rule vidarbhacotton-nightly on bus default.

How:
  1. Read the task and decide which AWS service it is about.
  2. Write aws, then the service name, then the operation (the action word).
  3. Add each needed flag (--name) followed by its value from the task.
  4. Flags can be in any order. Click Check answer.

Medium Allow EventBridge to invoke Lambda

Why: Resource policy side.

What to do: Allow lambda:InvokeFunction on arn:aws:lambda:ap-south-1:108737854657:function:vidarbhacotton-job from events.amazonaws.com.

How:
  1. Start with { "Version": "2012-10-17", "Statement": [ ... ] }.
  2. In each statement write Effect, Action and Resource.
  3. Give only what the task needs (least privilege).
  4. Use double quotes and commas correctly. Click Check answer.

Medium EventBridge archive retention days example

Why: Replay needs retention.

What to do: If you set archive retention to 30 days, what number do you configure?

How:
  1. Write down the numbers the task gives you.
  2. Work it out step by step on paper.
  3. Type only the final answer in the box.
  4. Click Check answer.

Hard Event pattern for OrderPlaced

Why: Filter only useful events.

What to do: JSON event pattern: source equals myapp.orders and detail-type equals OrderPlaced.

How:
  1. Start from the top-level keys the task names.
  2. Indent child keys with 2 spaces (no tabs).
  3. Fill in each property with the value from the task.
  4. Click Check answer. Key order does not matter.

Hard Pattern with amount > 1000

Why: Numeric matching for fraud.

What to do: Event pattern: source myapp.orders, detail.amount numeric greater-than 1000.

How:
  1. Start from the top-level keys the task names.
  2. Indent child keys with 2 spaces (no tabs).
  3. Fill in each property with the value from the task.
  4. Click Check answer. Key order does not matter.