Hermes Wiki
Developer/ArchitecturePatterns/Microservices/CaseStudies/aws-hybrid-multi-tenant-architecture-for-stateful-services-at-scale

AWS: Hybrid Multi-Tenant Architecture for Stateful Services at Scale

Problem + constraints

A large-scale, AWS-hosted ad-serving platform needed strong per-tenant isolation for stateful services without paying the operational cost of a dedicated AWS account per tenant — the "cell-per-account" extreme common in strict multi-tenant SaaS designs. Fully shared infrastructure (one set of clusters serving every tenant) risked noisy-neighbor contention and made blast-radius containment hard: a bad deploy or a runaway tenant could affect everyone. But a dedicated account per tenant would have made onboarding scale linearly, or worse, with tenant count — every new tenant meaning a new VPC, new IAM roles, and new peering or Transit Gateway links to shared dependencies, negotiated and provisioned by hand each time.

Solution

The architecture uses a three-level hierarchy. A tier is the top-level logical grouping of tenants that share common infrastructure characteristics. A cell is an AWS account boundary — the horizontal scale-out unit. An infra group is a self-contained unit inside a cell: a VPC, an Application Load Balancer, dedicated ECS clusters per tenant, IAM roles, and a monitoring stack. Amazon Route 53 weighted routing distributes traffic across cells/accounts and, critically, lets a tenant's traffic be migrated gradually between clusters as its load profile changes — without any client-visible cutover. Inside an infra group, ALB listener rules route each request to the correct tenant's dedicated ECS cluster based on a tenant identifier, giving cluster-level isolation without needing a dedicated account per tenant.

The structural decision that makes onboarding cheap is when connectivity gets wired: downstream service dependencies are pre-integrated once, at tier-creation time, via AWS PrivateLink endpoints — not per-tenant at onboarding time. A new tenant just lands inside an existing infra group and inherits already-established connectivity instead of triggering a fresh round of VPC peering or Transit Gateway setup. That single change cut infrastructure setup steps for onboarding a new tenant by roughly 80%.

What to steal

  • Multi-tenancy isolation is a spectrum, not a binary choice between shared-everything and account-per-tenant. The tier/cell/infra-group hierarchy is a concrete way to pick isolation granularity per concern — blast radius at the account/cell level, resource contention at the ECS-cluster level — instead of over- or under-isolating uniformly across the board.
  • Pre-integrate shared dependencies once, at the tier/account level, and reuse forever — wiring downstream connectivity (PrivateLink endpoints) at tier-creation time instead of per-tenant onboarding turns an O(n) manual-setup problem into a constant-time one.
  • Weighted DNS routing (Route 53) as a tenant-migration mechanism is a reusable pattern for any "move a unit of traffic between backends without a client-visible cutover" problem — not specific to multi-tenancy.
  • When justifying an org-complexity investment in review, "80% reduction in onboarding setup steps" is a legible, provable metric — a much stronger case than "the new structure is cleaner."

Engineering Lens

The genuinely Principal-level skill on display is choosing isolation granularity deliberately, per axis, rather than reaching for full isolation (or full sharing) by default: blast radius, resource contention, and operational cost don't all demand the same isolation boundary, and conflating them either over-engineers or under-protects. This is a pillar-org-complexity problem with a pillar-cost payoff — the tier/cell/infra-group hierarchy is exactly the kind of structure worth being able to sketch on a whiteboard in a design review when someone asks "why not just give every tenant their own account?" Given that this is a large-scale, multi-tenant SaaS-style platform, the framing biases naturally toward Fintech/BigTech SaaS territory — the same isolation-granularity tradeoff shows up directly in multi-tenant trading platforms, payment processors serving multiple merchants, and any BigTech ad/commerce platform serving many customers off shared infrastructure.

Sources

Hermes Wiki