# One large RDS instance for multiple tenants or multiple smaller instances per-tenant?

**URL:** <https://awshq.com/t/one-large-rds-instance-for-multiple-tenants-or-multiple-smaller-instances-per-tenant/16791>\
**Category:** Databases\
**Tags:** rds\
**Created:** [June 6, 2023, 9:36pm UTC](https://awshq.com/t/one-large-rds-instance-for-multiple-tenants-or-multiple-smaller-instances-per-tenant/16791 "2023-06-06T21:36:41Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![pribnow](https://awshq.com/letter_avatar_proxy/v4/letter/p/e47c2d/32.png) [@pribnow](https://awshq.com/u/pribnow)\
**Post date:** [June 6, 2023, 9:36pm UTC](https://awshq.com/t/one-large-rds-instance-for-multiple-tenants-or-multiple-smaller-instances-per-tenant/16791/1 "2023-06-06T21:36:41Z")

</div>

The company I work for is growing but some of the customers we’re on-boarding don’t have equivalent utilization of the application

Currently we have several tenants per a few large instances which has worked well for us for a few years. An argument can be made that these instances are over-provisioned in terms of their compute and memory capacity

As we onboard these ‘smaller’ clients, I’ve got this notion in my head that fewer tenants on smaller instances will help us be able to scale better as the customers themselves grow, limit the effects of instance issues to smaller groups of tenants (i.e. today if we have some kind of outage on one of the larger instances we’re more likely to anger multiple customers as opposed to a single instance going down and only affecting that one customer), and possibly optimize costs a little better (though I’ve ran the numbers if we have 9 t4g.medium instances it’s cheaper to have 9 tenants on one m4g.2xlarge instance for example so that may not be the case)

I’ve read the whitepaper on AWS storage strategies for mutli-tenancy in RDS but I"m curious to hear from others who work in SaaS companies what y’all do? Does multi-tenancy scale well when you’re having to onboard many customers for which their usage is not well understood in advance?

I appreciate any feedback, thanks!

---

<div class="post-metadata">

**Author:** ![alter3d](https://awshq.com/letter_avatar_proxy/v4/letter/a/e19b73/32.png) [@alter3d](https://awshq.com/u/alter3d)\
**Post date:** [June 6, 2023, 10:02pm UTC](https://awshq.com/t/one-large-rds-instance-for-multiple-tenants-or-multiple-smaller-instances-per-tenant/16791/2 "2023-06-06T22:02:49Z")

</div>

We do one instance per tenant but that’s for ease of regulatory compliance more than anything else.

We are looking at a shared-database model as a future possibility, but we would take a hybrid approach like sharding. Have 10 big instances, and 1/10th of the customers go onto each, with some mechanism to discover who goes where. You retain a higher level of impact mitigation while not having massive infrastructure sprawl.

---

<div class="post-metadata">

**Author:** ![Papina](https://awshq.com/letter_avatar_proxy/v4/letter/p/f07891/32.png) [@Papina](https://awshq.com/u/Papina)\
**Post date:** [June 6, 2023, 10:52pm UTC](https://awshq.com/t/one-large-rds-instance-for-multiple-tenants-or-multiple-smaller-instances-per-tenant/16791/3 "2023-06-06T22:52:32Z")

</div>

Compute (instances) generally costs more than storage (databases), but since you are using graviton, purchase lots of small RI, and you can reduce the cost of both even if you decide to change, as long you match instance class (eg stick to m6g and upgrade your m4g)

Prob don’t use t series for production, it uses CPU credits, so one tenant can burn it up affecting all others on the same instance

---

<div class="post-metadata">

**Author:** ![g4d2l4](https://awshq.com/letter_avatar_proxy/v4/letter/g/b9e5f3/32.png) [@g4d2l4](https://awshq.com/u/g4d2l4)\
**Post date:** [June 6, 2023, 11:23pm UTC](https://awshq.com/t/one-large-rds-instance-for-multiple-tenants-or-multiple-smaller-instances-per-tenant/16791/4 "2023-06-06T23:23:27Z")

</div>

Are we talking ec2 instances or rds instances? You reference compute & memory, instances sizes but then mention rds.

---

<div class="post-metadata">

**Author:** ![albahari](https://awshq.com/letter_avatar_proxy/v4/letter/a/f0a364/32.png) [@albahari](https://awshq.com/u/albahari)\
**Post date:** [June 7, 2023, 12:38am UTC](https://awshq.com/t/one-large-rds-instance-for-multiple-tenants-or-multiple-smaller-instances-per-tenant/16791/5 "2023-06-07T00:38:30Z")

</div>

The trade off calculation should go beyond the instance cost. You have to also consider the added costs of monitoring and maintaining many small instances vs a few large ones.

---

<div class="post-metadata">

**Author:** ![Traditional\_Donut908](https://awshq.com/letter_avatar_proxy/v4/letter/t/cc9497/32.png) [@Traditional\_Donut908](https://awshq.com/u/Traditional_Donut908)\
**Post date:** [June 7, 2023, 12:41am UTC](https://awshq.com/t/one-large-rds-instance-for-multiple-tenants-or-multiple-smaller-instances-per-tenant/16791/6 "2023-06-07T00:41:19Z")

</div>

Have you explored the possibility of using Aurora serveless? That would help maximize the utilization of whatever compute you purchase.

---

<div class="post-metadata">

**Author:** ![ExpertIAmNot](https://awshq.com/letter_avatar_proxy/v4/letter/e/59ef9b/32.png) [@ExpertIAmNot](https://awshq.com/u/ExpertIAmNot)\
**Post date:** [June 7, 2023, 12:53am UTC](https://awshq.com/t/one-large-rds-instance-for-multiple-tenants-or-multiple-smaller-instances-per-tenant/16791/7 "2023-06-07T00:53:40Z")

</div>

There is an interesting SaaS Factory reference solution that supports multi tenancy in both a shared “pool” and also dedicated silo “single tenant” modes. The interesting part is that it allows both modes to be deployed according to the requirements of a given tenant and it’s regulatory and compliance requirements.

It’s interesting to dig around in the docs and code and there are lots of paths to other white papers and such in there too.

[https://aws.amazon.com/blogs/apn/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/)

---

<div class="post-metadata">

**Author:** ![joelrwilliams1](https://awshq.com/letter_avatar_proxy/v4/letter/j/5fc32e/32.png) [@joelrwilliams1](https://awshq.com/u/joelrwilliams1)\
**Post date:** [June 7, 2023, 1:28am UTC](https://awshq.com/t/one-large-rds-instance-for-multiple-tenants-or-multiple-smaller-instances-per-tenant/16791/8 "2023-06-07T01:28:29Z")

</div>

We try to group multiple clients per database, giving them their own schema. Obviously larger clients reduce the number of clients we can ‘fit’ on a database.

We’re simply trying to find a happy medium between “all on one database” and “each client has their own instance”

---

<div class="post-metadata">

**Author:** ![baker\_miller](https://awshq.com/letter_avatar_proxy/v4/letter/b/b19c9b/32.png) [@baker\_miller](https://awshq.com/u/baker_miller)\
**Post date:** [June 7, 2023, 1:35am UTC](https://awshq.com/t/one-large-rds-instance-for-multiple-tenants-or-multiple-smaller-instances-per-tenant/16791/9 "2023-06-07T01:35:36Z")

</div>

What kind of data portability are customers entitled to should you or they choose to end the relationship? Are there any potential data residency or regulatory restrictions?

---

<div class="post-metadata">

**Author:** ![dwargo](https://awshq.com/letter_avatar_proxy/v4/letter/d/ce73a5/32.png) [@dwargo](https://awshq.com/u/dwargo)\
**Post date:** [June 7, 2023, 2:02am UTC](https://awshq.com/t/one-large-rds-instance-for-multiple-tenants-or-multiple-smaller-instances-per-tenant/16791/10 "2023-06-07T02:02:32Z")

</div>

Multiple tenants in one instance is really the only way to hit our target price point for smaller tenants, but I worry about tenants stepping on each others performance. You would think more tenants per instance would mean it would all balance out, but I’m not sure if it pans out that way.

If somebody wants direct database access instead of just API access they have to have a separate instances though - the app won’t cartesian five tables because it doesn’t know how joins work, but Bob from accounting who just learned how to link tables in Excel sure will.

I’ll have to find this whitepaper you speak of.

---

<div class="post-metadata">

**Author:** ![teroa](https://awshq.com/letter_avatar_proxy/v4/letter/t/439d5e/32.png) [@teroa](https://awshq.com/u/teroa)\
**Post date:** [June 7, 2023, 4:59am UTC](https://awshq.com/t/one-large-rds-instance-for-multiple-tenants-or-multiple-smaller-instances-per-tenant/16791/11 "2023-06-07T04:59:10Z")

</div>

Like you can read from earlier comments, there is no correct answer for this. There are so many aspects when making these decisions. There is one point is not mentioned yet; security. Regulation reasons mentioned earlier kind of touches the security aspect. Overall you can reduce blast radius by multiple smaller instances.

---

<div class="post-metadata">

**Author:** ![Wide-Answer-2789](https://awshq.com/letter_avatar_proxy/v4/letter/w/db5fbb/32.png) [@Wide-Answer-2789](https://awshq.com/u/Wide-Answer-2789)\
**Post date:** [June 7, 2023, 12:26pm UTC](https://awshq.com/t/one-large-rds-instance-for-multiple-tenants-or-multiple-smaller-instances-per-tenant/16791/12 "2023-06-07T12:26:35Z")

</div>

In aws summit London there is a workshop about exactly that right now, sorry for of topic

---

<div class="post-metadata">

**Author:** ![lorarc](https://awshq.com/letter_avatar_proxy/v4/letter/l/e79b87/32.png) [@lorarc](https://awshq.com/u/lorarc)\
**Post date:** [June 7, 2023, 1:54pm UTC](https://awshq.com/t/one-large-rds-instance-for-multiple-tenants-or-multiple-smaller-instances-per-tenant/16791/13 "2023-06-07T13:54:37Z")

</div>

I assume those are databases for unrelated things or separate installations of some application?

I would say that separate RDS instances have a lot of advantage like tenants not affecting others and having to arrange changes with just one client not all of them. Unless there are very specific things it would be easier to manage it like that. Compliance and backups are also easier to manage.

And if you go one rds per client it would also be good to do one account (under org) per client.

The costs might be a bit higher with separate instances but $50 for a medium instance isn’t really that much. Maybe with SQL Server or Oracle the license costs will be a bigger cost difference.

---

<div class="post-metadata">

**Author:** ![FrmaCertainPOV](https://awshq.com/letter_avatar_proxy/v4/letter/f/b77776/32.png) [@FrmaCertainPOV](https://awshq.com/u/FrmaCertainPOV)\
**Post date:** [June 7, 2023, 2:12pm UTC](https://awshq.com/t/one-large-rds-instance-for-multiple-tenants-or-multiple-smaller-instances-per-tenant/16791/14 "2023-06-07T14:12:35Z")

</div>

What flavor of RDS?

---

<div class="post-metadata">

**Author:** ![pribnow](https://awshq.com/letter_avatar_proxy/v4/letter/p/e47c2d/32.png) [@pribnow](https://awshq.com/u/pribnow)\
**Post date:** [June 7, 2023, 2:59pm UTC](https://awshq.com/t/one-large-rds-instance-for-multiple-tenants-or-multiple-smaller-instances-per-tenant/16791/15 "2023-06-07T14:59:48Z")

</div>

> [@FrmaCertainPOV](#):
>
> What flavor of RDS?

oops good call, we’re using rds mysql

---

<div class="post-metadata">

**Author:** ![TraditionalManbaby](https://awshq.com/letter_avatar_proxy/v4/letter/t/a87d85/32.png) [@TraditionalManbaby](https://awshq.com/u/TraditionalManbaby)\
**Post date:** [June 8, 2023, 12:55am UTC](https://awshq.com/t/one-large-rds-instance-for-multiple-tenants-or-multiple-smaller-instances-per-tenant/16791/16 "2023-06-08T00:55:06Z")

</div>

With multi-tenancy you have to think in terms of what you can and cannot isolate using a service.

RDS would use a database engine, for example PostgreSQL, which supports tables, schemas, databases, to define isolation between your tenants. Despite tenant X in database X and tenant Y in database Y both tenants are using the same RDS hardware with a certain amount of resources.  
If tenant Y decides to throttle your CPU, well tenant X has to experience the pain. If Tenant X causes out of memory on your instance, then tenant Y will have downtime.  
If you can design a way to limit requests per tenant to prevent resource over-utilization this would be mitigated.  
Oracle I believe can limit resource usage per user or tablespace usage for a user (although I don’t have experience with this). Other engines I don’t all believe have this.

Another example you may not think of now, but what if tenant X wants to delete all of their data from your RDS instance and you to prove to them it’s all deleted. Well, if you have recovery objectives you can’t just delete the backups, so you’ll have to tell the customer that you deleted their data but you need to maintain backups for your other customers. That may or not be a compliance issue.

Ultimately it’s a design decision and I have seen both in-use. The “Silo” model is probably best unless you have good isolation practices to prevent the issues mentioned

[RDS multitenancy reference!](https://docs.aws.amazon.com/whitepapers/latest/multi-tenant-saas-storage-strategies/multitenancy-on-rds.html)

---

<div class="post-metadata">

**Author:** ![justin-8](https://awshq.com/letter_avatar_proxy/v4/letter/j/e47c2d/32.png) [@justin-8](https://awshq.com/u/justin-8)\
**Post date:** [June 8, 2023, 3:50am UTC](https://awshq.com/t/one-large-rds-instance-for-multiple-tenants-or-multiple-smaller-instances-per-tenant/16791/17 "2023-06-08T03:50:06Z")

</div>

> [@ExpertIAmNot](#):
>
> There is an interesting SaaS Factory reference solution that supports multi tenancy in both a shared “pool” and also dedicated silo “single tenant” modes. The interesting part is that it allows both modes to be deployed …

Yeah, I’ve worked at a company that followed this model. The control plane was purely multi-tenant to route them to the correct workload but individual customers landed in one of several buckets when it came to dataplane allocation/isolation. Basically free tier, paying customers and customers who had a big enough contract to have dedicated clusters assigned to them.

They’d all log in through the same frontend/portal and it worked quite seamlessly from both customers and operational/infrastructure perspectives.

That blog post goes in to it a little bit; but AWS also has a whitepaper that dives in to the various tenant isolation architectures for SaaS platforms that’s pretty good: [https://d1.awsstatic.com/whitepapers/saas-tenant-isolation-strategies.pdf](https://d1.awsstatic.com/whitepapers/saas-tenant-isolation-strategies.pdf)
