Thursday, 29 August 2019

Pros and Cons of RDS vs EC2 MySQL in AWS

One advantage of developers using Amazon RDS instead of managing their own databases is that it reduces or eliminates their administrative responsibilities.


1. Introduction

Let’s start by giving a brief explanation about what RDS and EC2 is:

1.1 Amazon RDS

RDS is a web service which makes it easier to set-up, operate and scale your relational database in the cloud.
It offers automatic installation process, disk provisioning, upgrades, security patches and backups of your SQL Server databases.
Other than that it also allows you to set up a highly scalable environment, fully managed by AWS by Multi-AZ (Availability Zone) synchronous replication.
Note: You can get RDS in the free tier as a part of AWS free tier offer to get started with managed database service.

1.2 Amazon EC2

EC2 is a web service that will allow you to run application programs in the AWS cloud. It allows developers to spin up virtual machines, which provide compute capacity for IT projects that run with global AWS data centers.
You will get full control, you are responsible for the administration of your database. Also, it allows you to provision and configures database instances and storage.
With EC2, you can provision your databases across the world to provide low latency to your end-users worldwide.

2. RDS vs EC2: Differences

In the bigger picture, both RDS and EC2 will enable you to build a database in a secure environment, supports high-performance applications, and are highly scalable.
Still, there are some important differences between RDS and EC2 databases.
Let’s explore these in detail to paint a clearer picture:

2.1 RDS

1. In Amazon RDS, AWS takes full responsibility for your database. The entire process of configuration, management, maintenance, and security is automated by AWS.
2. Other than that, RDS offers high performance and compatibility as it supports Oracle, SQL Server, MySQL, PostgreSQL, and Aurora.
3. It allows you to easily configure read replicas or set up synchronous replication across availability zones for enhanced performance, availability, and durability.
4. You get the option to choose between 2 types of storage:
Standard Magnetic Storage: It bursts up to 3,000 IOPS.
Provisioned: It goes up to 10,000 IOPS, depending on your needs.
5. Lastly, RDS offers automatic backups and encryption at rest and in transit.

2.2 EC2

1. Complete control is one of the key benefits of EC2. You can use EBS RAID and striping configurations for higher performance if you are running a database on EC2.
2. You can get up to 8,000 IOPS and 800MBps with provisioned IOPS and the right EC2 instance.
3. Also, the EBS volumes can be encrypted to protect your data both at rest and in motion(while traveling from EBS volume to EC2 instance).
4. You can easily supervise your maintenance windows, use of ports, and number of instances per database
5. EC2 allows you to meet unique performance, replication, archival or DR requirements by giving you the required flexibility.

3. RDS vs EC2: Which one to choose?

While comparing RDS vs EC2 you will come across many of their pros and cons for MySQL Server database.
RDS is easy to set up, cost-effective and allows you to focus on more important tasks.
Whereas, EC2 offers complete control and flexibility for your SQL Server database.
Once you understand the requirements of your application, you would be able to make a better decision. Our overall experience and analysis make us lean towards RDS a bit due to the following reasons:
  • It allows you to outsource tasks like provisioning of the database, updating versions, and security to Amazon.
  • RDS allows you to focus on important tasks like performance tuning and schema optimization of your database.
  • You wouldn’t have to manually set up database mirroring and failover clusters because you get highly optimized database solutions and synchronous Multi-AZ replication.
  • At times of disaster, you don’t have to worry about managing your backups as RDS automates this process.
However, EC2 is also preferred by many people because:
  • It gives you full control over your database, OS and software stack.
  • EC2 allows you to hire your own database administrators. They will help you manage your database by looking after backups, replication, and clustering.
  • You can use SQL Server features that are not currently supported by Amazon RDS.
  • It allows you to exceed your maximum database size and performance needs.
  • With EC2, you can set up a disaster recovery solution in SQL Server with AWS as the source.
Here’s a small performance comparison between RDS and EC2:
rds vs ec2 comparison   rds_vs_ec2_2

4. Costs Exercise

We have a small estimation comparing RDS vs EC2. This estimation is done using AWS simple monthly calculator.

4.1 MySQL on EC2

  • Instances: 3 x m2.4xlarge
  • Storage: 3 1Tb EBS volumes (provisioned IOPS – 3000 IOPS) + 100Gb/month of snapshots space
  • Intra-Region Data Transfer: 40Gb/Month
  • On-demand instances: USD $3440 per month
  • Reserved instances (1 year, partial upfront): USD $1466 per month

4.2 MySQL RDS

  • Instance type: 1 x db.r3.2xlarge + 1 x db.r3.2xlarge (read replica)
  • Multi-AZ: Yes
  • Storage: 1Tb (provisioned IOPS – 3072 IOPS, one for each instance)
  • Backup space: 100Gb/month
  • Intra-Region Data Transfer: 40Gb/Month
  • On-demand instances: USD $2484 per month
  • Reserved instances (1 year, partial upfront): USD $1387 per month
Note: We used US(N. Virginia) region for the above calculations.
Conclusion
It feels good to have more control but you also need readily available skills.
While RDS makes sense as the first choice, EC2 offers some real benefits, for most applications. What it really comes down to is the cost of your time required to set up and maintain a database.

No comments:

Post a Comment

The complete list of new features in MySQL 8.0

There are over 250 new features in MySQL 8.0. The MySQL Manual is very good, but verbose. This is a list of new features in short bullet f...