Lesson 3 of 4 Amazon EventBridge and AWS Health

Troubleshooting EventBridge Rules

This lesson explains how rule metrics show whether an EventBridge problem is a rule that does not match or a target that is not invoked, and how to fix each.

Learning outcomes

After completing this lesson, you will be able to:

  • Use rule metrics to locate the problem.
  • Fix rules that do not match.
  • Fix targets that are not invoked.

Use the rule metrics first

EventBridge publishes metrics per rule in the AWS/Events namespace. MatchedEvents shows whether events matched. Invocations counts target invocations, FailedInvocations counts failures that were not retried successfully, ThrottledRules shows throttling, and InvocationsSentToDlq and InvocationsFailedToBeSentToDlq show dead-letter queue activity. If MatchedEvents is zero, the problem is the event or the pattern; if it is positive but FailedInvocations is too, the problem is the target.

The following diagram turns the two metrics into a decision.

Troubleshooting an EventBridge rule with its metrics. If MatchedEvents is zero, the problem is the event or the pattern: the event may not reach this bus or Region, or a value may differ. If MatchedEvents is positive but FailedInvocations is too, the problem is the target, usually its resource-based policy or the rule's role.
Checking the metrics first separates pattern problems from target problems before any change is made.

When the rule does not match

Work through the following causes in order when MatchedEvents stays at zero.

  1. The event is not emitted where you think. Service events go to the default bus in the Region where they occur; API call events for global services such as IAM appear in us-east-1.
  2. The rule is on a custom bus, but AWS service events only arrive on the default bus.
  3. The pattern does not match the real event. Compare it with a sample from the console or use aws events test-event-pattern. Check case, field names, nesting and that values are in arrays.
  4. API call events need CloudTrail to record the call; read-only calls are only delivered to rules that opt in to them.
  5. S3 events reach EventBridge only if EventBridge notifications are enabled on the bucket.
  6. The rule is disabled.
Select all that apply

Why no match?

Exam skills 1.2.2

Identify the reasons a rule's MatchedEvents metric stays at zero.

Log in to try this activity Interactive activities are free with an account.

When the target is not invoked

When events match but the target does nothing, the following checks cover most cases.

  • The target's resource-based policy does not allow events.amazonaws.com, or its aws:SourceArn condition names a different rule.
  • The rule's IAM role lacks the action (for example ssm:StartAutomationExecution) or iam:PassRole.
  • An SNS topic or SQS queue encrypted with a KMS key whose policy does not allow EventBridge.
  • The input transformer produces invalid JSON or a payload the target rejects.
  • The target is in another account and the destination bus policy does not allow the source account.

A dead-letter queue on the target captures failed events with the error code and message as message attributes, which usually names the exact cause.

Troubleshooting scenario

Matched but not delivered

Exam skills 1.2.2 · 4.2.2

Find why matched events do not reach the target.

Log in to try this activity Interactive activities are free with an account.
Worked example

A pattern that never matches

An engineer writes a rule to alert on root user console sign-in, with the pattern {"source": ["aws.signin"], "detail": {"userIdentity": {"type": "Root"}}}, in eu-west-1. Nothing matches. There are two errors. The value "Root" is not in an array, which makes the pattern invalid or non-matching, and console sign-in events are delivered in the Region where the sign-in endpoint is called, which for most root sign-ins is us-east-1. The corrected rule uses "type": ["Root"] together with "detail-type": ["AWS Console Sign In via CloudTrail"] and is created in us-east-1 (and other Regions where sign-ins occur).

Check yourself

MatchedEvents is above zero, but FailedInvocations is also above zero. Where is the problem?

Show answer

In the target: its permissions or the payload. The pattern itself is matching.

Exam Tips

Remember for the exam

  • MatchedEvents = 0: pattern, bus or Region problem. FailedInvocations > 0: target permissions or payload.
  • Test patterns with test-event-pattern against a real sample event.
  • AWS service events only arrive on the default bus.
  • Global service events (IAM, sign-in) usually appear in us-east-1.
  • A DLQ on the target records the error for failed events.