1"use strict";(self.webpackChunkbetalectic_website=self.webpackChunkbetalectic_website||[]).push([["7888"],{3315:function(n,e,t){t.r(e),t.d(e,{assets:function(){return c},contentTitle:function(){return l},default:function(){return h},frontMatter:function(){return a},metadata:function(){return s},toc:function(){return o}});var s=t(8610),i=t(5893),r=t(65);let a={slug:"multi-tenancy-models",title:"From Shared Offices to Skyscrapers: Explaining SaaS Multi-Tenancy Models",authors:["shrey"],image:"/img/blogs/multi_tenancy.jpg"},l="From Shared Offices to Skyscrapers: Explaining SaaS Multi-Tenancy Models",c={authorsImageUrls:[void 0]},o=[{value:"Introduction",id:"introduction",level:3},{value:"<strong>Same AWS Account Multi-Tenancy</strong>",id:"same-aws-account-multi-tenancy",level:2},{value:"<strong>Single-Database Tenancy</strong>",id:"single-database-tenancy",level:3},{value:"<strong>Multi-Database Tenancy</strong>",id:"multi-database-tenancy",level:3},{value:"<strong>Same AWS Account with Multiple AWS Sub-Accounts</strong>",id:"same-aws-account-with-multiple-aws-sub-accounts",level:2},{value:"<strong>Individual AWS Account per Tenant</strong>",id:"individual-aws-account-per-tenant",level:2},{value:"Real-World Analogy for Multi-Tenant SaaS Architectures",id:"real-world-analogy-for-multi-tenant-saas-architectures",level:2},{value:"Shared AWS Account, <strong>Single-Database Tenancy</strong>",id:"shared-aws-account-single-database-tenancy",level:3},{value:"Shared AWS Account, <strong>Multi-Database Tenancy</strong>",id:"shared-aws-account-multi-database-tenancy",level:3},{value:"Single AWS Account with <strong>Multiple Sub-Accounts per Tenant</strong>",id:"single-aws-account-with-multiple-sub-accounts-per-tenant",level:3},{value:"Fully Isolated AWS Account per Tenant",id:"fully-isolated-aws-account-per-tenant",level:3},{value:"Summary Table",id:"summary-table",level:2}];function d(n){let e={blockquote:"blockquote",code:"code",h2:"h2",h3:"h3",hr:"hr",img:"img",li:"li",p:"p",strong:"strong",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",ul:"ul",...(0,r.a)(),...n.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(e.h3,{id:"introduction",children:"Introduction"}),"\n",(0,i.jsx)(e.p,{children:"In a SaaS (Software as a Service) environment, tenant isolation, scalability, cost-efficiency, and security are key architectural concerns. Here are three common approaches to architecting multi-tenant SaaS applications using AWS infrastructure:"}),"\n",(0,i.jsx)(e.hr,{}),"\n",(0,i.jsx)(e.h2,{id:"same-aws-account-multi-tenancy",children:(0,i.jsx)(e.strong,{children:"Same AWS Account Multi-Tenancy"})}),"\n",(0,i.jsxs)(e.p,{children:["This model consolidates all tenant data and infrastructure into a ",(0,i.jsx)(e.strong,{children:"single AWS account"}),". It can further be broken down into two tenancy models:"]}),"\n",(0,i.jsx)(e.h3,{id:"single-database-tenancy",children:(0,i.jsx)(e.strong,{children:"Single-Database Tenancy"})}),"\n",(0,i.jsx)(e.p,{children:(0,i.jsx)(e.strong,{children:"Overview:"})}),"\n",(0,i.jsxs)(e.p,{children:["All tenants share the same database and schema. Tenant data is typically separated using a ",(0,i.jsx)(e.code,{children:"tenant_id"})," column."]}),"\n",(0,i.jsx)(e.p,{children:(0,i.jsx)(e.strong,{children:"Pros:"})}),"\n",(0,i.jsxs)(e.ul,{children:["\n",(0,i.jsxs)(e.li,{children:[(0,i.jsx)(e.strong,{children:"Simpler to manage"})," and cost-effective."]}),"\n",(0,i.jsx)(e.li,{children:"Easier to implement analytics across tenants."}),"\n",(0,i.jsx)(e.li,{children:"High resource utilization efficiency."}),"\n"]}),"\n",(0,i.jsx)(e.p,{children:(0,i.jsx)(e.strong,{children:"Cons:"})}),"\n",(0,i.jsxs)(e.ul,{children:["\n",(0,i.jsxs)(e.li,{children:["Weaker ",(0,i.jsx)(e.strong,{children:"data isolation"}),"\u2014harder to meet compliance or security requirements."]}),"\n",(0,i.jsxs)(e.li,{children:["Risk of ",(0,i.jsx)(e.strong,{children:"noisy neighbor"})," issues (one tenant\u2019s activity affects others)."]}),"\n",(0,i.jsx)(e.li,{children:"Complex data access controls."}),"\n"]}),"\n",(0,i.jsx)(e.p,{children:(0,i.jsx)(e.strong,{children:"Best for:"})}),"\n",(0,i.jsx)(e.p,{children:"Startups, low-complexity SaaS products, or internal tools with limited tenant-specific customization needs."}),"\n",(0,i.jsx)(e.p,{children:(0,i.jsx)(e.strong,{children:"Tenancy Diagram:"})}),"\n",(0,i.jsx)(e.p,{children:(0,i.jsx)(e.img,{alt:"Screenshot 2025-05-26 at 3.00.53\u202FPM.png",src:t(9054).Z+"",width:"1424",height:"934"})}),"\n",(0,i.jsx)(e.hr,{}),"\n",(0,i.jsx)(e.h3,{id:"multi-database-tenancy",children:(0,i.jsx)(e.strong,{children:"Multi-Database Tenancy"})}),"\n",(0,i.jsx)(e.p,{children:(0,i.jsx)(e.strong,{children:"Overview:"})}),"\n",(0,i.jsx)(e.p,{children:"All tenants are in the same AWS account, but each has their own dedicated database instance or schema."}),"\n",(0,i.jsx)(e.p,{children:(0,i.jsx)(e.strong,{children:"Pros:"})}),"\n",(0,i.jsxs)(e.ul,{children:["\n",(0,i.jsxs)(e.li,{children:[(0,i.jsx)(e.strong,{children:"Better isolation"})," of tenant data than single-database tenancy."]}),"\n",(0,i.jsxs)(e.li,{children:["Easier to handle ",(0,i.jsx)(e.strong,{children:"data migrations or customisations"})," per tenant."]}),"\n",(0,i.jsx)(e.li,{children:"Safer for GDPR/data localisation requirements."}),"\n"]}),"\n",(0,i.jsx)(e.p,{children:(0,i.jsx)(e.strong,{children:"Cons:"})}),"\n",(0,i.jsxs)(e.ul,{children:["\n",(0,i.jsx)(e.li,{children:"Still shares the same infrastru
1cture limits of a single AWS account."}),"\n",(0,i.jsxs)(e.li,{children:["Harder to ",(0,i.jsx)(e.strong,{children:"scale operationally"})," as tenant count grows."]}),"\n",(0,i.jsx)(e.li,{children:"Resource constraints or failures can still impact multiple tenants."}),"\n"]}),"\n",(0,i.jsx)(e.p,{children:(0,i.jsx)(e.strong,{children:"Best for:"})}),"\n",(0,i.jsx)(e.p,{children:"SaaS offerings with moderate isolation requirements or mid-sized tenants."}),"\n",(0,i.jsx)(e.p,{children:(0,i.jsx)(e.strong,{children:"Tenancy Diagram:"})}),"\n",(0,i.jsx)(e.p,{children:(0,i.jsx)(e.img,{alt:"Screenshot 2025-05-26 at 3.09.35\u202FPM.png",src:t(5276).Z+"",width:"1736",height:"1330"})}),"\n",(0,i.jsx)(e.hr,{}),"\n",(0,i.jsx)(e.h2,{id:"same-aws-account-with-multiple-aws-sub-accounts",children:(0,i.jsx)(e.strong,{children:"Same AWS Account with Multiple AWS Sub-Accounts"})}),"\n",(0,i.jsx)(e.p,{children:(0,i.jsx)(e.strong,{children:"Overview:"})}),"\n",(0,i.jsxs)(e.p,{children:["This architecture uses a ",(0,i.jsx)(e.strong,{children:"central AWS account"})," for core services (e.g., control plane, shared services, global management) and creates ",(0,i.jsx)(e.strong,{children:"dedicated AWS sub-accounts"})," for each tenant. Each sub-account encapsulates a tenant's infrastructure and resources."]}),"\n",(0,i.jsx)(e.p,{children:(0,i.jsx)(e.strong,{children:"Pros:"})}),"\n",(0,i.jsxs)(e.ul,{children:["\n",(0,i.jsxs)(e.li,{children:["Strong ",(0,i.jsx)(e.strong,{children:"tenant isolation"})," for security and compliance."]}),"\n",(0,i.jsxs)(e.li,{children:["Easier to apply ",(0,i.jsx)(e.strong,{children:"resource quotas"}),", billing tracking, and monitoring per tenant."]}),"\n",(0,i.jsxs)(e.li,{children:["Better ",(0,i.jsx)(e.strong,{children:"blast radius control"}),"\u2014failures in one tenant\u2019s environment do not impact others."]}),"\n",(0,i.jsxs)(e.li,{children:["Clear ",(0,i.jsx)(e.strong,{children:"cost attribution"})," per tenant."]}),"\n"]}),"\n",(0,i.jsx)(e.p,{children:(0,i.jsx)(e.strong,{children:"Cons:"})}),"\n",(0,i.jsxs)(e.ul,{children:["\n",(0,i.jsxs)(e.li,{children:["Slightly higher ",(0,i.jsx)(e.strong,{children:"operational complexity"})," (account provisioning, cross-account access)."]}),"\n",(0,i.jsxs)(e.li,{children:[(0,i.jsx)(e.strong,{children:"Increased cost"})," for control infrastructure replication."]}),"\n",(0,i.jsxs)(e.li,{children:["Requires ",(0,i.jsx)(e.strong,{children:"centralised orchestration"})," and tooling for deployments, logging, etc."]}),"\n"]}),"\n",(0,i.jsx)(e.p,{children:(0,i.jsx)(e.strong,{children:"Best for:"})}),"\n",(0,i.jsx)(e.p,{children:"Enterprise SaaS platforms that require strong isolation, customisations per tenant, or compliance with strict regulatory frameworks."}),"\n",(0,i.jsx)(e.p,{children:(0,i.jsx)(e.strong,{children:"Tenancy Diagram:"})}),"\n",(0,i.jsx)(e.p,{children:(0,i.jsx)(e.img,{alt:"Screenshot 2025-05-26 at 2.56.01\u202FPM.png",src:t(4658).Z+"",width:"654",height:"1182"})}),"\n",(0,i.jsx)(e.hr,{}),"\n",(0,i.jsx)(e.h2,{id:"individual-aws-account-per-tenant",children:(0,i.jsx)(e.strong,{children:"Individual AWS Account per Tenant"})}),"\n",(0,i.jsx)(e.p,{children:(0,i.jsx)(e.strong,{children:"Overview:"})}),"\n",(0,i.jsxs)(e.p,{children:["Each tenant gets a ",(0,i.jsx)(e.strong,{children:"completely separate AWS account"}),", with fully isolated infrastructure and services. Often paired with AWS Organizations and Control Tower."]}),"\n",(0,i.jsx)(e.p,{children:(0,i.jsx)(e.strong,{children:"Pros:"})}),"\n",(0,i.jsxs)(e.ul,{children:["\n",(0,i.jsxs)(e.li,{children:[(0,i.jsx)(e.strong,{children:"Maximum isolation"})," and security."]}),"\n",(0,i.jsx)(e.li,{children:"Independent scaling and cost tracking per tenant."}),"\n",(0,i.jsxs)(e.li,{children:["Ideal for ",(0,i.jsx)(e.strong,{children:"white-label solutions"})," or tenants needing full customization."]}),"\n"]}),"\n",(0,i.jsx)(e.p,{children:(0,i.jsx)(e.strong,{children:"Cons:"})}),"\n",(0,i.jsxs)(e.ul,{children:["\n",(0,i.jsxs)(e.li,{children:[(0,i.jsx)(e.strong,{children:"High overhead"})," for account creation, management, and automation."]}),"\n",(0,i.jsx)(e.li,{children:"Harder to implement centralized monitoring and control."}),"\n",(0,i.jsx)(e.li,{children:"Costly for small-scale tenants."}),"\n"]}),"\n",(0,i.jsx)(e.p,{children:(0,i.jsx)(e.strong,{children:"Best for:"})}),"\n",(0,i.jsx)(e.p,{children:"High-paying enterprise customers needing full-stack control or regulatory-driven segmentation."}),"\n",(0,i.jsx)(e.h2,{id:"real-world-analogy-for-multi-tenant-saas-architectures",children:"Real-World Analogy for Multi-Tenant SaaS Architectures"}),"\n",(0,i.jsxs)(e.p,{children:["To simplify and communicate different ",(0,i.jsx)(e.strong,{children:"SaaS multi-tenancy deployment models"}),", we can use a relatable analogy of ",(0,i.jsx)(e.strong,{children:"office buildings and workplace setups"}),"."]}),"\n",(0,i.jsxs)(e.h3,{id:"shared-aws-account-single-database-tenancy",children:["Shared AWS Account, ",(0,i.jsx)(e.strong,{children:"Single-
1Database Tenancy"})]}),"\n",(0,i.jsxs)(e.blockquote,{children:["\n",(0,i.jsx)(e.p,{children:"Shared Office Space with One Big Room and One Entrance"}),"\n"]}),"\n",(0,i.jsxs)(e.ul,{children:["\n",(0,i.jsxs)(e.li,{children:[(0,i.jsx)(e.strong,{children:"All tenants (clients)"})," share the same application infrastructure and ",(0,i.jsx)(e.strong,{children:"a single database"}),"."]}),"\n",(0,i.jsxs)(e.li,{children:["Data separation is enforced ",(0,i.jsx)(e.strong,{children:"logically"})," (e.g., using tenant IDs in rows)."]}),"\n",(0,i.jsxs)(e.li,{children:["Minimal overhead, easy to manage, ",(0,i.jsx)(e.strong,{children:"but least isolated"}),"."]}),"\n"]}),"\n",(0,i.jsxs)(e.p,{children:[(0,i.jsx)(e.strong,{children:"Analogy"}),":"]}),"\n",(0,i.jsxs)(e.p,{children:["Multiple companies operate in a ",(0,i.jsx)(e.strong,{children:"shared coworking space"})," on one floor, using the ",(0,i.jsx)(e.strong,{children:"same reception, same desks, and same conference rooms"}),". Everyone enters through the ",(0,i.jsx)(e.strong,{children:"same front door"}),". Privacy is limited to desk partitions."]}),"\n",(0,i.jsx)(e.hr,{}),"\n",(0,i.jsxs)(e.h3,{id:"shared-aws-account-multi-database-tenancy",children:["Shared AWS Account, ",(0,i.jsx)(e.strong,{children:"Multi-Database Tenancy"})]}),"\n",(0,i.jsxs)(e.blockquote,{children:["\n",(0,i.jsx)(e.p,{children:"Shared Office Space with Separate Entrances and Individual Rooms"}),"\n"]}),"\n",(0,i.jsxs)(e.ul,{children:["\n",(0,i.jsxs)(e.li,{children:["All tenants use ",(0,i.jsx)(e.strong,{children:"the same application infrastructure"}),", but each tenant has ",(0,i.jsx)(e.strong,{children:"its own database"})," (or schema)."]}),"\n",(0,i.jsxs)(e.li,{children:["Offers better ",(0,i.jsx)(e.strong,{children:"data isolation"})," while still sharing operational resources."]}),"\n",(0,i.jsxs)(e.li,{children:["Still a ",(0,i.jsx)(e.strong,{children:"single AWS account"}),", so resources like ECS/S3 may be reused."]}),"\n"]}),"\n",(0,i.jsxs)(e.p,{children:[(0,i.jsx)(e.strong,{children:"Analogy"}),":"]}),"\n",(0,i.jsxs)(e.p,{children:["Companies still share a ",(0,i.jsx)(e.strong,{children:"building floor"}),", but now ",(0,i.jsx)(e.strong,{children:"each company has its own locked room"}),". They can enter via ",(0,i.jsx)(e.strong,{children:"different doors"}),", though the floor\u2019s utilities (like electricity, internet, etc.) are shared. More secure and better privacy than a single room."]}
1),"\n",(0,i.jsx)(e.hr,{}),"\n",(0,i.jsxs)(e.h3,{id:"single-aws-account-with-multiple-sub-accounts-per-tenant",children:["Single AWS Account with ",(0,i.jsx)(e.strong,{children:"Multiple Sub-Accounts per Tenant"})]}),"\n",(0,i.jsxs)(e.blockquote,{children:["\n",(0,i.jsx)(e.p,{children:"Same Building, Different Floors, with Separate Lifts"}),"\n"]}),"\n",(0,i.jsxs)(e.ul,{children:["\n",(0,i.jsxs)(e.li,{children:["Centralized ",(0,i.jsx)(e.strong,{children:"root or management account"})," with ",(0,i.jsx)(e.strong,{children:"dedicated sub-accounts"})," per tenant."]}),"\n",(0,i.jsx)(e.li,{children:"Central services (like CI/CD or image repo) reside in the management account."}),"\n",(0,i.jsxs)(e.li,{children:["Tenants operate in their own ",(0,i.jsx)(e.strong,{children:"isolated AWS environments"})," with independent IAM, billing, and network scopes."]}),"\n"]}),"\n",(0,i.jsxs)(e.p,{children:[(0,i.jsx)(e.strong,{children:"Analogy"}),":"]}),"\n",(0,i.jsxs)(e.p,{children:["The business now owns a ",(0,i.jsx)(e.strong,{children:"multi-storey building"}),". Each tenant occupies ",(0,i.jsx)(e.strong,{children:"a separate floor"}),", with their ",(0,i.jsx)(e.strong,{children:"own private lift"})," and office design. While the building is the same, they never interfere with one another and have a good level of operational independence."]}),"\n",(0,i.jsx)(e.hr,{}),"\n",(0,i.jsx)(e.h3,{id:"fully-isolated-aws-account-per-tenant",children:"Fully Isolated AWS Account per Tenant"}),"\n",(0,i.jsxs)(e.blockquote,{children:["\n",(0,i.jsx)(e.p,{children:"Each Company Has Its Own Building"}),"\n"]}),"\n",(0,i.jsxs)(e.ul,{children:["\n",(0,i.jsxs)(e.li,{children:["Every tenant has ",(0,i.jsx)(e.strong,{children:"its own AWS account"}),", with full resource and network isolation."]}),"\n",(0,i.jsxs)(e.li,{children:[(0,i.jsx)(e.strong,{children:"Most secure and compliant model"}),", often used in enterprise-grade SaaS or regulated industries (e.g., healthcare, finance)."]}),"\n",(0,i.jsx)(e.li,{children:"Slightly higher operational complexity and cost, but enables the most flexibility."}),"\n"]}),"\n",(0,i.jsxs)(e.p,{children:[(0,i.jsx)(e.strong,{children:"Analogy"}),":"]}),"\n",(0,i.jsxs)(e.p,{children:["Each company owns and operates in ",(0,i.jsx)(e.strong,{children:"a separate building entirely"}),"\u2014with ",(0,i.jsx)(e.strong,{children:"its own reception, security, power, and IT systems"}),". No shared walls, no shared infrastructure. The ",(0,i.jsx)(e.strong,{children:"highest level of control, security, and customization"})," is possible."]}),"\n",(0,i.jsx)(e.hr,{}),"\n",(0,i.jsx)(e.h2,{id:"summary-table",children:"Summary Table"}),"\n",(0,i.jsxs)(e.table,{children:[(0,i.jsx)(e.thead,{children:(0,i.jsxs)(e.tr,{children:[(0,i.jsx)(e.th,{children:"Model"}),(0,i.jsx)(e.th,{children:"Analogy Description"}),(0,i.jsx)(e.th,{children:"Isolation Level"}),(0,i.jsx)(e.th,{children:"Operational Cost"})]})}),(0,i.jsxs)(e.tbody,{children:[(0,i.jsxs)(e.tr,{children:[(0,i.jsx)(e.td,{children:"Shared Account, Single DB"}),(0,i.jsx)(e.td,{children:"Shared room in coworking space"}),(0,i.jsx)(e.td,{children:"\uD83D\uDD34 Low"}),(0,i.jsx)(e.td,{children:"\uD83D\uDFE2 Low"})]}),(0,i.jsxs)(e.tr,{children:[(0,i.jsx)(e.td,{children:"Shared Account, Multi DB"}),(0,i.jsx)(e.td,{children:"Shared office floor with separate rooms"}),(0,i.jsx)(e.td,{children:"\uD83D\uDFE0 Medium"}),(0,i.jsx)(e.td,{children:"\uD83D\uDFE2 Low-Medium"})]}),(0,i.jsxs)(e.tr,{children:[(0,i.jsx)(e.td,{children:"Same Account with Sub-Accounts"}),(0,i.jsx)(e.td,{children:"Multi-floor building with private lifts"}),(0,i.jsx)(e.td,{children:"\uD83D\uDFE1 Medium-High"}),(0,i.jsx)(e.td,{children:"\uD83D\uDFE1 Medium"})]}),(0,i.jsxs)(e.tr,{children:[(0,i.jsx)(e.td,{children:"Fully Isolated AWS Account"}),(0,i.jsx)(e.td,{children:"Separate buildings per tenant"}),(0,i.jsx)(e.td,{children:"\uD83D\uDFE2 Very High"}),(0,i.jsx)(e.td,{children:"\uD83D\uDD34 High"})]})]})]})]})}function h(n={}){let{wrapper:e}={...(0,r.a)(),...n.components};return e?(0,i.jsx)(e,{...n,children:(0,i.jsx)(d,{...n})}):d(n)}},9054:function(n,e,t){t.d(e,{Z:function(){return s}});let s=t.p+"assets/images/multi_tenancy_1-cba806e5f51b28353923d16ee2f170c5.png"},5276:function(n,e,t){t.d(e,{Z:function(){return s}});let s=t.p+"assets/images/multi_tenancy_2-c6b3fa304ea5c3fe7627eb722d893d59.png"},4658:function(n,e,t){t.d(e,{Z:function(){return s}});let s=t.p+"assets/images/multi_tenancy_3-47cb46a2cd601c0aab2b4d21c82902ba.png"},65:function(n,e,t){t.d(e,{Z:function(){return l},a:function(){return a}});var s=t(7294);let i={},r=s.createContext(i);function a(n){let e=s.useContext(r);return s.useMemo(function(){return"function"==typeof n?n(e):{...e,...n}},[e,n])}function l(n){let e;return e=n.disableParentContext?"function"==typeof n.components?n.components(i):n.components||i:a(n.components),s.createElement(r.Provider,{value:e},n.children)}},8610:function(n){n.exports=JSON.parse('{"permalink":"/blog/multi-tenancy-models","source":"@site/blog/2025-06-27-multi-tenancy-model.md","title":"From Shared Offices to Skyscrapers: Explaining SaaS Multi-Tenancy Models","description":"Introduction","date":"2025-06-27T00:00:00.000Z","tags":[],"hasTruncateMarker":true,"authors":[{"name":"Shrey Dhyani","title":"Software Engineer & Avid Reader","page":{"permalink":"/blog/authors/all-sebastien-lorber-articles"},"socials":{"x":"https://x.com/ShreyDhyani","linkedin":"https://www.linkedin.com/in/shrey-dhyani-60a63b157/"},"imageURL":"/img/blogs/AuthorProfile/shrey.jpeg","key":"shrey"}],"frontMatter":{"slug":"multi-tenancy-models","title":"From Shared Offices to Skyscrapers: Explaining SaaS Multi-Tenancy Models","authors":["shrey"],"image":"/img/blogs/multi_tenancy.jpg"},"unlisted":false,"prevItem":{"title":"Universal Deeplink (React Native Bare App)","permalink":"/blog/universal-deeplink"},"nextItem":{"title":"Monitoring Laravel Queued Jobs with Lifecycle Events","permalink":"/blog/monitoring-laravel-queued-jobs"}}')}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.