
Separation at backup for RDS PostgreSQL
Schema per tenant backups
Published Mar 25, 2025
How do you perform per-tenant backups when you have a schema per tenant in RDS Postgresql?
There’s an example in the Backup and recovery in the bridge model section in this blog piece:
Another approach is to export straight to S3 using the aws_s3.query_export_to_s3 function. This is using a select statement, so it’s not an entire schema dump, but you can get more granular with it.
That’s the easy “how”, the practical “how” has a few more considerations because you’re setting up a backup service.
How will I orchestrate backups?
If you have an existing orchestration solution, then using that is great, else something like AWS Step Functions is a nice option.
Your solution should be retrying if things fail, and escalating if backups can’t complete.
What will do the actual backup?
Lambda is good if you can do the backup shorter than 15 minutes, else ECS would be the next one I would look at. Of course, if you have existing compute solutions, use those!
Can I perform backups without impacting other tenants?
You’re doing a dump from a live dataset; this can have a hefty performance impact. Can you use non-peak hours or a regular backup window? What if you can’t complete all backups in the window?
A read replica can be an option to use for backups without hurting production performance.
How do I know things are working well?
Implement some metrics. Basic would be BACKUP_SUCCESS and BACKUP_FAIL. A bit better would be things like BACKUP_TIME, and BACKUP_SIZE. The latter metrics would be good to check the efficiency of your backup service and provide KPIs when you improve it.
Summary
Doing backups per tenant is not trivial when you are sharing a database between multiple tenants. There are performance, cost, and operational impacts, so factor this into your pricing model. And of course, metrics are your friends to see that things are working well and checking the efficiency of your approach!
What do you think? Have you experience in this area? Comment below!
Cheers, Dave