Connect  your AWS Relational Database Server running MySQL to your EC2 instance

Connect your AWS Relational Database Server running MySQL to your EC2 instance

Amazon Relational Database Service (Amazon RDS) is a collection of managed services that makes it simple to set up, operate, and scale databases in the cloud.

Open your AWS Management Console, and search for RDS in the search bar. Create an RDS Database using MySQL as the Database Engine, and select a template of your choice (let's say Free Tier), select availability and durability. Enter a name for your DB cluster identifier, enter a master username, choose a desired password, choose your connectivity settings, and connect to your desired VPC where you want to run your EC2 instance. Click on create database and wait for some time as it takes time (~5-7 mins) to create your database.

After the database is created, go to your EC2 dashboard and create an EC2 instance with AMI as Amazon Linux. When the instance gets created, select your instance and click on Actions > Instance Settings > Connect RDS database.

Now, it's time to connect your instance using SSH and set up the MySQL client. Use the following for Amazon Linux :

yum install mariadb

apt-get install mariadb-client

To connect to RDS through your EC2 instance :

mysql -h <end-point of RDS> -P 3306 -u <master user name> -p

You are now connected to your RDS using EC2.

For more information and to install MySQL Workbench follow the given link : https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_ConnectToInstance.html