Heroku Database VS AWS RDS
Tags: aws, heroku, database, postgres
Published: 2022-03-11 07:37:07

Database is the heart of almost any real world software system, and when it comes to choosing the right platform to host your database, two of the famous names are AWS RDS and Heroku PostgreSQL.

In this tutorial I briefly compare the key factors of each of these two offerings without going too deep in the technical details, while hopefully keeping it clear enough to be able to draw a conclusion based on these facts. Also I do not include Redis in the comparison as like many of you even I'm not yet convinced that Redis is a database, plus it's totally a separate service in AWS which I'll cover in another post.

To begin with, let's take a look at the different Database offerings the two platforms provide.

## Supported engines

<table>
<thead>
<td>Database</td>
<td>AWS</td>
<td>Heroku</td>
</thead>
<tbody>
<tr>
<td>PostgreSQL</td>
<td>Yes</td>
<td>Yes</td>
</tr>
<tr>
<td>MySQL</td>
<td>Yes</td>
<td>No</td>
</tr>
<tr>
<td>MS Sql Server</td>
<td>Yes</td>
<td>No</td>
</tr>
<tr>
<td>Aurora</td>
<td>Yes</td>
<td>No</td>
</tr>
<tr>
<td>Oracle</td>
<td>Yes</td>
<td>No</td>
</tr>
</tbody>
</table>

**Winner -> AWS**

Considering the fact that Heroku doesn't even support many different database engines, let's just compare the same database engine that is provided by both platforms, yup our lovely elephant DB, PostgreSQL!


![1_eUTK5gvvm8H1_kGR_S6Ncg.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1645575637666/CcPS-MLQt.png)

Again, let's simplify the comparison and start with few side by side comparisons demonstrated in tables.

## Versions

<table>
<thead>
<td>Version</td>
<td>AWS</td>
<td>Heroku</td>
</thead>
<tbody>
<tr>
<td>9.6</td>
<td>Yes (deprecated)</td>
<td>Yes (deprecated)</td>
</tr>
<tr>
<td>10</td>
<td>Yes</td>
<td>Yes (deprecated)</td>
</tr>
<tr>
<td>10</td>
<td>Yes</td>
<td>Yes</td>
</tr>
<tr>
<td>11</td>
<td>Yes</td>
<td>Yes</td>
</tr>
<tr>
<td>12</td>
<td>Yes</td>
<td>Yes</td>
</tr>
<tr>
<td>13</td>
<td>Yes</td>
<td>Yes</td>
</tr>
<tr>
<td>14</td>
<td>Yes</td>
<td>No</td>
</tr>
</tbody>
</table>

**Winner -> AWS**

##Failover

<table>
<thead>
<td>Feature</td>
<td>AWS</td>
<td>Heroku</td>
</thead>
<tbody>
<tr>
<td>Url Change*</td>
<td>No (good -> seamless)</td>
<td>Yes (bad -> restarts applications)</td>
</tr>
<tr>
<td>Supported plans</td>
<td>All</td>
<td>Only Premium, Private and Shield tier plans</td>
</tr>
<tr>
<td>Read only support**</td>
<td>Yes (if more than two AZs selected)</td>
<td>Yes (with extra setup)</td>
</tr>
</tbody>
</table>

*Url change refers to the fact that the URL/endpoint of the database does or does not change after the failover.

**Read only support is about whether the failover/follower instances can be used as read-only databases or not.

**Winner -> AWS**

##Backup
Although you might think you won't need backup and restore functionality that often, you can find yourself restoring production databases in development environments many times. Also, RPO, RTO and in general your [disaster recovery strategies](https://aws.amazon.com/blogs/database/implementing-a-disaster-recovery-strategy-with-amazon-rds/) are directly impacted by the effectiveness and simplicity of the backup/restore functionalities available to you.

<table>
<thead>
<td>Feature</td>
<td>AWS</td>
<td>Heroku</td>
</thead>
<tbody>
<tr>
<td>Point in time recovery</td>
<td>Yes (by default)</td>
<td>Yes (conditionally)</td>
</tr>
<tr>
<td>Supported plans</td>
<td>All</td>
<td>Only Standard, Premium, Private databases tier plans</td>
</tr>
<tr>
<td>Rollback history</td>
<td>7-35 days (no limitations)</td>
<td>4-7 days (depending on your plan)</td>
</tr>
</tbody>
</table>

**Winner -> AWS**

## Pricing
This one can be a bit misleading. Here we're comparing only the price of the service exclusive of the labour and/or the set up and maintenance price. Also the list is not an exhaustive one but it's a good indicator of the actual difference between the two platforms.

<table>
<thead>
<td>Memory size</td>
<td>AWS</td>
<td>Heroku</td>
</thead>
<tbody>
<tr>
<td>4GB</td>
<td>$53.19 - $59.6 (w/w.o multi-AZ storage)</td>
<td>$50 - $350 (based on features)</td>
</tr>
<tr>
<td>8GB</td>
<td>$118.5 - $144.1 (w/w.o multi-AZ storage)</td>
<td>$200 - $750 (based on features)</td>
</tr>
<tr>
<td>16GB*</td>
<td>$277 - $288.2(w/w.o multi-AZ storage)</td>
<td>$400 - $1200 (based on features)</td>
</tr>
</table>

*AWS 16 GB memory was the closest match to Heroku 15 GB memory

It's worth mentioning that all the pricing difference in AWS column is based on the extra pricing for the storage when Multi-AZ option is available, otherwise irrespective of the price and size RDS instances have all the features.

**Winner -> AWS**

## Simplicity of use and operational overhead
This section is more of an analytical experience instead of quantitative comparison.

**Provisioning a database**
Heroku gives you way less options meaning way fewer decisions to be made, and faster progress knowing that lots of the decision Heroku takes for you are already descent decisions. 
On the other hand, AWS gives you heaps of options from deciding the VPC and subnets to setting the security groups, parameter groups and option groups. While this might sound appealing at first, we should consider that it comes at the price of increased complexity, meaning a lot more time to spend, and many more ways to take wrong decisions.

**Backup and Restore**
Heroku has simple options to create backups and restore the databases but again doesn't give you much control even on how long you want to retain the backups. 
AWS on the contrary gives you plenty of options or decision points from a different perspective but again it requires a good understanding of how RDS works and even knowing the fact that your RDS snapshots are stored on S3 can help you better understand the logic behind some behaviours.

**Monitoring**
Heroku provides very limited monitoring options out of the box which can be enough in many cases but as your use cases become complicated they definitely lack many metrics that can help you troubleshoot the system.
AWS on the other hand gives you the ever growing CloudWatch metrics which can help you fine tune even the applications using that database based on the behaviour that becomes clear looking at the extensive metrics available to you. As you can guess, again you have to navigate to different sides of the AWS dashboard to be able to get the metrics you want with the level of details you like, while still some metrics are available on the RDS page with limited options.

On top of all these differences, setting up read-replica instances, failoever and many optimisations on RDS are way more involved than the Heroku's counterparts, meaning that you have to shift the focus from building the product and providing a better service towards operational activities.

**Winner -> Heroku**

Choosing AWS as your platform while might look like buying directly from the factory, comes at the cost of lots of DIYs which can heavily impact where you spend your time, i.e. product vs operations, and can even impact your hires. 

It's very typical for the teams that run their solution on AWS to have multiple DevOps engineers for the larger teams or hire developers particularly with AWS experience to handle the operations for them while doing their coding tasks in smaller teams. Obviously the DevOps engineers, permanent or on contract, in most cases are way more costly than the savings you were planning to have if that was the reason you choose AWS over Heroku and asking the developers to manage AWS means lots of distraction, sub-optimal infrastructure utilization, and in most cases less skilled developers (you're hiring someone who knows AWS and deep down you know that you're willing to sacrifice the development skills to some extent).

Overall if in the middle of the article you were completely convinced that picking AWS is a no brainer, I believe you might now factor in more real life parameters in your assessment.

## The best of both worlds

Simplicity of Heroku, means less operational cost and more agility in the development of the product, with a developer first experience and more focus on shipping a quality product that directly brings value and generates revenue.

The high quality service that AWS provides has a way lower cost for the raw material (yup I'm calling RDS raw material compared to Heroku, please forget the pre-historic datacenter era!), along with perfect integrations with the rest of your platform and advanced options to make the solution way more secure irrespective of the instance size.

[Utopiops](https://www.utopiops.com) is a solution that gives you the simplicity that Heroku provides on AWS meaning you can now have the best of both worlds. Not only that, as the solution is provided on your own AWS account lots of advanced configurations are included without your involvement. You get your extremely popular RDS with a set up that most experienced DevOps engineers and solution architects can provide with such a simplicity that any developer can use it.

**What does it mean for DevSecOps engineers?**

While [Utopiops](https://www.utopiops.com) is starting a new era that we call no-ops and low-ops, it doesn't mean the DevOps role will become redundant at least in the near future. 

The operational expenses of the companies will definitely reduce in the future benefiting from platforms and services like Utopiops, while helping teams to achieve even more. 

Auto-tuning the parameters, settings, scales and even diagnosis are a few of the things you can expect to see in this era, meaning that the DevOps role will shift more and more towards solution architect activities and the experts in the field can help the teams achieve more by designing more complex and efficient solutions without having to go through the unnecessary, boring and low level grunt work.