Serverless Multi-Tenant SaaS Architecture on AWS

Edge-cached API with WAF, Cognito tenant identity, a tenant-aware Lambda service, EventBridge-driven async jobs on an SQS queue, an idempotent worker, DynamoDB with Streams, and S3 assets.

Explore diagram

Explore on mobile. Create and edit manually or with AI on a computer.

Serverless multi-tenant SaaS AWS architecture diagram with CloudFront, WAF, Cognito, API Gateway, Lambda, EventBridge, SQS, DynamoDB Streams, and S3Explore diagram

Serverless multi-tenant SaaS AWS architecture diagram with CloudFront, WAF, Cognito, API Gateway, Lambda, EventBridge, SQS, DynamoDB Streams, and S3. Open the image to explore this ready-made diagram.

Overview

Amazon CloudFront and AWS WAF protect the public API before requests reach API Gateway and Amazon Cognito. Tenant-aware Lambda functions process synchronous requests, while EventBridge and Amazon SQS route domain events to background workers. DynamoDB holds tenant state, while DynamoDB Streams invokes a change projector that writes tenant-scoped exports to Amazon S3.

Components

  • Edge + API: CloudFront and WAF front an API Gateway REST surface with tenant-scoped usage plans.
  • Identity: Cognito issues JWTs carrying the tenant claim used for authorization and data partitioning.
  • Async Workflows: EventBridge decouples writes from work; an SQS queue feeds an idempotent worker Lambda. Configure dead-letter redrive as the workload is hardened.
  • Tenant Data: DynamoDB Streams invokes an idempotent change projector that writes tenant-scoped exports to S3 alongside application assets.
  • Operations: The worker owns durable writes so retries stay idempotent and the read model is rebuildable from the stream.

Request Flow

  1. A user hits CloudFront, which forwards API traffic through WAF to API Gateway.
  2. API Gateway authorizes with Cognito and invokes the tenant API Lambda.
  3. The tenant Lambda publishes a domain event to EventBridge.
  4. EventBridge enqueues work; the worker persists tenant state to DynamoDB and writes assets to S3.
  5. DynamoDB Streams invokes the change projector, which writes tenant-scoped exports to S3.

Customize First

  • Choose your tenant isolation model (pool, bridge, or silo) and adjust data partitioning accordingly.
  • Wire the DynamoDB stream to an OpenSearch projection or a metering pipeline as your read path grows.
  • Add a billing webhook handler (e.g. Stripe) and SES for transactional email as separate integrations.

Related AWS guides

Use these practical explanations to compare services, failure boundaries, and operating tradeoffs before adapting the architecture.

Design rationale

Decisions that shape this architecture

1

Carry tenant identity through every boundary

Cognito claims identify the tenant, but API authorization, event payloads, database keys, object prefixes, logs, and metrics must preserve that context consistently.

2

Separate request acceptance from durable work

The API publishes a domain event instead of performing every downstream action synchronously. EventBridge routes the event and SQS provides retryable worker delivery.

3

Choose an explicit tenant-isolation model

A pooled DynamoDB table can scale efficiently, but partition keys and IAM conditions must prevent cross-tenant access. Higher-isolation customers may justify bridge or silo variants.

Before production

Operational checks

Test cross-tenant authorization at the API, worker, table, and object-storage layers.

Make asynchronous writes idempotent and define dead-letter redrive ownership.

Meter usage by tenant without placing billing work in the request path.

Track noisy-neighbor signals such as per-tenant throttling and queue depth.

Scope and tradeoffs

What this diagram does not solve

Serverless does not remove tenancy design

Isolation, quotas, migrations, noisy neighbors, support access, and tenant deletion still require deliberate product and data policies.

The diagram is a backend baseline

Billing, transactional email, search projections, analytics, deployment pipelines, and administrative support flows should be added as distinct integrations when required.

Common questions

Frequently asked questions

How should tenant data be partitioned in DynamoDB?

A common pooled model includes the tenant identifier in partition keys and every access pattern. The exact key design must follow the product queries and isolation requirements.

Why use both EventBridge and SQS?

EventBridge routes domain events to interested destinations. SQS gives a worker durable buffering, backpressure, retry control, and dead-letter handling.

Can this architecture support enterprise tenants?

It can be extended for enterprise requirements, but stronger isolation, audit, networking, key management, and support-access controls may require bridge or silo deployments.

Keep exploring

Explore the library
Secure AWS authentication architecture diagram with Amazon Cognito, API Gateway authorizer, Lambda, and DynamoDB
Getting Startedbasic

Secure Application Authentication with Amazon Cognito

This architecture separates identity verification from application authorization. Cognito authenticates the user, API Gateway validates the presented token, Lambda enforces business rules, and DynamoDB remains behind the application boundary.

Explore the architecture
Event-driven order processing AWS architecture diagram with API Gateway, EventBridge, SQS, Step Functions saga, Lambda services, DynamoDB, and SNS
Event-drivenadvanced

Event-Driven Order Processing Architecture on AWS

This design accepts an order through an authenticated API, publishes a durable domain event, and uses a saga to coordinate payment, inventory, fulfillment, and notification. It separates request latency from business processing while preserving explicit recovery paths.

Explore the architecture
AWS web platform with Route 53, CloudFront, WAF, ALB, multi-AZ web and API fleets, zonal NAT gateways, ElastiCache, and distinct RDS primary, standby, and read replica
Web Applicationadvanced

Production-Grade Highly Available Web Platform on AWS

This reference expands the three-tier baseline with a global edge, separate scaling domains, caching, read scaling, and private egress. Secrets management, backup policies, and observability are important additions to design around the visible application path.

Explore the architecture

Ready-made AWS diagram

Explore this AWS architecture

Open the diagram from this guide and explore how it works. Create and edit manually or with AI on a computer.

Explore diagram