There are several options for running MySQL databases as a service on the Amazon cloud. AWS RDS lets you run a managed database instance, taking care of administrative tasks like scalability, backups and high availability. Another AWS database service is Amazon Aurora, which provides an elastic database service that is fully compatible with MySQL.
In this post, we’ll review RDS and Aurora for MySQL and explain how to create your first database in each service. We’ll also present a second option—running MySQL in an Amazon EC2 compute instance to achieve the same level of control and customization as you would have in your local data center.
In this article, you will learn:
AWS Relational Database Service (RDS) is a managed service you can use to orchestrate your databases in AWS. You can run four database options besides MySQL and Aurora on AWS RDS — Oracle, MariaDB, PostgreSQL, and Microsoft SQL Server. The service manages provisioning, failure detection, repair, backup, recovery, and patching for you.
When using RDS, you have the option of selecting from several instance types, including memory, performance, or IO-optimized. You can deploy RDS across multiple availability zones and can use the AWS Database Migration Service to migrate your existing databases.
You should be aware that RDS has size limits, which you can overcome by tiering some of the data to Amazon S3. Learn more in our article on RDS instance size.
Creating a new database instance is relatively easy. Below, you can see a tutorial adapted from the AWS documentation. For this tutorial, you can use your existing account or you can test out the configuration in the Amazon free tier.
1. From the RDS console, select the Region you want to create your database in. You can find this option in the upper right corner.
2. Click Create database. You can find this option in the middle of the page.
Source: Amazon Web Services
3. Select your database engine and click Next.
4. Configure your MySQL RDS Instance with the appropriate settings and click Next.
5. In the Configure advanced settings page, supply the remaining settings information.
6. Click Enable deletion, found in the Deletion protection section.
7. Click Create database.
After your instance is created, you can view it from the RDS console. From there you can also connect your database and manage the instance as needed.
AWS Aurora is a fully managed relational database optimized for use in AWS. It supports MySQL and PostgreSQL. With this service, you can combine the cost-effectiveness of open-source databases with increased availability and performance.
Aurora manages and automates patching, backups, hardware provisioning, and database setup for you. It is based on fault-tolerant, distributed, and self-healing storage resources. You can use it across three availability zones and scale it to 64TB per database instance.
Below, you can find a tutorial that walks you through creating an AWS MySQL cluster in Aurora. This tutorial is adapted from the AWS documentation. In this tutorial, the Easy Create mode is used. This mode enables you to set up a database with standard options. If you want to customize your database, you can do so by turning off this mode.
Prerequisites
There are some prerequisites you need to manage first before you can create your DB cluster. These prerequisites include a VPC and an Amazon RDS DB subnet group. For the VPC, you need to configure one or more subnets in two or more availability zones. For this, you can either use the default VPC or you can create a custom one. Whichever VPC option you choose, you can create and attach it via the RDS console.
1. Open the Amazon RDS console from the AWS Management Console.
2. Select the Region that you wish to create your database in from the upper right corner of the console.
3. From the navigation pane, select Databases and then select Create database.
4. In the Create database screen, configure your database options.
If you are planning to use this database in your production system, it is recommended that you change the default username. You should also ensure that your password complexity meets your security protocols.
Source: Amazon Web Services
5. Click Create database.
Once your database is created, you can view your cluster from the RDS console. In the console, you can see the status of both your instance and cluster. Once both display a status indicating resources are ready to use, you can connect your cluster to your instance. This process is not immediate, however. Be prepared that you may have to wait up to 20 minutes before your new DB cluster is ready to use.
In the first part of this post we discussed the fully managed option for deploying MySQL on AWS, using Amazon RDS or Aurora. The fully managed option is aligned with the PaaS cloud service model and is mostly applicable for cloud-native applications or re-architected applications, where it is acceptable not to have full control over database server environment, configuration and tuning.
However, there’s another way. You can self-manage MySQL by running an Amazon EC2 instance and deploying a MySQL image. The self-managed IaaS model gives you full control over the MySQL database on AWS, letting you fine-tune server and DB configurations just like you could do in an on-premises deployment.
Learn more about how to migrate your database to AWS in our articles:
For many use cases, a good alternative to AWS managed database services is to combine MySQL with two other services offered by AWS—Amazon EC2 and Amazon Elastic Block Store (EBS). This means you need to install and deploy the database on an EC2 instance, and add Amazon Elastic Block Store (EBS) as a durable and pluggable storage.
If you manage MySQL yourself, you have to set it up and maintain it just as you would do in your own datacenter. However, you can use Amazon Machine Images (AMI) to make things easier:
Pros of the Managed Option
Cons of the Managed Option
Pros of the Self-Managed Option
Cons of the Self-Managed Option
The downsides of self-managing MySQL on AWS are the increased complexity of managing EC2 and EBS instances, and the difficulty of managing auto scaling on your own.
NetApp Cloud Volumes ONTAP, the leading enterprise-grade storage management solution, delivers secure, proven storage management services on AWS, Azure and Google Cloud. Cloud Volumes ONTAP supports up to a capacity of 368TB, and supports various use cases such as file services, databases, DevOps, or any other enterprise workload, with a strong set of features including high availability, data protection, storage efficiencies, Kubernetes integration, and more.
NetApp Cloud Volumes ONTAP helps you get all the benefits of the self-managed deployment option—without the complexity.
Cloud Volumes ONTAP extends your control and provides more capabilities, including a number of automatic features that aren’t available using either the managed service option on RDS or the native AWS storage model.
Cloud Volume ONTAP allows you to leverage self-managed MySQL in EC2 with enterprise capabilities, achieving the following benefits:
When using NetApp Cloud Volumes ONTAP you can leverage the following features:
Learn more from our customers in our Database Case Studies with Cloud Volumes ONTAP blog, and visit our Cloud Volumes ONTAP for MySQL solution page.