Are you thinking about AWS migration? You will have to decide which one among “RDS vs EC2” is better for your database requirements.
Both options will enable you to build a database in a VPC secure environment and are highly scalable.
One advantage of developers using Amazon RDS instead of managing their own databases is that it reduces or eliminates their administrative responsibilities.
In this post, we will help you to choose between RDS or your own EC2 instance.
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.
Read More: Migrating from t1.micro to t2.micro in AWS
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.
You May Also Like: Reduce AWS Costs by 25% in a Month
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:
Must Read: How to Install Magento on AWS?
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.
Read More: AWS Migration in 5 Super Easy Steps
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.
9 thoughts on “Pros and Cons of ‘RDS vs EC2’ for MySQL with AWS”
Hi ,
Excellent comparison and analysis. i really appreciate .
just one question : if we look from Backup and Recovery and archival of Databases(any db) running on EC2 instances with databases using RDS service , which one we need to prefer
assuming workload is huge on ec2 instance (web app and db on same instance)
Hi All,
we have scenario , where Databases on running on EC2 instances (EBS volume )and now the database side is getting increased day by day . If we need to take Archive of database running on EC2 Instances , what would be the approach and how it would be implemented in AWS .
1)To implement this , is it advisable to move all database running on EC2 instances to RDS services and once it is running on RDS , then it can be archive using any tool.
2) can we archive database (EBS volume) on EC2 instances , can it be automated
3) if yes , what kind of archive can be taken
4) does this archive of database move to S3 / glacier and what kind of database archive methodology on AWS cloud
Hello Mangesh,
you write small shell script to take regular backup and set cron job for the same whatever frequency lets say for a month or daily
you can specify location on your EBS volume then run another job to move that backup from EC2 to AWS s3 at your bucket
We have been using this since more than 4-5 years flawlessly it should not take more than 4-6 hours efforts to get things setup
Dear Arun Bansal,
When we use RDS services, we can change some configuration about SQL Server or MySQL or PostgreSQL, like systems variables (max memory e etc.)?
With RDS not supporting Reporting, Analysis, Integration (i believe?) would EC2 be the right decision if I want to use these services?
Yes, of course. If you want to use this services, you need to use an EC2. RDS does’nt have those services and doesn’t have SQL Server Agent too.
Regards.
Nice. Really helpful to me as I am migrating my old server to a new server so I decided to know more for my Database usage.
Just to make sure sure I’m not that much expertice in Databases but I can do my own responsibilities for Database setup and cost less on EC2 so I think EC2 is much better option so we can also host some other servies to as in some apis and web hosting I can do it all together on the same AMI, Is there any issue regarding this?
Isn’t it better to use in EC2 DB when you are considering a website that is a blog or a shop? Would you still go for a EBS in such a simple case
That’s what I was thinking, but I needed a second opinion before pulling the trigger. This sums it up nicely. Short, sweet, and to the point.