In this video, you will learn
1. How to create RDS (Relational Database Server) instance in AWS?
2. How to connect the RDS database from the EC2 server which we have created in the previous tutorial.
For the security and better performance, we are keeping the application layer and database layer separately.
Amazon Relational Database Service (Amazon RDS) is a web service that makes it easier to set up, operate, and scale a relational database in the AWS Cloud. It provides cost-efficient, resizable capacity for an industry-standard relational database and manages common database administration tasks.
For the list of databases that are already created. Navigate to the Database menu.
Click “create database”.
First Step: Choose a database creation method
Standard Create and Easy Create
In Standard we have to set all of the configuration options including ones for availability, security, backups, and maintenance whereas in easy create, AWS recommended best-practice configurations.
The next option is Engine Options.
You can see there are six different types of Relations database services that you can use in AWS. Amazon Aurora, Mysql, MariaDB, PostgreSQL, Oracle, and Microsoft SQL Server. AWS has Non- Relation database option as well which is DianamoDB which we will learn about it in the upcoming tutorial.
For now, we are going to setup Mysql. MySQL is the most popular open-source database in the world. MySQL offers the rich features of the MySQL community scale with the flexibility to easily scale compute resources or storage capacity for your database.
Now select the Edition or Version of MySQL that you need as per your programming language. For now, let’s choose 5.7.22
Next is the Templates option
Production is used for high availability and fast, consistent performance.
Dev/Test is used for development use outside of a production environment which will be cheaper than production. So let’s choose Dev/Test template for now.
Specify the DB instance identifier name that is unique for all DB instances which will help to identify the database. Note that it’s not the database name.
The next step is to set up a master user of the Database.
Another option is DB instance size
2 vCPUs with 8 GB RAM EBS 450 Mbps
General Purpose SSD
Size for now 8 GB is sufficient.
Another wow feature is auto-scaling. Either you can enable auto-scaling your DB or not.
You can setup min 21Gb and Maximum up to 65536 GB
Next option is Availability and Durability
If you need a backup in case of server down, then create a standby instance that will create a standby in a different availability zone to provide data redundancy, eliminate i/0 freezes, and minimize latency spikes during system backups.
Next is vpc, for now, we are going to set up in Default VPC which we choose the same in EC2.
We are setting up EC2 and RDS instances in the same network so that we have another option Publicly accessible- if we choose No here, RDS will not assign a public IP address to the database. Only Amazon EC2 instances and devices inside the VPC can connect to your database.
Choose the VPC security groups
For now let’s choose the existing vpc security group.
Choose availability Zone.
Currently we are working in north Virginia where are exist 6 availability zones. For now, let go with no preference.
Another is database port –
3306 is the default DB port.
Another option is Database Authentication where we can set up another extra layer of security beside database user name and password that is the IAM role.
There is another Additional Configuration as well
Total monthly bill is 128.67 US Dollar
Click on Create Database.
Another part which is inbound rules in EC2.
In EC2 click in Security Groups
Using TCP request in port no. 3306 from – you can set to anywhere or can specify to allow the request from the particular EC2 instances application as well.
Now it’s running and active.
Open the terminal and connect to the server as you learn before in the previous video.
Install the MySQL client package first.
Sudo apt-get install mysql-client-core-5.7
We can use the MySQL command
Let’s connect to MySQL DB.
Mysql –h endpoint -P 3306 -u admin -p
Now you can create the database, tables.
In this way, you can create an RDS instance for the separate database environment and setup as per your needs in AWS. In the next video tutorial, you will learn how to set up a simple PHP CRUD application using these EC2 and RDS instances.
SUBSCRIBE to our YouTube channel for more videos:
Like us on Facebook: https://www.facebook.com/master2teach
For more content go to https://master2teach.com/