Skip to main content
Back to blog

Building a Scalable SaaS MVP on AWS: Architecture Decisions That Matter Early

Architecture guidance for SaaS founders building on AWS — covering multi-tenancy, auth, data isolation, and the decisions that are expensive to change later.

AWSSaaSArchitectureMVPCloud
Building a Scalable SaaS MVP on AWS: Architecture Decisions That Matter Early

The framing of "MVP speed vs. architectural debt" is a false choice more often than not. A few specific architecture decisions made poorly in month one will cost weeks or months of engineering time at month twelve. Other decisions that feel important early turn out not to matter at scale. The skill is knowing which is which.

This guide focuses on the architecture decisions that are genuinely expensive to change after you have customers — not a comprehensive AWS tutorial, but a precise map of where early choices compound.


The Decisions That Are Expensive to Change

Not all architecture is created equal. Some decisions can be reversed or iterated on cheaply as you learn more. Others lock you in, because changing them requires migrating existing data, rewriting core systems, or breaking existing integrations.

The expensive-to-change decisions in a SaaS MVP on AWS:

  • Multi-tenancy model — How you isolate customer data
  • Identity and authentication architecture — How users and tenants are represented in your system
  • Database schema for tenant isolation — Row-level vs. schema-level vs. silo
  • API design for multi-tenancy — How tenant context propagates through your stack
  • IAM and permissions model — How internal service-to-service permissions are structured

Get these right early, or at least make deliberate trade-offs you understand. Everything else — serverless vs. containers, which observability tool you use, how you handle caching — can be changed with far less pain.


Multi-Tenancy Models

Multi-tenancy is the defining architectural challenge of SaaS. The question is not whether to share infrastructure — it is how to isolate tenant data within shared infrastructure.

Row-Level Tenancy (Silo in a Shared Table)

All tenants share the same database and the same tables. A tenant_id column on every row is the only isolation mechanism. The application enforces tenant scoping in every query.

Advantages: Simplest to implement, lowest infrastructure cost, easy to add tenants, no schema migration required per tenant.

Risks: Every query that forgets a WHERE tenant_id = ? clause is a data leak. Cross-tenant data leakage through application bugs is a real risk, not a theoretical one. In regulated industries — healthcare, legal, finance — this model is difficult to defend in a security audit, because isolation depends entirely on application-layer correctness.

When it makes sense: Early-stage B2C or B2SMB SaaS where all tenants have the same data model and the regulatory bar is low. Move toward stronger isolation if you win enterprise customers or enter regulated markets.

Schema-Level Tenancy

Each tenant gets their own database schema within a shared database instance. Queries are schema-scoped, which provides stronger isolation than row-level without the infrastructure overhead of fully separate databases.

Advantages: Stronger isolation than row-level. Schema-level migrations per tenant are possible. Easier to backup, restore, or move individual tenants.

Risks: Schema proliferation — managing hundreds of schemas in a single database instance creates operational complexity. Per-tenant schema migrations become a deployment concern. Connection pooling requires careful handling.

When it makes sense: Mid-market SaaS with a moderate number of tenants (dozens to low hundreds), where per-tenant customization of the data model is a real requirement.

Silo (Database-per-Tenant)

Each tenant gets a dedicated database instance. Full infrastructure isolation.

Advantages: Maximum isolation. Per-tenant backup, restore, and migration. Clean story for enterprise security audits. Eliminates cross-tenant blast radius from application bugs.

Risks: Highest infrastructure cost. Operational complexity of managing many database instances. Adding tenants requires provisioning infrastructure. Harder to run cross-tenant analytics.

When it makes sense: Enterprise SaaS with security-sensitive customers, regulated industry requirements, or tenants that demand infrastructure isolation in their contracts. Also appropriate if tenant data volumes are large and per-tenant performance isolation matters.

The Practical Recommendation for MVPs

Start with row-level tenancy if your market is unregulated and you need speed. Design your queries from day one with a tenant_id parameter that cannot be omitted — enforce this at the ORM or query builder level, not through code convention. Use database row-level security (RLS) in PostgreSQL as a defense-in-depth layer.

If you are building for healthcare, legal, or finance from the start, the row-level model will create problems at the first enterprise security review. Schema or silo isolation is worth the additional setup cost.


Authentication Architecture

Authentication is the second decision that is painful to change after launch. The choice of auth provider and the design of your user and tenant identity model will affect every part of your application.

Amazon Cognito

Cognito is the natural AWS-native choice. It integrates with other AWS services, supports user pools and identity pools, and has a reasonable free tier.

Where Cognito works well: Applications that are deeply integrated with AWS services, where you need IAM role federation for fine-grained AWS resource access. Also reasonable for teams that want to stay within a single vendor.

Where Cognito creates friction: The developer experience for customization — custom authentication flows, custom token claims, flexible user attributes — is more complex than alternatives. The admin API is verbose. Multi-tenancy representation in Cognito (one User Pool per tenant vs. groups vs. custom attributes) requires deliberate design.

Auth0 / Okta

More developer-friendly API, better customization, native multi-tenancy support through Organizations. Higher per-MAU cost at scale, vendor lock-in considerations.

Where it makes sense: Teams that need to move quickly on auth, products with complex SSO requirements (enterprise SAML/OIDC), or where the developer experience of the auth layer matters for velocity.

Building on JWTs with Your Own Identity Layer

Rolling your own auth is almost never the right call for an MVP. The edge cases — token rotation, session invalidation, MFA, account recovery — consume engineering time that should go toward product. Use a managed auth provider and invest that time elsewhere.

Tenant Representation in Your Identity Model

Regardless of which auth provider you use, you need a clear model for how users and tenants are represented. The common patterns:

  • Tenant in JWT claims — The tenant ID is embedded as a custom claim in the auth token. The API reads tenant context from the token on every request. Simple, but the token becomes the source of truth for authorization.
  • Tenant in the request context — The API resolves tenant context from the subdomain, request header, or a separate lookup on the authenticated user ID. More flexible, slightly more complex.

Design this model before you write your first API handler. Retrofitting tenant context into an API that was not designed with it is painful.


Data Isolation and Security Implications

The multi-tenancy model you choose has direct security implications beyond data leakage risk.

Blast radius: If a security vulnerability allows arbitrary data access, how much data is exposed? Row-level isolation means all tenant data in the database is potentially in scope. Silo isolation limits exposure to the compromised tenant's database.

Encryption: AWS RDS supports encryption at rest per instance. With silo isolation, you can use per-tenant KMS keys — a meaningful isolation enhancement for security-conscious tenants. With row-level or schema isolation in a shared database, all tenants share the same encryption key.

Backup and restore isolation: With silo isolation, restoring one tenant's data does not require touching others. With shared databases, point-in-time restore affects all tenants.

Compliance: SOC 2, HIPAA, and enterprise security frameworks will ask how you isolate customer data. "Row-level isolation enforced by application logic" is an auditable answer — but it requires demonstrating that the application-layer controls are reliable and tested. Infrastructure-level isolation is a simpler story to tell.


API Design for Multi-Tenant Products

Every API endpoint in a multi-tenant system needs to operate in tenant scope. There are two common patterns for expressing that scope:

Subdomain-based routingtenant-a.yoursaas.com and tenant-b.yoursaas.com route to the same API, which resolves tenant context from the subdomain. Clean, intuitive for users, maps naturally to custom domain support.

Header or path-based routingapi.yoursaas.com/v1/resources with tenant context in a header (X-Tenant-ID) or path prefix (/tenants/{tenant_id}/resources). More explicit, easier to work with in API testing, but less natural for user-facing endpoints.

Whichever pattern you choose, the principle is the same: tenant context is resolved once at the entry point of the request and propagated through the call chain as a first-class parameter. It is not looked up piecemeal in individual service methods.


Cost Optimization Early: Serverless vs. Containers

For most SaaS MVPs on AWS, the right compute answer is Lambda or ECS Fargate — not EC2 instances that you manage directly.

Lambda is appropriate when: request patterns are bursty and unpredictable, cold start latency is acceptable for the use case, and functions are small and stateless. Cost scales directly with usage — you pay nothing when idle.

Fargate is appropriate when: you have long-running workloads, consistent baseline traffic that would make Lambda always-warm overhead wasteful, or applications that are not naturally decomposed into function-sized units.

The cost optimization that matters most early is not serverless vs. containers — it is avoiding over-provisioning. An ECS service with auto-scaling minimum of 1 task and a Lambda with 128MB memory allocation will both be inexpensive at MVP scale. The mistake is provisioning for projected scale before you have validated usage patterns.

Services That Scale Well

  • S3 — Object storage scales infinitely without management overhead
  • CloudFront — CDN with no fleet to manage
  • SQS / SNS — Message queuing and pub/sub with zero infrastructure
  • DynamoDB (on-demand billing) — Scales to zero, pays per request
  • Lambda — No idle cost, automatic scaling

Services That Create Problems at Scale

  • RDS — Does not scale horizontally for write-heavy workloads. Read replicas help for read scaling. Vertical scaling has limits and requires downtime. Plan your database access patterns early.
  • ElastiCache — Cluster management, failover, and connection pooling add operational overhead. Consider whether a managed cache is necessary at MVP scale.
  • Single-region architecture — Not a service, but a constraint. Cross-region replication and multi-region active-active are significant architectural commitments. Defer them until you have an actual customer requirement, but design with region-awareness from the start.

CI/CD From Day One

CI/CD is not a luxury for later. The cost of shipping broken code to a production SaaS application with paying customers is high. The cost of setting up a basic CI/CD pipeline on day one is low.

Minimum viable CI/CD for a SaaS MVP:

  1. GitHub Actions or AWS CodePipeline — Automated build and test on every pull request
  2. Staging environment — A separate AWS environment that mirrors production, deployed to before production
  3. Infrastructure as code — CloudFormation, CDK, or Terraform from the start. Clicking through the AWS console to configure production infrastructure is not repeatable and not auditable.
  4. Secrets management — AWS Secrets Manager or Parameter Store for all credentials. No secrets in environment variables committed to source control.

If you are launching with a team of two, this setup takes a day. If you defer it until you have a team of ten and a production system with customers, retrofitting it costs far more than that.


What NOT to Build Custom in an MVP

The list of things SaaS founders should not build from scratch at MVP stage:

  • Authentication and user management — Use Cognito, Auth0, or Clerk
  • Email delivery — Use SES with a transactional email service layer (Postmark, Resend, or similar)
  • Payment processing — Use Stripe. The alternative is months of work and PCI compliance scope
  • Full-text search — Use OpenSearch or Algolia rather than implementing search logic against a relational database
  • Feature flags — Use LaunchDarkly or AWS AppConfig rather than hardcoded flags in your codebase
  • Analytics and event tracking — Use a managed product analytics tool. Building your own event pipeline is a distraction at MVP stage.

The principle behind this list is not that these things are technically difficult. Some of them are not. It is that they are not your product. Your product is the workflow, the data model, and the user experience that solves your customer's specific problem. Every hour spent building an authentication system is an hour not spent on that.


Starting Strong

The SaaS MVPs that scale well are not the ones that made the most sophisticated technical choices early — they are the ones that made the right trade-offs. Row-level tenancy with disciplined application-layer enforcement is the right call for some products. Silo isolation is the right call for others. The mistake is not picking either of those; it is not thinking about it at all.

The same principle applies to auth, API design, and CI/CD: these decisions do not have to be perfect, but they have to be deliberate.

If you are building a SaaS product and want a structured conversation about the architecture decisions that will matter at your specific stage and in your specific market, an architecture review is a focused engagement to work through exactly these questions. Our cloud architecture practice and SaaS development work covers this territory across a range of product types and regulatory contexts.

Architecture Review