AWS RDS (Relational Database Service) is a managed database service provided by Amazon Web Services to launch a highly available and scalable database cluster. AWS RDS provides different database engines like Amazon Aurora, MySQL, MariaDB, MS SQL Server, Oracle, and PostgreSQL. AWS does not provide shell access to the database server; it only provides a connection string to connect to the database server.

MySQL Workbench is a desktop application used to enhance the visibility inside relational database servers like MySQL using a nice graphical user interface. It also provides a query tool to perform SQL queries to the database server. This guide will discuss the following steps to connect to the AWS RDS instance using the MySQL Workbench from a local machine.

Install MySQL Workbench on local machine

The first step to connect to the AWS RDS is to install MySQL Workbench on a local machine. Update the local repositories on Ubuntu and then install the MySQL Workbench using the following commands.

After installing the MySQL Workbench, check its version to verify the installation.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/10/echo/How-do-I-connect-to-AWS-RDS-using-MySQL-workbench-1.png" data-lazy- height="80" src="data:image/svg xml,” width=”628″>

Create AWS RDS instance

To connect to the AWS RDS instance using MySQL Workbench, first launch a new AWS RDS instance with MySQL engine. First, log into the AWS management console and select the region in which you want to deploy an RDS instance. For this article, we will deploy an RDS instance in the us-east-1 (N. Virginia) region.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/10/echo/How-do-I-connect-to-AWS-RDS-using-MySQL-workbench-2.png" data-lazy- height="245" src="data:image/svg xml,” width=”386″>

Search for RDS from the management console.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/10/echo/How-do-I-connect-to-AWS-RDS-using-MySQL-workbench-3.png" data-lazy- height="229" src="data:image/svg xml,” width=”450″>

From the panel on the left side, click on the Databases.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/10/echo/How-do-I-connect-to-AWS-RDS-using-MySQL-workbench-4.png" data-lazy- height="325" src="data:image/svg xml,” width=”271″>

It will display all the database instances deployed there. From the top right corner, click on the Create database button to create an RDS instance.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/10/echo/How-do-I-connect-to-AWS-RDS-using-MySQL-workbench-5.png" data-lazy- height="112" src="data:image/svg xml,” width=”628″>

Select the Standard create as database creation method and MySQL as Engine type.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/10/echo/How-do-I-connect-to-AWS-RDS-using-MySQL-workbench-6.png" data-lazy- height="368" src="data:image/svg xml,” width=”628″>

From the templates, select the Free tier.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/10/echo/How-do-I-connect-to-AWS-RDS-using-MySQL-workbench-7.png" data-lazy- height="200" src="data:image/svg xml,” width=”628″>

Enter the database name and credentials under the Settings section.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/10/echo/How-do-I-connect-to-AWS-RDS-using-MySQL-workbench-8.png" data-lazy- height="500" src="data:image/svg xml,” width=”628″>

Under the Connectivity section, select the VPC you want to deploy the RDS instance in and make the RDS instance publicly available as we will access the RDS from our local machine.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/10/echo/How-do-I-connect-to-AWS-RDS-using-MySQL-workbench-9.png" data-lazy- height="421" src="data:image/svg xml,” width=”628″>

After selecting the VPC, now select the VPC security group and the availability zone.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/10/echo/How-do-I-connect-to-AWS-RDS-using-MySQL-workbench-10.png" data-lazy- height="268" src="data:image/svg xml,” width=”628″>

Leave the rest of the configuration as default and click on the Create database button at the end of the page.

To get the hostname of the RDS instance, go to the databases from the left side panel.

<img alt="" data-lazy-src="https://kirelos.com/wp-content/uploads/2021/10/echo/How-do-I-connect-to-AWS-RDS-using-MySQL-workbench-11.png" height="263" src="data:image/svg xml,” width=”270″>

Click on the newly created database, and it will show all the details of the database there.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/10/echo/How-do-I-connect-to-AWS-RDS-using-MySQL-workbench-12.png" data-lazy- height="222" src="data:image/svg xml,” width=”459″>

From the connectivity & security tab, copy the AWS RDS instance endpoint and the port as it will be used to make the connection with the RDS instance from the MySQL Workbench.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/10/echo/How-do-I-connect-to-AWS-RDS-using-MySQL-workbench-13.png" data-lazy- height="456" src="data:image/svg xml,” width=”451″>

After creating the RDS instance, now configure the security group attached to the RDS to allow connection from the internet. A security group is a virtual firewall to allow or block traffic to the RDS instance. By default, the security groups block connections from the internet. From the management console, search for the EC2.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/10/echo/How-do-I-connect-to-AWS-RDS-using-MySQL-workbench-14.png" data-lazy- height="241" src="data:image/svg xml,” width=”436″>

From the panel on the left side, click on the Security Groups under the Network & Security section. It will display all the security groups available in the region.

<img alt="" data-lazy-src="https://kirelos.com/wp-content/uploads/2021/10/echo/How-do-I-connect-to-AWS-RDS-using-MySQL-workbench-15.png" height="204" src="data:image/svg xml,” width=”230″>

Click on the security group attached with the MySQL RDS instance, CustomSG, for this demo.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/10/echo/How-do-I-connect-to-AWS-RDS-using-MySQL-workbench-16.png" data-lazy- height="104" src="data:image/svg xml,” width=”628″>

Click on the Edit inbound rules button to add an inbound rule to the security group from the Inbound Rules.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/10/echo/How-do-I-connect-to-AWS-RDS-using-MySQL-workbench-17.png" data-lazy- height="175" src="data:image/svg xml,” width=”628″>

Add a new rule to allow traffic from port 3306 as, by default, the MySQL server runs on port 3306. After adding the rule, click on save rules to save the security group rules.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/10/echo/How-do-I-connect-to-AWS-RDS-using-MySQL-workbench-18.png" data-lazy- height="60" src="data:image/svg xml,” width=”628″>

Connect to AWS RDS using MySQL Workbench

So far, we have installed MySQL Workbench on the local system and launched a MySQL RDS instance on AWS. Now it is time to connect to the MySQL RDS instance using the MySQL Workbench. Open the MySQL Workbench by running the following command.

It will open the MySQL Workbench. Click on the ( ) symbol, and it will ask for the database connection parameters.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/10/echo/How-do-I-connect-to-AWS-RDS-using-MySQL-workbench-19.png" data-lazy- height="280" src="data:image/svg xml,” width=”561″>

Enter all the required connection parameters of the AWS MySQL database server and click on the Test Connection button to connect to the database server.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/10/echo/How-do-I-connect-to-AWS-RDS-using-MySQL-workbench-20.png" data-lazy- height="392" src="data:image/svg xml,” width=”624″>

Now it will ask for the password of the RDS instance. Enter the password for the RDS instance and click on the OK button to test the connection.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/10/echo/How-do-I-connect-to-AWS-RDS-using-MySQL-workbench-21.png" data-lazy- height="205" src="data:image/svg xml,” width=”624″>

After entering the password, it will inform whether the connection was successful or not.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/10/echo/How-do-I-connect-to-AWS-RDS-using-MySQL-workbench-22.png" data-lazy- height="285" src="data:image/svg xml,” width=”433″>

Now from the new connection setup, click on the OK button instead of Test Connection to add AWS RDS instance connection settings to the MySQL Workbench.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/10/echo/How-do-I-connect-to-AWS-RDS-using-MySQL-workbench-23.png" data-lazy- height="396" src="data:image/svg xml,” width=”628″>

It will add a MySQL connection on the dashboard of the MySQL Workbench.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/10/echo/How-do-I-connect-to-AWS-RDS-using-MySQL-workbench-24.png" data-lazy- height="237" src="data:image/svg xml,” width=”558″>

To connect to the AWS RDS instance, double click on the AWS RDS connection, and it will start connecting to the RDS instance.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/10/echo/How-do-I-connect-to-AWS-RDS-using-MySQL-workbench-25.png" data-lazy- height="221" src="data:image/svg xml,” width=”449″>

After sometime, it will ask for the password of the AWS RDS instance. Enter the password of the RDS instance and click on the OK button to connect to the instance.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/10/echo/How-do-I-connect-to-AWS-RDS-using-MySQL-workbench-26.png" data-lazy- height="205" src="data:image/svg xml,” width=”624″>

After providing the password, it will connect to the AWS RDS instance and open a nice graphical user interface for the RDS instance on the MySQL Workbench.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/10/echo/How-do-I-connect-to-AWS-RDS-using-MySQL-workbench-27.png" data-lazy- height="356" src="data:image/svg xml,” width=”628″>

In order to create a new schema using MySQL Workbench, click on the new schema button on the menu bar.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/10/echo/How-do-I-connect-to-AWS-RDS-using-MySQL-workbench-28.png" data-lazy- height="221" src="data:image/svg xml,” width=”512″>

It will open a new tab asking for a schema name to be created.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/10/echo/How-do-I-connect-to-AWS-RDS-using-MySQL-workbench-29.png" data-lazy- height="252" src="data:image/svg xml,” width=”494″>

Enter the schema name and click on the Apply button at the bottom right corner of the tab. It will open a new window with the SQL query to create the new schema asking for your confirmation if you want to run the query.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/10/echo/How-do-I-connect-to-AWS-RDS-using-MySQL-workbench-30.png" data-lazy- height="653" src="data:image/svg xml,” width=”546″>

Review the SQL query and click on the Apply button at the bottom right corner of the window to create the schema. Similarly, different SQL queries can also be performed by using a graphical user interface on MySQL Workbench.

Conclusion

MySQL Workbench is a desktop application that provides a nice graphical user interface of the relational database server. It is difficult for beginners to use the command-line interface to perform queries to the database server. MySQL Workbench provides a nice view of the database server and makes it easier to perform SQL queries. This blog describes different steps to connect to the AWS RDS server using the MySQL Workbench.

About the author

<img data-del="avatar" data-lazy-src="https://kirelos.com/wp-content/uploads/2021/10/echo/Zain-150×150.jpg615bbdc0eabe8.jpg" height="112" src="data:image/svg xml,” width=”112″>

Zain Abideen

A DevOps Engineer with expertise in provisioning and managing servers on AWS and Software delivery lifecycle (SDLC) automation. I’m from Gujranwala, Pakistan and currently working as a DevOps engineer.