Multi-tenant

Serverless backends for SaaS products

Multi-tenant APIs, background jobs, and integrations that scale with your customers and cost little while you find product-market fit.

Context

Why serverless

Why the workload fits AWS serverless — and where the real difficulty lies.

SaaS products have unpredictable, growing, and uneven load: a few large tenants, many small ones, and traffic that follows business hours across time zones. Serverless matches that shape — you pay per request, scale per tenant automatically, and avoid running idle capacity for customers you don't have yet.

The hard parts are not compute. They are tenant isolation, per-tenant limits and costs, data modeling for both per-tenant and cross-tenant queries, and integrations with the rest of your customers' stack.

Typical challenges

  • Keeping one tenant's data and load from affecting another
  • Authorizing every request against tenant, user, and role
  • Knowing what each tenant costs to serve
  • Background work (imports, exports, reports) that must not slow the API
  • Webhooks and integrations that fail in ways you don't control
Architecture

Reference architecture

The building blocks we usually combine — adapted to each system's constraints.

  1. Step 01

    Identity and tenancy

    Amazon Cognito (or your IdP) issues tokens carrying tenant and role claims; API Gateway authorizers and a shared policy layer enforce them on every route.

  2. Step 02

    API layer

    API Gateway HTTP APIs in front of focused Lambda functions, with per-tenant throttling through usage plans or application-level rate limits.

  3. Step 03

    Data

    DynamoDB with tenant-prefixed keys and IAM leading-key conditions for isolation, or Aurora Serverless with row-level security where relational queries dominate.

  4. Step 04

    Async work and integrations

    EventBridge for domain events, SQS for buffered jobs, Step Functions for long-running imports, and dedicated queues per integration so one failing partner doesn't block others.

  5. Step 05

    Visibility

    Tenant id in every log line, metric dimension, and trace — so you can answer "what did this customer experience" and "what does this customer cost".

Engagement

How we usually help

A typical shape for this kind of work — every engagement is scoped to your situation.

Typical engagement

  • A one-week architecture review of the current backend or a design workshop for a new one
  • A walking skeleton: auth, one API, one table, pipeline, and observability, deployed to dev and prod
  • Feature delivery alongside your engineers, with tenant isolation tests in CI
  • Cost and usage dashboards per tenant

Design considerations

  • Pool vs. silo isolation per tier: most tenants pooled, the largest optionally siloed
  • Lambda reserved concurrency to protect critical paths from bursts
  • DynamoDB hot-key risks for very large tenants
Related

Services and guides

The services and guides most relevant to this workload.

Let's make your serverless workload simpler, safer, and cheaper.

Start with a free 30-minute intro call with a serverless engineer.

Book a consultation