Arquivo da tag: amazon

MySQL on Amazon AWS: RDS or EC2?

Guys, it’s been two days since the Star Wars movie premiere. Height anxiety level 🙂

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

Alphabet Soup: AWS is Amazon Web Services. By the way, I think the web is no more, as Amazon services have reached much higher levels. RDS is an acronym for Relational Database Services, and EC2 Elastic Compute Cloud.

If you reproduce all this, it’s a Kaminoano blender, so it will be a cloud service, ideal for hosting database servers.

One question that always asks me is: Should I host my MySQL database on RDS or EC2?

My standard answer has always prevailed, “It depends, little Padawan.”

Let’s understand in general who is who:

RDS: An RDS instance is an abstraction of a database server. Besides not having a hardware figure, not having an operating system or installing a database. It can be roughly understood as a virtualized database. It is a database provided as a service (DBaaS). Currently, the following banks can be contracted as RDS: MySQL, MariaDB, Aurora, Oracle, SQL Server and PostgreSQL.

EC2: EC2 is the same, it’s a good old virtual machine (VM) that virtualizes the hardware, installs and configures your preferred operating system, file system, and database. Everything can be tailor made and taste. Any database can be installed in the EC2 environment.

There are a lot of good articles on RDS and EC2, and I already say that there are fervent advocates on both sides. The best person to tell you is the best way forward: RDS or EC2, it’s yourself. So here is a basic guide of questions you should ask to make the best decision.

Ease of implementation and management of the environment

RDS will save you a good time implementing a new environment, remember, you don’t need to create the VM, install the OS, configure the file system, install the database. One click, and Shazam! Ready to use. However, you are carrying a bundle of joy with some customizations, and that’s it.

EC2 is grosser. You will need to create the VM, install and configure your preferred OS, configure the file system that best suits your application, install and configure the database.

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

EC2 is Dark Side of the Force. It is control. How good Sith I prefer.

Performance

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

Unexplained Locks

What bothers me about RDS environments are locks that happen on time without any logic. “Ah, it’s your configuration or application problem.” Hi? Doesn’t AWS say it takes this part? In all our instances, from different clients, from different niches, configurations, and instances of different sizes, this behavior is observed to a greater or lesser extent.

Cost

Some geniuses have posted that RDS is cheaper. What I have observed is that RDS is 20% to 38% more expensive than EC2. However, we have to consider here the hours we will stop using with installation, update, patching, etc. Another cost factor that does not reach MySQL, but should be considered in the case of Oracle and SQL Server is the Bring Your Own License (BYOL) model, in which you take your license to RDS, which may positively or negatively influence the cost. .

Management

You will not have a MySQL SUPER user. So, forget some commands. But AWS has provided a number of procedures that attempt to mitigate this absence of the SUPER user. This is particularly bad as it takes away some of DBA’s ability to act in emergency situations.

Data Encryption

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

MySQL Plugins

If for you plugins for authentication, auditing, semi-synchronous replication, among others, is a necessity, RDS is not for you. Strictly speaking, RDS does not allow any kind of plugin. Oh, no GTID (Global Transaction ID). To use these plugins, only on EC2.

And 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 of investors and economists to mitigate risk.

As appropriate for RDS, use RDS to decrease your hours with change management and Operating System and Database updates.

Whatever is important, sensitive, critical put in EC2, where, you have the most control of the environment. And, okay, invest a little more time.