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."
Principal Engineer 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.
Reel Script
Setup: A large-scale ad-serving platform on AWS needed strong isolation between tenants for its stateful services, but a dedicated AWS account per tenant would make every new customer onboarding an increasingly expensive, hand-provisioned exercise — new VPC, new IAM roles, new networking, every time.
Concept walkthrough: Walk through the three-level hierarchy: tier (a logical grouping of tenants with shared infrastructure characteristics), cell (an AWS account — the scale-out unit), and infra group (VPC, ALB, per-tenant ECS clusters, IAM, monitoring, all self-contained). Explain how Route 53 weighted routing spreads and migrates traffic across cells, and how ALB listener rules route each request to the right tenant's dedicated ECS cluster within an infra group — cluster-level isolation without an account per tenant.
Real example tie-in: Focus on the pre-integration decision — AWS PrivateLink connections to shared downstream dependencies get set up once, at tier-creation time, not per tenant. A new tenant just gets placed into an infra group and inherits connectivity that already exists, which is what drove the ~80% cut in onboarding setup steps.
Tradeoffs & alternatives: Compare to the two extremes — fully shared infrastructure is cheap and simple but risks noisy neighbors and wide blast radius; account-per-tenant gives maximum isolation but makes onboarding and cross-account operations expensive at scale. The hybrid tier/cell/infra-group model picks isolation boundaries per concern instead of applying one boundary to everything.
Principal Engineer takeaway: Don't default to "shared" or "fully isolated" — decide isolation granularity per axis (blast radius, resource contention, operational cost) and design the account/cluster hierarchy around that decision. It's a structure worth having ready to sketch whenever multi-tenant isolation comes up in a review.
Related
- Team Topologies and Conway's Law
- Database Sharding Strategies
- Netflix's Nebula ArchRules: Architecture Governance Across Thousands of Repos
- Architecture Index
Sources: