More about AWS Database
- AWS PostgreSQL: Managed or Self-Managed?
- MySQL Database Migration: Amazon EC2-Hosted vs. Amazon RDS
- AWS MySQL: MySQL as a Service vs. Self Managed in the Cloud
- Database Case Studies with Cloud Volumes ONTAP
- Amazon DocumentDB: Basics and Best Practices
- AWS NoSQL: Choosing the Best Option for You
- AWS Database as a Service: 8 Ways to Manage Databases in AWS
- AWS Database Migration Service: Copy-Paste Your Database to Amazon
- AWS Oracle RDS: Running Your First Oracle Database on Amazon
- SQL Server in AWS: Two Deployment Options
- DynamoDB Pricing: How to Optimize Usage and Reduce Costs
- AWS Database Services: Finding the Right Database for You
- Overcome Amazon RDS Instance Size Limits with Data Tiering to Amazon S3
Subscribe to our blog
Thanks for subscribing to the blog.
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:
- What is AWS RDS
- How to create a MySQL database with RDS
- What is AWS Aurora
- Creating an Aurora MySQL database cluster
- MySQL on AWS: Fully Managed or Self Managed?
- MySQL in AWS with NetApp Cloud Volumes ONTAP: The Best of Both Worlds
What Is AWS RDS?
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.
How to Create an AWS MySQL Database with Amazon RDS
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.
- In this case, you want to choose the MySQL option.
- If you are using the free trial, make sure to also select “Only enable options eligible for RDS Free Usage Tier” in the checkbox at the bottom.
4. Configure your MySQL RDS Instance with the appropriate settings and click Next.
- Some example settings you can use are:
- License model—default general-public-license
- DB engine version—default version of MySQL
- DB instance class—db.t2.micro (1vCPU, 1 GIB RAM)
- Storage type—General Purpose (SSD)
- Allocated storage—5GB
- You also need to supply names and passwords for your instance. Make sure that your DB instance identifier is unique for your account and region. If you intend to retain this instance after creation, ensure that your username and password comply with your security protocols.
5. In the Configure advanced settings page, supply the remaining settings information.
- The settings you need to configure include:
- Network and security settings
- Virtual Private Cloud (VPC) information
- Database name
- Port and IAM configurations
- Backup options
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.
What Is AWS Aurora?
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.
Creating an Aurora MySQL Database Cluster
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.
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.
- Make sure that Easy Create is selected when you perform this step.
4. In the Create database screen, configure your database options.
- You can use the sample options, provided below if you are unsure what to choose:
- Engine type—Amazon Aurora
- Edition—Amazon Aurora with MySQL 5.6 compatibility.
- DB instance size—Dev/Test.
- DB cluster identifier—leave the default name or choose a custom name
- Master username—leave the default name or choose a custom name
- Master password—use an automatically generated password or input a custom password
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.
MySQL on AWS: Fully Managed or Self Managed?
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:
- AWS Cloud Migration Services: Don’t Migrate Alone
- AWS Database Migration Service: Copy-Paste Your Database to Amazon
How Does Self-Managed MySQL on AWS Work?
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:
- You can create an Amazon Machine Image (AMI) and use it as a template for new EC2 instances.
- There are AMIs already available with MySQL preinstalled, and with configuration already in place, including high availability. Note that some AMIs are free and some incur a flat or per-hour fee.
Pros and Cons of Managed Deployment—MySQL on RDS
Pros of the Managed Option
- Elastic scalability—you can effortlessly change the resources allocated to your MySQL server in AWS by tweaking a few settings, and the changes will be rolled out within minutes. RDS also supports storage autoscaling, which means it can detect when space is running out and allocate additional storage without any intervention.
- Pay on demand—RDS is priced hourly, and there is no need to make any significant upfront investment—you pay for what you use. This, combined with the ability to increase and decrease the allocated resources as needed, allows you to optimize your costs, or even quickly spin up RDS instances for occasional jobs and destroy them immediately afterwards.
- Reserved instances—if your workloads are more predictable, you can take advantage of Reserved DB Instances, trading the aforementioned flexibility for significant discounts.
Cons of the Managed Option
- Instance limitations—pay attention to the limitations of MySQL on RDS. RDS supports up to 40 database instances and up to 25 security groups per Amazon region. Database size is limited to 16 TB.
- Less control—when using a service like RDS, you cannot control many aspects of database configuration, you cannot tune the database like you would an on-premise MySQL instance, and you cannot control where exactly data is located, which makes hybrid and multi-region scenarios more difficult to achieve.
- Vendor lock-in—once your MySQL database is running in RDS, it will not be possible to seamlessly migrate that database outside AWS. Migration will require careful tuning and testing.
- Set limitations—the service level agreements (SLAs) for RDS, for example, the guarantee to monthly uptime of 99.95%, cannot be changed. If you need a higher uptime, or have different requirements with regard to availability, disaster recovery, or data protection, you will have to make do with what RDS provides.
Pros and Cons of Self-Managed Deployment—MySQL with EC2 and EBS
Pros of the Self-Managed Option
- Cost effective—self managed deployment is less expensive than RDS, because you don’t need to pay for the additional management layer, only for raw system resources.
- Flexibility—you can fully control data configuration and tuning, data location, and can set up the database in such a way that it can easily be migrated on premises or to other public clouds, for hybrid and multi cloud scenarios.
- Scalability—go beyond the RDS limit of 16 TB and the limit of 40 database instances per region, by adding as many compute and storage resources as needed in EC2.
- Data protection—in a self-managed database, you can perform backups on a schedule of your choice, and align to your organization’s data protection and disaster recovery requirements.
- Features—you can upgrade and patch the database whenever required to get access to specific features or capabilities.
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.
MySQL in AWS with NetApp Cloud Volumes ONTAP: The Best of Both Worlds
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:
- Run any version of MySQL
- No limitations on instances configuration, scalability or storage volume
- No vendor lock-in
- No SLA limitations
- Pay only for actual resources used
- Full control over database configuration
- Full control over disaster recovery and data protection
When using NetApp Cloud Volumes ONTAP you can leverage the following features:
- Point-in-time, instantly-creatable consistent snapshot copies
- Zero-cost data clones
- Reduced storage consumption thanks to storage efficiencies like thin provisioning, data compression, deduplication, and automatic tiering of infrequently-used data (can save 70% of storage costs)
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.