How to Setup MySQL Database on AWS RDS Quickly
Dear Reader, In my last post you learnt how to install MySQL on Amazon Linux 2023 EC2 Instance. In this post, you will learn to Setup MySQL Database on AWS RDS.
While setting up DB on EC2 sounds okay, in the real world you shouldn’t use this way to host your database servers.
Rather the great way is to leverage services like AWS RDS to set up your MySQL database instance. There are quite a few reasons why should choose RDS over an EC2 for your database-
- It is fully managed and you don’t need to do DB administration work.
- It’s tuned for better performance
- Is cost-effective
- Easy setup highly available and scalable DB here.
So if you are looking forward to Setup MySQL Database on AWS RDS. This post is for you.
Don’t want to miss any posts from us? join us on our Facebook group, and follow us on Facebook, Twitter, LinkedIn, and Instagram. You can also subscribe to our newsletter below to not miss any updates from us.
Steps to Setup MySQL Database on AWS RDS Quickly
- Log in to AWS Management Console and Navigate to RDS
- Select a Region to Create your Database Instance
- Click Create Database and Choose a Database Creation Method
- Choose Engine Option
- Select Template
- Configure Settings and Credentials Settings
- Select Instance Configuration
- Select Storage Option
- Connectivity configurations
- Database Authentication and Monitoring
- Additional configuration
- Review the Encryption and Maintenace section
- Hit Create Database
Step 1: Log in to AWS Management Console and Navigate to RDS
Although there are quite a few ways in which you can create resources on AWS. In this post, we are trying to setup MySQL on AWS RDS via the AWS console. Therefore, you need to log in to the AWS console first.
Login to AWS Management Console and search for ‘RDS’ as you can see below. Once you see RDS, click on it to open the RDS service.
Step 2: Select a Region to Create your Database Instance
Once you are in the RDS dashboard, before creating a MySQL DB instance, select a region to create your MySQL database instance.
You can consider these 4 factors while choosing a region for your MySQL database.
Once you are sure of a region that’s closest to your location or satisfies the regulatory requirement for your data. Click on the region dropdown as shown below and click on a region to select it.
For example – I am choosing the Mumbai region as that’s closest to me.
Step 3: Click Create Database and Choose a Database Creation Method
Click on Create database as shown below-
Once you click, you will see the option to choose the database creation method. Choose the Standard create as shown below as we want to see all the configurations that are available to us.
Step 4: Choose Engine Option
Next, we get to choose the Engine option. We have 7 different engine options available at the time of writing this post. I am going for MySQL as shown below-
Next, I am going ahead with the Community edition and version 8.0.
Step 5: Select Template
There are a few predefined templates to meet your use case. If you are doing it for learning purposes, it makes sense to go with the Free tier option as shown below.
As you can notice, choosing the free tier has disabled the availability and durability option which you can otherwise configure for your needs. In case you are going with dev/test or production, configure your availability and durability needs as per your requirements.
All the options above are self-explanatory so it will help you to choose what you want.
Step 6: Configure Settings and Credentials Settings
In the sections, provide a DB identifier.
In the credentials settings, provide a master password for your user, in my case admin. You can also auto-generate the password. However, I am specifying on my own.
Step 7: Select Instance Configuration
Since we have selected the Free tier option previously, the Burstable classes that include t classes are pre-selected.
Otherwise, you could choose the other options.
Step 8: Select Storage Option
Choose storage options such as storage type, allocated storage, and autoscaling setting.
For the free tier, it’s okay to keep autoscaling disabled. However, if you are enabling, make sure to provide a maximum threshold value because you won’t want your DB to grow infinitely. Do you?
Step 9: Connectivity configurations
Provide how you would like to connect to your EC2 instance. If you want to always use an EC2 for connecting to your DB, you can choose that option. Otherwise, choose don’t connect to EC2 option.
Choose a VPC and subnet group.
Then select Yes for Public access as we want to connect to it from our local system. Also, select the option to Create a new security group for our MySQL DB instance.
Leave the RDS proxy part as of now. In the additional configuration, you will notice the database port as 3306 which is for MySQL.
Let’s move to the next step.
Step 10: Database Authentication and Monitoring
There are various options available for authentication. I am going for password authentication as of now.
For monitoring you can enable enhanced monitoring here if you need to. However, for now, we are keeping it unselected.
Step 11: Additional configuration
There are a few things in the additional configuration section that you can set.
Provide an initial database name. Keep the parameter group to default.
As you can see by default automated backup is enabled and you can disable it if you want. But I feel it doesn’t make sense.
In the backup section here, you can choose the retention period of backup from 1 to 35 days. You can also provide a backup window if you want it to happen in a certain time frame.
Step 12: Review the Encryption and Maintenace section
Similar to backup, encryption is enabled by default using the AWS KMS key. You can provide your own key Arn in case you want your own managed KMS key. I am leaving it as it is for now.
You can also select the logs that you want to send to Cloudwatch. For example, I have chosen just the error log option.
For the maintenance option, keep the below settings-
Additionally, you can provide your time window for maintenance activity. You can also enable deletion protection that helps your database from being deleted accidentally.
Step 13: Hit Create Database
Scroll down and click Create database.
It takes some time to set up a database. In a few minutes, you will see a success message like-
Click on the created DB link and you will find all the DB details including endpoint URL and port that you will need to connect to this DB.
In this step-by-step tutorial, you learned to Setup MySQL Database on AWS RDS. We saw various options that are available for us while trying to create a MySQL database instance on AWS RDS.
I hope you enjoyed the tutorial and were able to setup MySQL Database on AWS RDS. Do let me know in the comments in case you face any issues.
Enjoyed the content?
Subscribe to our newsletter below to get awesome AWS learning materials delivered straight to your inbox.
Meanwhile, you can also –