Sub topic 12
Routing across accounts and regions
This chapter assumes you know how to create a custom event bus, write a rule, and attach a target. It also assumes you understand IAM roles and resource policies. Here you will send events between accounts and between regions.
The core idea
A rule can only send events to a target in its own account and region, with one exception. The exception is another event bus. A target of type "event bus" lets a rule forward matching events to a bus in a different account or a different region. The receiving bus then applies its own rules.
So cross-account and cross-region routing is always a two-step pattern: a rule on the source bus forwards events, and a bus on the destination side receives them.
Step 1: Let the destination bus accept events
The destination bus needs a resource policy that allows the source account to call events:PutEvents on it. Run this in account B (222222222222):
aws events put-permission \
--event-bus-name orders-bus \
--action events:PutEvents \
--principal 111111111111 \
--statement-id AllowAccountAUse --principal '*' only together with a condition, such as an organization ID, because otherwise any AWS account can send events to your bus.
Step 2: Forward from the source bus
In account A, create a rule on the source bus and add the destination bus as a target. The target ARN is the destination bus ARN.
aws events put-rule --name forward-orders --event-bus-name orders-bus --event-pattern file://pattern.json
aws events put-targets --rule forward-orders --event-bus-name orders-bus --targets '[{"Id":"remote-bus","Arn":"arn:aws:events:us-east-1:222222222222:event-bus/orders-bus","RoleArn":"arn:aws:iam::111111111111:role/eventbridge-forward-role"}]'The role in RoleArn must trust events.amazonaws.com and allow events:PutEvents on the destination bus ARN. Without it, EventBridge cannot deliver the events.
Cross-region routing
The same mechanism works across regions. Put the destination region in the target ARN, for example arn:aws:events:eu-west-1:.... The destination bus in that region still needs a policy allowing the sender if the accounts differ. Within one account, the execution role is enough.
What changes in the event
Forwarded events keep their source, detail-type, and detail. The account and region fields keep the values from the original producer. The id stays the same, so you can correlate events across hops. The destination rules therefore match on the same fields as before.
You can also send events from the destination back to the source. Avoid forwarding loops: if two buses forward each other's events with broad patterns, events circulate endlessly. Narrow the patterns and avoid forwarding events that have already been forwarded.
Common errors
| Symptom | Likely cause |
|---|---|
| Events never arrive at the destination | The destination bus has no resource policy for the sender |
| `AccessDenied` in the rule's failed invocations | The target role lacks `events:PutEvents` on the destination bus |
| Events arrive but no target fires | The destination bus has no rule matching the event |
| Rule created but nothing forwards | The rule is on the default bus, not the custom bus you published to |
Check the rule's FailedInvocations CloudWatch metric on the source side. Attach a dead-letter queue to the forwarding target so that undeliverable events are kept.
Exercise
Account A forwards events to a bus in account B, but nothing arrives. The rule in account A matches test events and its target role allows events:PutEvents. What should you check next, and why?
Show answer
Check the resource policy on the destination bus in account B. A cross-account bus accepts events only from principals its policy allows, so account B must grant events:PutEvents to account A (for example with aws events put-permission). Also check the rule's FailedInvocations metric for AccessDenied errors.