# AWS multi-tenant SaaS architecture: pooled and silo tiers

> A serverless multi-tenant SaaS design on AWS: a pooled tier on shared API Gateway, Lambda and DynamoDB, a silo tier for premium tenants, onboarding services, and how to keep tenants apart.

## Key takeaways

- Map pricing tiers to deployment models: cheaper tiers share a pool, the top tier gets a silo.
- Onboarding is a product feature. Registration, user management, tenant management and provisioning are services in their own right.
- In the pool, the tenant ID in the data key is the isolation boundary, so enforce it with IAM, not only in code.
- API keys and usage plans shape traffic per tier; they are not a security control.

[Open this diagram in archhy](https://archhy.com/app#d=N4IgLglmA2CmIC4QFkCu1IFoywHYENcwACAZX31OIHtdiBBAdSoGdYAnANw7hZYWIAHatTgATYoQksI0asUgcWIADQho+AJ7VUYACIR2sAMaRaiEABkASqpABbWGHyJQAczkAjfNGUJQLAAW1ADuAHLUYrAAKpqCsH5g7KiwahAspASCAKIEnuKISSlqbuwQYqQQAF7wCABMAAxqgT4AZgDiZWLW+LJ+rT5sauy90KRgmnAWxnCEdoIQpqhGruBQUwhFsAC+u2q4kQmIANqg5RaobOzKahqesNAW0XiEJJdKdhPxFgCqV3YabS6VYAD0QTRAmkQAGYGhCQuUwIFEABGABsEMCsAgbkCYFRKIaezOYgsMjcuFQggB+HujyQYVgIQULyIxAAFOTcJgqZJBIIAJSfOK1EB-Dg0oH4-wgMEICFQhBogAs8MRyIQ6Mx2Nx0pRhOJIHOSHwIRu6lpDwsTCoAGE5KhSWovqKbfadE6LVLQYg6qq1Iq1WIkaiAKyNZo6vGIACccLUVQAkrgonLMIS4YbjSAjG4IOZbpb6SBrLA8wXwCKLKXy7h5vgjERE6STWbJTppaA5RHIYh-SAEcGNSjlQAObU46MIUeqrMtkBBBuwT13K1IUgtIzSDicRYJDm0TzUBtiCC4NxC51VpAAIR0KYbULUgiXTfnufzdbUR-YUXY40mUUxGoMAcBXLQOx9eoFT7IMQwQZV+yxSdpQAdgxOcLHwBZMEXLcaTpCwNyXbcuD3FgGAABUTYVviQehqPafAcBCLR60bMBmzJTdlzsKI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WxYDb54pg7Zq1hE7ojnRHf9cI07BmxJYkuUisZdB7Hwy5vw4HoRQfNTKJtyH0Ndu1eO2Y-FSLG1xLhyu4s9BdKhHtvDXQoGXtvd4h94oeOQcpjB8TiH22yfQ5iXTix4AjudLgG1hJpZ8ASHsSEMoOApJGV6SQfpo3RA-am1VYwoZ5tLfx6tgXROcHC5AFDvbdWPjw5h2YiNDOLC3Oig8p5bIjBXYSGAc097YAAosLlIIqdvsTZAH9ubC2Tf8-W0Lrb1vRe28p0uw7WFBFevLS71HJhJYY-ktjspseCfm-AAn0noByeO7Tw78Xtec8gCZ3pVnHYOem8J+Xy3iebcU6bc7mnzVF3O7O08NdFFcrOAUtAcO4ffsG6N+3uPgvu+V6q2LhcOJKTUjr6nv6+yt9N0EB7YhIg2BHODcV3XEfJutFDDGWADRPAl7N-H1fIuq8b9Tfv3fEUkoIcbxrESl7k1xf073Bx72Twpz-xGBEnTztzOg6i6gSRRGcmIFtCMCLU936zEHsDPDALLwgLX2rwQPOmQN32ayrjl1bUok3gEEVwkCRUkA7jZx33UB-SDyQBDyxE9GW1LzfxJw-3XxT1OjIOeiO0oNaxHxRxADd3uUDhOS7VOw4ImETm4NTj4NfxX0EKT0-xTxgOigrEH3AEzTEISRtU9lPjOU1w9ncVGXGQIIEKt17zB1MKQPENcIGg5i6UfT5iMD-l-EcO0OcKgPCgSkilgIAOMLSUxmRlllbWhDQLkLPEDmn3Dk0PAIryEJIM+gxnSCxniKl1UW4wD32WcHYBIE13OQliCItx0JcMWRKJ-XgL32z1HyQBo1fSMhRWqPFgBBUMAmD1dh4J13G1+3wFHCN1aFQlqK73qNCPr2pwkLk1bUsAUxSTuicEA39wGLUKBQ0I70IKyN0OEL725AH2WPkzcEUxFmU22P6OJU4KTn2N4MOKcJ7wK22CAA)

An AWS multi-tenant SaaS architecture has to answer one question before any other: which tenants share infrastructure, and which get their own? This post walks through a serverless design that answers it with two tiers, a pooled tier where most customers share API Gateway, Lambda and DynamoDB, and a silo tier where a premium customer gets a stack of their own. It covers how tenants are onboarded, how isolation is enforced, what it costs you to run, and how to draw it.

## The problem: many customers, one product

A SaaS business wants every customer on one version of the product, deployed by one pipeline, and no customer able to see another's data. Small customers must be cheap to serve; large ones often want stronger separation in the contract. A stack per customer is easy to reason about but costly to run; one shared stack is cheap but makes isolation and noisy neighbours your problem.

## The design at a glance

The diagram has three areas inside one Region ([open the diagram](https://archhy.com/app#d=N4IgLglmA2CmIC4QFkCu1IFoywHYENcwACAZX31OIHtdiBBAdSoGdYAnANw7hZYWIAHatTgATYoQksI0asUgcWIADQho+AJ7VUYACIR2sAMaRaiEABkASqpABbWGHyJQAczkAjfNGUJQLAAW1ADuAHLUYrAAKpqCsH5g7KiwahAspASCAKIEnuKISSlqbuwQYqQQAF7wCABMAAxqgT4AZgDiZWLW+LJ+rT5sauy90KRgmnAWxnCEdoIQpqhGruBQUwhFsAC+u2q4kQmIANqg5RaobOzKahqesNAW0XiEJJdKdhPxFgCqV3YabS6VYAD0QTRAmkQAGYGhCQuUwIFEABGABsEMCsAgbkCYFRKIaezOYgsMjcuFQggB+HujyQYVgIQULyIxAAFOTcJgqZJBIIAJSfOK1EB-Dg0oH4-wgMEICFQhBogAs8MRyIQ6Mx2Nx0pRhOJIHOSHwIRu6lpDwsTCoAGE5KhSWovqKbfadE6LVLQYg6qq1Iq1WIkaiAKyNZo6vGIACccLUVQAkrgonLMIS4YbjSAjG4IOZbpb6SBrLA8wXwCKLKXy7h5vgjERE6STWbJTppaA5RHIYh-SAEcGNSjlQAObU46MIUeqrMtkBBBuwT13K1IUgtIzSDicRYJDm0TzUBtiCC4NxC51VpAAIR0KYbULUgiXTfnufzdbUR-YUXY40mUUxGoMAcBXLQOx9eoFT7IMQwQZV+yxSdpQAdgxOcLHwBZMEXLcaTpCwNyXbcuD3FgGAABUTYVviQehqPafAcBCLR60bMBmzJTdlzsKIWGMMpBDMOskFtHxfGIe4wBCWA8BoXAjxPM83GIK5d2Mfcl0kaA5FkiRPE0KjE2I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ndu1eO2Y-FSLG1xLhyu4s9BdKhHtvDXQoGXtvd4h94oeOQcpjB8TiH22yfQ5iXTix4AjudLgG1hJpZ8ASHsSEMoOApJGV6SQfpo3RA-am1VYwoZ5tLfx6tgXROcHC5AFDvbdWPjw5h2YiNDOLC3Oig8p5bIjBXYSGAc097YAAosLlIIqdvsTZAH9ubC2Tf8-W0Lrb1vRe28p0uw7WFBFevLS71HJhJYY-ktjspseCfm-AAn0noByeO7Tw78Xtec8gCZ3pVnHYOem8J+Xy3iebcU6bc7mnzVF3O7O08NdFFcrOAUtAcO4ffsG6N+3uPgvu+V6q2LhcOJKTUjr6nv6+yt9N0EB7YhIg2BHODcV3XEfJutFDDGWADRPAl7N-H1fIuq8b9Tfv3fEUkoIcbxrESl7k1xf073Bx72Twpz-xGBEnTztzOg6i6gSRRGcmIFtCMCLU936zEHsDPDALLwgLX2rwQPOmQN32ayrjl1bUok3gEEVwkCRUkA7jZx33UB-SDyQBDyxE9GW1LzfxJw-3XxT1OjIOeiO0oNaxHxRxADd3uUDhOS7VOw4ImETm4NTj4NfxX0EKT0-xTxgOigrEH3AEzTEISRtU9lPjOU1w9ncVGXGQIIEKt17zB1MKQPENcIGg5i6UfT5iMD-l-EcO0OcKgPCgSkilgIAOMLSUxmRlllbWhDQLkLPEDmn3Dk0PAIryEJIM+gxnSCxniKl1UW4wD32WcHYBIE13OQliCItx0JcMWRKJ-XgL32z1HyQBo1fSMhRWqPFgBBUMAmD1dh4J13G1+3wFHCN1aFQlqK73qNCPr2pwkLk1bUsAUxSTuicEA39wGLUKBQ0I70IKyN0OEL725AH2WPkzcEUxFmU22P6OJU4KTn2N4MOKcJ7wK22CAA)):

- **Shared services** that every tenant passes through once, at sign-up.
- **A pooled tier** for the Basic, Standard and Premium plans.
- **A silo tier**, one copy per Platinum tenant.

Each application service is an API in API Gateway backed by Lambda functions, so an order service groups its create, read, update and delete functions behind one API.

### Shared services: onboarding as a product feature

A new tenant signs up and picks a tier. The registration service then runs three steps:

1. It asks user management to create the tenant's first admin in Amazon Cognito. Pooled tenants share one user pool and are separated by groups; a Platinum tenant gets a user pool of its own. The tenant ID and the user's role travel as custom claims in the token.
2. It asks tenant management to store the tenant and associate an API key that matches the tier.
3. For a Platinum tenant only, it asks the provisioning service to start the pipeline that builds that tenant's stack.

The onboarding services call each other through API Gateway, protected by resource policies, so nothing outside the shared services can trigger a provision.

### The pooled tier

A user signs in to the shared user pool and receives a JWT. Every request carries it. A Lambda authorizer checks the token and allows or refuses each route by role, and the functions read and write shared DynamoDB tables where every item's key starts with the tenant ID.

### The silo tier

A Platinum tenant gets the same shape deployed only for them. The code is identical; only the deployment differs.

### Deploying to every tenant

One pipeline builds and tests each merge, then deploys to the pool and every silo, guided by a table mapping tenants to stacks. A new Platinum tenant adds a row, not a branch of code.

## Trade-offs, cost and security

- **Isolation in the pool is only as good as its weakest query.** If one function forgets the tenant filter, data leaks. AWS SaaS Factory's guidance is to back the code with IAM: give each request credentials whose policy only allows DynamoDB keys that begin with that tenant's ID (the `dynamodb:LeadingKeys` condition). Then a bug fails closed.
- **Hot partitions.** Using the bare tenant ID as the partition key puts a busy tenant's items in one partition, where it can slow others. Adding a suffix to the key spreads the load, at the price of reading several keys and merging the results.
- **Traffic shaping, not security.** An API key per tier lets a usage plan throttle a tier. AWS says not to use API keys to authenticate or authorise, and that usage plan limits are best effort, so keep the authorizer and IAM as the real controls.
- **Cost.** A pooled serverless tier costs very little while idle, because you pay per request. Each silo adds its own fixed overhead in pipelines, alarms and things to patch, so price the silo tier to cover operating it, not just its AWS bill.
- **Per-tenant visibility.** In the pool, logs and metrics are shared. Put the tenant ID in every log line and metric dimension from day one; adding it later is painful.

## When not to use this design

- You have a handful of large customers. A silo per customer, with no pool, is simpler.
- A regulator requires each customer in a separate AWS account. The silo here is a separate stack, not a separate account.
- Your workload is long-running or constantly busy, where per-request pricing stops being cheap.
- You cannot yet automate onboarding: without the pipeline, every silo is manual work.

## How to draw it in archhy

1. Open the **Services** drawer, choose the AWS pack and place an AWS Cloud and a Region container.
2. From the **Draw** drawer, drag out three dotted boundaries for shared services, the pool and the silo. A container drawn round services takes in every service wholly inside it.
3. Place API Gateway, Lambda and DynamoDB in each area. Cognito, CodePipeline and CloudWatch have no palette item of their own, so place a Generic Resource for each and name it clearly; their official AWS icons are not in the palette.
4. Connect them with rails and label each one with what flows ("Request + JWT", "Read and write by tenant ID"). Make provisioning rails dashed so onboarding reads differently from runtime traffic.
5. Use **Align** and **Space evenly** so the pool and silo line up: it shows they share a shape.
6. Download a PNG or SVG from the File menu.

To start from a sentence instead, the AI drawer drafts a diagram with your own Gemini or OpenAI key. Related: [event-driven processing on AWS](https://archhy.com/blog/aws-event-driven-architecture-diagram).

## Frequently asked questions

### What is the difference between the pool and silo models in SaaS?

In the pool model, tenants share the same compute and storage and are separated by a tenant ID. In the silo model, each tenant gets dedicated resources. Many products use both, by tier.

### How do you isolate tenants in a shared DynamoDB table?

Put the tenant ID at the start of every key and give each request IAM credentials that only allow keys with that prefix, using the dynamodb:LeadingKeys condition, so a coding mistake cannot reach another tenant's items.

### Should I use API Gateway API keys to identify tenants?

Use them to apply a usage plan per tier, not for security. Authenticate with Cognito tokens and authorise with a Lambda authorizer or IAM.

### Is serverless a good fit for multi-tenant SaaS?

Often, because idle tenants cost almost nothing and scaling is handled for you. It fits less well for long-running or constantly busy workloads.

*Based on:* This architecture is redrawn and discussed from the description in [Building a Multi-Tenant SaaS Solution Using AWS Serverless Services](https://aws.amazon.com/blogs/apn/building-a-multi-tenant-saas-solution-using-aws-serverless-services/) by Anubhav Sharma and Ujwal Bukka (AWS Partner Network Blog, 26 August 2021). The partitioning and isolation notes draw on [Partitioning Pooled Multi-Tenant SaaS Data with Amazon DynamoDB](https://aws.amazon.com/blogs/apn/partitioning-pooled-multi-tenant-saas-data-with-amazon-dynamodb/) (AWS Partner Network Blog, 2020) and the API Gateway documentation on usage plans. The diagram and the words here are archhy's own.
