AWS Certified Solutions Architect – Professional
EventBridge cross-account and cross-Region events for SAP-C03
The Amazon EventBridge guide gives three steps. The receiving account edits its event bus policy to allow the senders, by account ID or organization ID. Each sending account creates a rule whose target is the receiving bus, with an IAM role. The receiving account creates rules that match the events. A forwarded event is not sent to a third account.
The receiving side: bus policy and rules
An event bus accepts events from other accounts only if its resource-based policy allows them. The policy can name account IDs, or it can use an IAM condition to admit a whole organization by its organization ID. An organization grant admits every account in that organization, so the policy does not list accounts one by one.
Rules on the receiving bus match forwarded events like any other event. A rule with no account field in its event pattern matches events from every account the bus admits. To limit a rule, list account IDs in account. Do not use * there: it matches nothing, because * never appears in an event's account field. If a bus accepts events from all AWS accounts, AWS strongly recommends an account filter on every rule.
Events sent between accounts are charged to the sending account as custom events. The receiving account is not charged.
The sending side: forwarding rules and roles
Each sending account needs a rule on its own bus with the receiving bus ARN as the target. Nothing is pulled from the central account, so with many accounts the forwarding rule has to be deployed to each one. The rules that do the real work stay in the central account.
New cross-account bus targets must have an IAM role. This applies to targets created after March 2, 2023. A sender that gets its permission from an organization grant needs the role in any case. The console creates the role, and with the AWS CLI you create it yourself. AWS recommends roles on every bus target so that service control policies apply to who can send events.
EventBridge delivers one hop. If the receiving account has a rule that sends those events to a third account, they are not sent. The same applies to three buses in one account. A design that relays events through a collector account to a second account does not work. Give the source rule several targets instead, one for each bus that must receive the event.
Cross-Region routing and global endpoints
A bus in another Region is a rule target like a bus in another account: the target is the bus ARN. Accounts in different Regions can exchange events when the destination Region is a supported cross-Region destination. The destination bus policy must still allow the sender. To add a central Region next to existing collectors, add a second target to the source rules and allow the source accounts on the new bus.
A global endpoint handles Regional failover for custom events at ingestion. It has a primary and a secondary Region and a Route 53 health check. When the health check reports unhealthy, custom events are routed to the bus in the secondary Region within minutes. When it reports healthy, events go to the primary Region again. Applications must add the endpointId and EventBusName to their PutEvents calls.
With custom buses, the bus in each Region must have the same name and be in the same account. Event replication sends every custom event to both Regions with managed rules. It is required for automatic recovery. Without it you reset the health check by hand before events return to the primary Region. Replication increases cost, and events are processed in the secondary Region asynchronously. With the recommended alarm configuration AWS states an RTO and RPO of 360 seconds, with a maximum of 420.
Where the exam catches people
- Believing a bus policy alone moves events to the central account: each sending account needs a rule that targets the central bus, with an IAM role.
- Believing
account: *in a rule matches every sending account: it matches no events. Omit theaccountfield. - Believing events can be relayed from account A through account B to account C: forwarded events are not sent on to a third account.
- Believing a global endpoint can pair buses with different names or in different accounts: the custom bus must have the same name in each Region and be in the same account.
- Believing a global endpoint returns to the primary Region by itself without replication: event replication is required for automatic recovery.