Most modern applications nowadays are tiered into multiple compute instance groups to increase resilience and elasticity. The most common tiered approach is a 3-tier generalized approach made up of web servers on the first tier, an application server on the second tier, which contains the application’s business logic, and application databases on the third tier. The web, logic and database tiers are separated for a variety of reasons, such as scalability, security, availability, durability, and more.
In addition, while non-relational databases (NoSQL) are gaining popularity, especially in the big data analytics realms, applications still rely on relational databases. All in all, running a database has its own separate costs, and running one in the cloud has a significant impact on the overall costs of running the application. In this article, I will explore the cost of running a relational database in AWS, comparing EC2 hosted and RDS instances, and exposing the hidden costs of commercial databases.
Two Options from AWS: EC2 Based vs. DB-as-a-Service
If you host your database on an EC2 instance, Amazon leaves almost all maintenance up to you. That way, your cloud-based database server is similar to those on-premises, without the physical hardware maintenance. You will need to deploy database management software and expect to perform up-keeping duties such as patches, software updates, replication and disaster recovery to optimally tune performance.
The second option is the database-as-a-service option that includes Amazon Relational Database Service (RDS). As a managed database service, with RDS, Amazon takes care of everything for you and supports various database software, such as MySQL, SQL Server, Oracle, PostgreSQL and Amazon’s Aurora. AWS also carries out critical database operational tasks such as offsite replication and failover.
EC2 Based vs. RDS
Comparing EC2 based database costs and RDS gets interesting simply by looking at the cost of each of the two options and learning about the premium that AWS charges for database management. In order to calculate the difference between the cost of running a database on RDS and on EC2 hosted, we would like to look past all of the hardware and operating system costs, leaving the database management costs by themselves. Another consideration is proprietary licensing costs, which are often associated with database management software. In the example below, I examine MySQL deployments as their licensing costs are zero.
So, how much will it cost to run your database?
Case #1: Running on On-Demand
For comparison purposes, we used a standard m3.large instance in the US East region with two vCPUs. Seeing as prices are usually issued per vCPU, we can simply divide the results in two in order to find the relatable price. An EC2 (m3.large) On-Demand Instance comes out to $0.133 per hour, while the same instance on RDS with MySQL works out to $0.185 per hour.
- EC2 based: m3.large w/Linux: $0.133 per hour. For the annual rate, multiply by 24*365 for $1165.08, or $582.54 per vCPU per year.
- RDS: db.m3.large w/MySQL: $0.185 per hour. Annually, that’s $1620.6, or $810.3 per vCPU per year.
Annually, assuming 100% utilization (a common use case for a production database), this reflects a 39% markup from EC2 to RDS, or a premium of $227.76 for database management per vCPU per year. This is an interesting metric. If you are an IT manager and want to compare the cost of keeping a DBA on staff, you can calculate how many vCPUs that DBA has to manage to make keeping him/her worthwhile, rather than running them on managed cloud services such as RDS.
Case #2: Running on Reserved Instances (RIs)
Now let’s take a look at the cost difference when operating these two options on Reserved Instances. We should note that Amazon recently announced that the new RI pricing model (All/Partial/No Upfront) applies to RDS instances as well.
- EC2 based: m3.large w/Linux all upfront 1 year: $713 (39% discount over On-Demand), or $365.5 per vCPU per year.
- RDS: db.m3.large w/ MySQL all upfront 1 year: $993 (39% discount over On-Demand), or $496.5 per vCPU per year.
The markup for “database management” ([993-713]/713) comes to 39%, or $280 per vCPU. While the Reserved Instance costs are lower, the markup for database management is equal for both On-Demand and Reserved. The RI discount is applied on the underlying hardware and there is no change in the cost of Amazon’s RDS managed database service premium.
Calculating Hidden Licensing Costs
As mentioned above, dealing with database engine licensing costs adds another parameter to the cost equation. This scenario can be due to migrating an on-premises database server running either on Oracle, PostgreSQL or MS SQL Server to the cloud. What are the hidden licensing costs for a managed database operating in the cloud? Due to these added costs, naturally, if you want to run an instance with an Oracle database, you will have to pay a fixed price per hour, which is higher than the price of an RDS machine with MySQL.
*Note: According to an article on Pythian, a vCPU in an AWS environment only represents half of a physical core so for the following comparisons, we will use the database m3.large instance with two vCPUs, which can be compared to a license for a database running on a single physical core.
Calculating the price difference between an RDS instance with licensed software and an RDS instance with MySQL (no licensing fee) can single out the element of licensing, which is included in the On-Demand price. An RDS instance running on MySQL amounts to $0.185/hr, whereas an RDS instance running on Oracle (12c Standard) amounts to $0.42/hr. The difference comes out to $0.235/hr, with an annual difference of $1029 (based on 100% utilization). Compare that to the price of the same license on the Oracle website ($1,160) and it works out to be slightly cheaper than buying an annual license for Oracle and running it on-premises.
MS SQL Server
If we want to compare a MySQL RDS instance to a SQL Server (Standard) RDS instance, it works out to $0.185 and $0.315, respectively (for the same db.m3.large instance). The difference comes out to $1138/year, the effective licensing cost for MS SQL. With the licensing costs at $3,717 according to the Microsoft website, for a two-core system ($1858 per core, or 2-vCPU system), it’s significantly cheaper to license through Amazon. It’s also important to mention that in Microsoft Enterprise Agreement, significant discounts can be given relative to the list price, so every case should be carefully examined.
PostgreSQL, the open-source and free database, is gaining popularity, but Amazon charges to use it. A MySQL RDS instance costs $0.185 per hour compared to $0.195 per hour for PostgreSQL. This premium works out to $44.64 per year per vCPU. Both platforms are free and Amazon already charges for database management services in RDS pricing, so it is interesting that they charge an extra $0.01 per hour premium for the PostgreSQL license.
A Final Note
While costs are almost always a central consideration when looking into relational database options, it is important to remember that performance is also a vital factor. That being said, over-provisioning resources in the name of performance generally incurs “empty” costs. This is where Cloudyn comes in, monitoring the performance of your EC2 and RDS instances, and offering sizing recommendations for the most cost efficient use of AWS resources.
Furthermore, contrary to our calculation assumption, not all databases run 100% of the time. Significant cloud cost savings can be incurred by buying Reserved Instances for frequently used RDS instances. RDS instances that are used less frequently (e.g., testing environments) can be provisioned On-Demand. Cloudyn also takes care of this for you, by monitoring the usage of your RDS instances and recommending which (if any) RIs should be purchased, accordingly.
Managed database services need to meet the requirements of the application. However, if you are deliberating between different database services entirely based on cost, then I hope this information can help you decide which direction to go.
Take Control Over Your AWS Cloud Costs
Start your 20-day free trial today to easily identify greater cloud efficiency opportunities and view your entire AWS deployment in one place. Gain full transparency, accountability, and control.