MySQL na Amazon AWS: RDS ou EC2?

MySQL on Amazon AWS: RDS or EC2?

EC2

Guys, we’re just two days away from the Star Wars premiere in theaters. Anxiety levels are sky high.

But you didn’t come here to talk about Star Wars. So, let’s get to the point and let the dark side of the force enlighten your mind.

Alphabet soup: AWS is Amazon Web Services. Actually, I think “web” might not even fit anymore, since Amazon’s services have reached much higher levels. RDS stands for Relational Database Services, and EC2 is Elastic Compute Cloud.

If you put all this into a Kaminoan blender, you get a cloud service ideal for hosting database servers.

The question I’m always asked is: Should I host my MySQL database on RDS or EC2?

My standard answer always stands: “It depends, young Padawan.”

Let’s understand, in broad strokes, who is who:

RDS

An RDS instance is an abstraction of a database server. It has no hardware figure, no operating system, and no database installation. It can be roughly understood as a virtualized database. It’s a database provided as a service (DBaaS). Currently, you can get RDS for these databases: MySQL, MariaDB, Aurora, Oracle, SQL Server, and PostgreSQL.

EC2

EC2 is the same old thing — a VM (virtual machine) where you virtualize hardware, install and configure the OS of your choice, the file system, and then the database. Everything can be customized to your liking. Any database can be installed in an EC2 environment.

There are many good articles about RDS and EC2, and I warn you there are passionate defenders on both sides. The best person to tell you which path to follow: RDS or EC2, is yourself. So, here’s a basic guide of questions you should ask yourself to make the best decision.

EC2

Ease of implementation and environment management

RDS will save you many hours setting up a new environment. Remember, you don’t need to create the VM, install the OS, configure the file system, or install the database. One click, and Shazam! Ready to use. However, you get a package deal with some limitations on customization.

EC2 is rougher. You have to create the VM, install and configure the OS of your choice, configure the file system best suited to your application, install and configure the database.

RDS is click-and-be-happy. Let AWS worry about updates and patches.

EC2 is the Dark Side of the Force. It’s control. As a good Sith, I prefer it.

Performance

Honestly, I don’t have a magic formula for you. I have clients where RDS performs better than EC2. Fact. From tests I ran, in 78% of cases, a well-configured EC2 runs better and faster than RDS. But in 22% of cases, RDS really ran better.

Unexplained Locks

What bothers me about RDS environments are locks that happen occasionally without any logic. “Oh, it’s your configuration or application problem.” Excuse me? Doesn’t AWS say they take care of that part? In all our instances, from different clients, different niches, and various instance sizes, this behavior is observed, to a greater or lesser degree.

Cost

Some geniuses have posted that RDS is cheaper. What I’ve observed is that RDS is 20% to 38% more expensive than EC2. However, you must consider the hours you won’t spend on installation, updates, patching, etc. Another cost factor not affecting MySQL, but to consider for Oracle and SQL Server, is the BYOL (Bring Your Own License) model, where you bring your license to RDS, which can positively or negatively impact cost.

EC2

Management

You will not have SUPER user access on MySQL. So, forget some commands. But AWS provides a set of procedures to mitigate this absence of the SUPER user. This is particularly bad, as it takes away part of the DBA’s emergency handling capabilities.

Data Encryption

RDS does not allow data encryption. So, depending on the criticality and sensitivity of your data, go straight to EC2.

MySQL Plugins

If authentication plugins, auditing, semi-synchronous replication, and others are necessary for you, RDS is not for you. Strictly speaking, RDS does not allow any kind of plugin. No GTID (Global Transaction ID) either. To use these plugins, only EC2.

So now?

Use the best of both worlds. Ask yourself the questions, and see which application should go to RDS and which should go to EC2. Use the portfolio balancing technique used by investors and economists to mitigate risks.

What fits in RDS, use RDS to reduce your time spent on managing OS and database upgrades.

What is important, sensitive, and critical, put it on EC2, where you have more control of the environment. And it’s fine to invest a bit more time.

Schedule a meeting here

Visit our Blog

Learn more about databases

Learn about monitoring with advanced tools

EC2

Have questions about our services? Visit our FAQ

Want to see how we’ve helped other companies? Check out what our clients say in these testimonials!

Discover the History of HTI Tecnologia

Compartilhar: