Open In App

Amazon RDS MySQL Connecting to DB

Last Updated : 12 Feb, 2024
Improve
Improve
Like Article
Like
Save
Share
Report

Connecting your Amazon RDS MySQL database with your application is a key step for building software. In this article, we will break down the process for connecting RDS with your Database. Relational Database Service provided by Amazon on their cloud service platform called AWS (Amazon Web Services) that can create instances of various popular Relational DBMS such as MySQL, PostgreSQL, Microsoft SQL Server, etc. It is cost-efficient and can resize its capacity according to your needs.

Amazon RDS MySQL

What Is Amazon RDS MySQL?

Amazon RDS (Relational Database Service) which is a fully-managed service provided by AWS for deploying, scaling, and maintaining relational databases in the cloud. RDS supports multiple database engines such as MySQL, MariaDB, PostgreSQL, Oracle, and Microsoft SQL Server. RDS allow you to host your MySQL database on cloud with various features like auto scaling, pay what you use, deployment, etc.

Step By Step Guidelines To Connect Amazon RDS MySQL

Firstly, Create a MySQL DB instance

Step 1: Login into AWS Account.

Step 2: After signing in you will land on the AWS Mangement Console page and search for RDS as shown below.

AWS Management Console

Step 3: After landing on RDS Dashboard > Create database. This will allow us to create a MySQL DB instance.

Amazon RDS Dashboard

Step 4: Select Engine Type in your case it’s MySQL.

Creating Database with MySQL Engine

Engine Type – MySQL

Step 5: Select template -> Free tier. In case you are allowed to pay for your service you can use the other 2 options.

Templates In Amazon RDS

Template – Free tier

Step 6: Give the name to your DB instance, type username and password. Credentials will be required later so note them somewhere.

DB Instance Configurations

Step 7: Expand Storage autoscaling and uncheck Enable storage autoscaling. Enabling the auto scaling feature will increase your storage capacity automatically and will cost you so use it with caution.

Autoscaling of Storage

Autoscaling

Step 8: Make your IP public, this will allow you to connect the DB instance with MySQL Workbench.

Providing Public Access

Step 9: Expand the Additional configuration section and enter your Initial database name. RDS will create new database of this name.

Additional Configurations

Step 10: Go to the bottom of the page and press the Create database button.

Step 11: Wait till the database status becomes available.

Database Console

Setting IP Address In Security Groups

Step 12: Click on your db identifier in this case gfg-rds. Note down the endpoint and click on the hyperlink under VPC security groups as illustrated in the following screenshot.

Connectivity and Security Configurations

Step 13: Check the check box and go to Inbound rules > Edit inbound rules. You have to add your IP to the security groups to connect the DB instance from the workbench.

Configuring Security Groups

Step 14: Fill in the following data Type -> MYSQL/Aurora and Source -> My IP this will automatically fetch your IP.

Modifying the Inboud rules

Step 15: Save the rules and go to the RDS dashboard again. Open your DB instance (i.e. gfg-rds in my case) and reboot it.

Reboot Instance

Step 16: Connect to MySQL database

  • Open MySQL Workbench and go to Database > Connect to Database or simply Ctrl+U.

MySQL Workbench

Step 17: Fill data to connect DB instance with workbench. In place of Hostname fill Endpoint which you copied earlier. Add username and password in Vault.

Connect to DB

Step 18: Press OK. This will open an editor and on the left side panel, you can see your database in my case gfgdb.

Editing the SQL Workbench

Conclusion

We have successfully connected Amazon RDS MySQL to our Database (gfgdb). Now you can build tables in a workbench and work with data over the cloud. We can also perform CRUD operations on this database via SQL connector (Python, Java, etc), just use the endpoint as Hostname, username, password, and port to connect with the database.

Amazon RDS MySQL – FAQs

How Can I Secure My Connection To Amazon RDS MySQL?

Using SSL/TLS, IAM authentication, and managing database user permissions you can secure your connection.

Is It Possible To Connect To Amazon RDS MySQL From A Different Region?

Yes, but there are limitations and considerations when connecting to Amazon RDS MySQL from a different AWS region.

Can I Use Any Programming Language Or Framework To Connect To Amazon RDS MySQL?

Yes, using SQL connector you can use various programming languages and frameworks to connect to Amazon RDS MySQL.

What Is The Maximum Number Of Connections Supported By Amazon RDS MySQL?

It depends on which db instance using. Here are some limits for DB instance classes:

  • db.t3.micro and db.t3.small: Up to 66 connections.
  • db.t3.medium: Up to 149 connections.
  • db.t3.large: Up to 307 connections.
  • db.t3.xlarge: Up to 620 connections.
  • db.t3.2xlarge: Up to 1234 connections.



    Like Article
    Suggest improvement
    Share your thoughts in the comments

    Similar Reads