In this article we are going to cover How to Create MySQL Database in AWS RDS and How to Connect MYSQL RDS from EC2 Instance
How to Create MySQL Database in AWS RDS
Step #1: In the top right corner of the Amazon RDS console, select the Region in which you want to create the DB instance.
Step #2: In the navigation pane on the left, click Databases. Then click Create Database
Step #3: Select MySQL icon and then click Select.
Step #4: Select MySQL Edition and Version
Step #5: Select DB Engine, DB engine version and DB instance class
Step #6: Input RDS name, Master UserName and master password
Step #7: Configure MySQL RDS Advanced Settings
VPC: Select Default VPC.
Subnet Group: Choose the default subnet group
Publicly Accessible: Choose Yes.
Availability Zone: Choose No Preference.
VPC Security Group(s): Select Create New Security Group -àselect Type as All Traffic and Source Anywhere .(Here we select existing one mydb0001)
Database Name: mydb0001
Port: 3306
DB Parameter Group: Leave the default value of default.mysql5.7.
Option Group: Select the default value of default: mysql5.7.
Enable Encryption: No
Auto Minor Version Upgrade: yes
Maintenance Window: Select No Preference.
Click on Create Database
wait till to configure MySQL RDS once done click on View DB instance details.
How to Connect MYSQL RDS from EC2 Instance
Open MySQL RDS and copy the Endpoint and port number
Open an EC2 instance, install mysql client
on Ubuntu and EC2 Linux
yum -y groupinstall "MYSQL Database Client"
sudo apt-get install mysql-client
To Login MySQL RDS, use below command
mysql –u [MasterUserName] –h [endpoint] –p [password]
Show Databases
To Create database
create database database name
Then Use database Name
Create Table and Insert Data into table
Select , Update and Delete data from Table
Conclusion:
We have covered How to Create MySQL Database in AWS RDS and How to Connect MYSQL RDS from EC2 Instance
Related Articles:
How to Create IAM User in AWS Step by Step
How to Attach IAM Role to EC2 Instance using CLI
How to Create Ubuntu Instance in AWS [7 Steps]
How to Create Linux EC2 Instance in AWS
AWS Create EC2 Instance from Snapshot
How to connect to AWS EC2 Instance using MobaXTerm
How to Enable Password Authentication for AWS EC2
How to Connect EC2 Instance using Putty
How to Transfer files to AWS Instance using WinSCP [2 Steps]
How to Install AWS CLI on Amazon Linux
Lambda Function to Start and Stop RDS Instance
Start and Stop EC2 Instance using Python Boto 3
How to Create AWS DocumentDB and Connect [3 steps]
How to Install MySQL 5.7 on Amazon Linux 2
How to Create Postgres Database in AWS and connect
Monitoring EC2 Instances using CloudWatch
How to Create CloudFront Distribution in AWS
How to Migrate EC2 Instance to another Region
How to Increase EBS Volume size in AWS [4 Steps]
Reference: