# PostgreSQL DBaaS Calculator
I recently wanted to start a side-project using the serverless application hosting service
Zeit Now Vercel.
Under “how do I use databases” in their FAQ, they recommend cloud databases such as Azure CosmosDB, MongoDB Atlas, Firebase, and Google Cloud SQL.
Personally, I want a relational database like PostgreSQL, and nowadays there are lots of options.
While it’s certainly possible to self-host a PostgreSQL DB on a DigitalOcean droplet for $5/month, that doesn’t mean it’s a good idea. In my opinion, outsourcing DB maintenance to a vendor is a no-brainer as long as your hosting bill is in the triple-digits. Most side-projects will never get that far.
This page is an effort to compare DBaaS vendors for hosting a PostgreSQL database for my personal projects. My focus is on these smaller side-project type deployments ($100/month or so), not giant enterprise-level clusters. There are links to the pricing pages too (💰). If you find an error or have a suggestion, please open an issue or better yet submit a merge request. Or, leave a comment in this HN discussion. Thanks!
# Vendor Overview
I have used RDS for PostgreSQL at work and I have no complaints. There are several instance types that have two vCPUs and vary by memory, but as soon as you need more CPU, you move to db.t3.xlarge. Amazon’s T3 DB instance types use some kind of CPU bursting and CPU credit system, and yet DBaaS was supposed to be easier somehow… The calculator assumes a 1-year commitment of reserved instances with no upfront payment in US West (Oregon). 💰
Lightsail is Amazon’s simplified version of AWS. Although at launch only MySQL was available, they quietly added managed PostgreSQL at some point in early 2019 (I think). It seems that the prices are very similar to what you can get with a 1-year reserved RDS. Lightsail seems like a good choice early in a project if you’re leaning towards AWS but you’re not ready for a 1-year reservation. 💰
Azure does not break out their pricing for memory; you pick the machine class based on CPU and pay for storage. This calculator starts applying the 1-year 39% discount once you select General Purpose Compute Gen 5. 💰
DO is a relative newcomer to the PostgreSQL hosting world. While they have their own data centers (presumably), their pricing resembles other tier-2 vendors. Bear in mind that DigitalOcean’s outbound DB bandwidth is free until December 2020. 💰
ElephantSQL provides managed PostgreSQL hosting in a variety of other cloud platforms’ data centers, including AWS, Softlayer, GCP, and Azure. Here’s another vendor that doesn’t break out CPU and I wish they would at least mention it on the plan page. As a plus, their service level plan names are downright adorable. Only the dedicated plans are included in this calculator, but they also offer shared instance plans at the $5, $10, and $19/month level too. 💰
Google’s cloud offering is month-to-month, and they offer a discount for sustained use. You are not tied to specific instance types; instead CPU, storage, and memory are all adjustable. This makes a great deal of sense to me. On the other hand, I suspect the Google pricing is inflated below because I can’t figure out how committed use discounts work. 💰
Heroku is one of the few vendors with an OK free tier for Postgres. Unlike Azure, Heroku has pricing tiers based on memory, storage, and number of connections. CPU is not visible or configurable, so the calculator below may not tell the whole story. There is a point at the 4 GB memory and 64 GB storage mark where Heroku is almost the best choice at $50/month. Otherwise Heroku is fairly expensive, per their reputation. 💰
Render is a young PaaS going toe-to-to with Heroku. They won Startup Battlefield at Disrupt SF 2019, if that means anything to you. Although their “Starter” size is tiny, maybe 256 MB of RAM and 1 GB of storage is enough for your project. For $7/month, it’s hard to beat. Since you can also host services on their platform (also starting at $7/month), you could spin up a Graphile or Hasura backend for $14. What a time to be alive. 💰
ScaleGrid hosts a variety of databases (Mongo, Redis, MySQL, PostgreSQL) on top of a variety of clouds (AWS, Azure, DO). They offer unmatched admin control and SSH root access. This calculator is using their AWS Standalone pricing for dedicated hosting. 💰
Here’s a calculator to give a rough estimate of monthly costs for each major DBaaS vendor. This does not factor in cost of network egress, backups or replicas; it’s just for basic apples-to-apples between these services.
How Far Does That Dollar Go?
There are two clear tiers of DBaaS providers: those who run PostgreSQL on their own metal (AWS, Azure, DO, GCP) and those who rent from the first group. Azure’s 1-year commitment discount really gives it an edge at the high end. Google seems to do well when you max out memory and leave everything else low. DigitalOcean’s sweet spot is their 4 CPU / 8 GB memory / 115 GB storage product.
The smaller vendors cost more but provide value in other ways, such better tooling or support. Especially at the $100/month range that may really be worth it. I just can’t understand why there’s a conspicuous hole in Heroku’s lineup between Standard 0 and 2. Standard 1 must have had 6 GB memory and 128 GB storage for $100. That would have rocked.
# Further Reading
# Other Providers
- IBM Cloud Databases for PostgreSQL: not included in the calculator because the pricing model is so different, but it starts at 5GB of Disk and 1GB of RAM for $15.80/month.
- Aiven for PostgreSQL: similar concept to ScaleGrid
- 2019-03-31: initial version
- 2019-04-01: IBM Cloud
- 2019-10-25: add budget calculator
- 2020-03-08: adjust presets, added ScaleGrid, updated AWS and Azure prices
- 2020-06-28: added Amazon Lightsail
- 2020-10-06: added Render