Published: Aug 30, 2022
In this guide, we’ll explain how to create and connect to an AWS RDS MySQL database. Amazon RDS is a service that lets you easily set up and configure relationship databases with various types of database instances in the Amazon Web Services cloud.
With Amazon’s relational database service, you don’t have to manage databases on-premises. There’s no need to manage servers, operating systems, software, and install databases. Amazon handles all the installation and management tasks for you.
If you want to deploy MySQL databases in the cloud, Amazon RDS is a scalable solution that lets you do that in minutes. It’s free to try and you’ll only need to pay for what you use.
Before we get started with the creation of our MySQL RDS instance, here’s what you’ll need to use:
Let’s kick off this tutorial by setting up the AWS account required to create our RDS instance. If you already have an AWS account, you can just skip to the next section.
Creating an AWS account is pretty straightforward. Here are the steps that you need to follow:
Now that you have your AWS account set up and ready to use, let’s create our MySQL RDS instance. Here’s how to proceed:
With Amazon RDS, you can choose between different instance types optimized for specific use cases. You only pay for what you use, and costs will depend on whether you’re using On-Demand or Reserved instances.
You can use the AWS pricing calculator to get an estimation of your Amazon RDS costs for deploying your MySQL database.
You’ve just successfully created your MySQL Database instance with Amazon RDS resources. Now, the next step is to download an SQL client to connect to the database so that you can start working with it.
There are multiple SQL clients available on the market. One of the most widely used is MySQL Workbench, which we’ll be using for this guide.
You can install MySQL Workbench on your Windows PC by following these steps:
You’re now ready to use MySQL Workbench and work with your database. We’ll explain how to connect the app to our MySQL database on Amazon RDS in the next section.
Here, we’re going to connect MySQL Workbench to our database created with Amazon RDS. Here’s how to proceed:
You’re now ready to use MySQL Workbench to work with your MySQL database on AWS RDS. However, exploring what you can do with your database is out of the scope of this article.
We’ve detailed how to create a MySQL database in AWS RDS and how to connect to it with an SQL client. If you need to manage your database, though, you’ll need to do that on the AWS website.
The modification of database instances on the AWS cloud is a pretty straightforward process. If you need to change the size of your RDS instance, open the list of databases, select the one you want to edit in the list, then click Modify.
Here, we’ll change the database instance type to db.t3.small.
You can either schedule this modification on the next scheduled maintenance window or apply it now. Here, we’ll choose Apply immediately and then click Modify DB Instance.
You’ll notice in the list of databases that our petridb database is being modified. After a few minutes, the database instance type will change from db.t3.micro to db.t3.small.
It is very important to keep backups for all the AWS services you use. Databases you create on AWS RDS are no exception.
Here, we have the option to create snapshots (similar to backups) for our MySQL database. Here’s how to do it:
In the final section of this tutorial, I’ll show you how to delete a database instance created with Amazon RDS. To get started, select the database you want to delete in the list, then click on Delete from the Actions dropdown menu.
Here, you’ll have the option to create a final snapshot of your database and choose its name (we’ll use ‘petridb-final-snapshot’). There’s also a Retain automatic backups option if you want to keep automated backups for 7 days after deletion.
Once you’re ready, type “delete me” into the field at the bottom and click Delete.
In this article, we learned how to create a MySQL database with an AWS RDS instance. We also learned how to connect to the database using the MySQL Workbench client, and how to manage MySQL RDS instances in AWS.