dev.baschen.is

An organization-wide EventBridge bus with hierarchy ABAC

Large organizations want one place where services publish business events and other teams subscribe. The hard part is not the bus, it is the access model: who may publish as whom, and who may read whose events, without a ticket for every new consumer.

Status, up front: both modules, a Classic fallback and the examples pass terraform validate and offline terraform test. Nothing has been applied to an AWS account yet. The design depends on behaviour AWS documents but does not demonstrate, so the first step is the proof of concept in the repository.

The idea

Every workload is a Service at the bottom of a configurable hierarchy, by default Platform → Solution → Product → Service. The same names appear in three places, and the policy compares them directly:

Because the hierarchy is data passed to the central module, changing its depth or names does not change any code.

Why the new bus type

The design uses the EventBridge Custom Event Bus launched in September 2026 (event-busv2) rather than the Classic bus. It is the only one whose IAM model exposes publisher-supplied attributes, events:Metadata/<key>, on both publish and subscribe. Classic exposes only source and detail-type. The new bus also requires a subscriber's target to live in the subscriber's own account, which fits a design where each spoke owns its consumption. The hashicorp/aws provider has no resource for it yet, so the module uses awscc behind its interface.

Four rules

  1. A Service publishes only what it owns. One Deny per level, using a negated operator: an event whose metadata does not equal the caller's tag is denied, and so is an event or role that lacks the key.
  2. A Platform's tag is valid only in that Platform's accounts. A role in a logistics account that somehow carries platform=payments is still denied.
  3. A Service subscribes to its own events without asking anyone.
  4. An owner can allow-list other Services. Grants are reviewed data in the central stack, rendered as explicit policy statements. An allow-list is an entitlement, not an attribute match: tags on a consumer cannot say which producers it may read.

Two modules, two teams

The platform team deploys central-bus once per Region in an event platform account: the bus, its organization share and the generated policy. Each workload team deploys spoke-connection per service: an interface endpoint in its VPC with a least-privilege endpoint policy, the tagged service role, and its subscribers with SQS targets. Workloads have no internet access. They publish through the endpoint, and delivery never enters the VPC: EventBridge writes to a queue in the spoke account, which the workload reads through the SQS endpoint.

An event carries the hierarchy in metadata and the business payload in data:

{
  "Metadata": {
    "platform": "payments", "solution": "cards",
    "product": "issuing",   "service": "authorizer",
    "event-type": "CardAuthorized", "event-version": "1"
  },
  "Data": { "authorizationId": "a-7f3c", "amount": 4250, "currency": "CHF" }
}

Guardrails make the tags trustworthy

ABAC on a shared bus is only as sound as the tags, so organization controls are a prerequisite. SCPs deny hierarchy session tags (they would override role tags), let a principal set a hierarchy tag only to a value it carries itself, and deny removing one. An RCP makes event buses reject callers outside the organization. A tag policy keeps values tidy. The account vending roles are exempt, because they create each service's role with its tags.

Limits worth knowing

The bus policy is capped at 20,480 bytes (adjustable), roughly 40 to 55 grant statements at this design's size. That is the scaling limit of the allow-list; past it, grants would move to a control plane that creates subscribers for consumers. The bus, its publishers and its subscribers must share a Region, so a multi-Region estate deploys the central module once per Region.

What has to be proved first

The biggest assumption is that events:Metadata/<key> can be compared with ${aws:PrincipalTag/<key>} in a bus policy for callers in other accounts. AWS's policy language permits it; no AWS example shows it. If it fails, or the new bus is not in a target Region, the repository ships a Classic fallback with the same two-module split: the hierarchy is joined into the source string, and the platform team owns every rule. It works, but a service can no longer subscribe on its own, and it caps at 300 rules per bus.

← All articles