DEV Community

Zahraa Jawad
Zahraa Jawad

Posted on

Simple creation of AWS RDS (relational database service) instance and connected

What is Amazon Relational Database Service?

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.

Amazon RDS DB instances

A DB instance is an isolated database environment running in the cloud. It is the basic building block of Amazon RDS. A DB instance can contain multiple user-create databases, and can be accessed using the same client tools and applications you might use to access a standalone database instance. DB instances are simple to create and modify with the AWS command line tools, Amazon RDS API operations, or the AWS Management Console.

AWS RDS (relational database service) engine :

Amazon Relational Database Service RDS is a managed relational database service that provides you seven familiar database engines to choose from, including :

1- Amazon Aurora MySQL
2- Amazon Aurora PostgreSQL
3- MySQL
4- MariaDB
5- PostgreSQL
6- Oracle
7- Microsoft SQL Server

Amazon RDS storage types

Amazon RDS provides three storage types:

• General Purpose SSD (also known as gp2 and gp3).
• Provisioned IOPS SSD (also known as io1).
• magnetic (also known as standard).

They differ in performance characteristics and price, which means that you can tailor your storage performance and cost to the needs of your database workload. You can create MySQL, MariaDB, Oracle, and PostgreSQL RDS DB instances with up to 64 tebibytes (TiB) of storage. You can create SQL Server RDS DB instances with up to 16 TiB of storage. For this amount of storage, use the Provisioned IOPS SSD and General Purpose SSD storage types.

Creation of Relational Database Service RDS

Image description

Image description

• Select the version of the engine - in this practice we will connect to the version 8.0.25
In Templates:
• choose a sample templates to meet your use case
Here we choose the free tier template.

Image description

In settings:

Image description

In instance configuration:
• Choose the database instance class that meet your processing power and memory requirement, here we have option of Burstable classes that include t classes (all other are disabled for us because we have selected free tire option).

Image description
Note: if we have choose another template, the additional DB instance classes will be able to be usage.

In storage:
• Choose the type of storage
• Allocate a size for storage, the minimum value and maximum value for storage depend on the type of storage.
• You can enable storage autoscaling by select the checkbox.

Image description

In connectivity:
• You can choose whether to set up to a connection to a compute resource for the database will be manually or automatically .
• For the virtual private cloud (VPC), we will choose a VPC or use the default VPC and subnet group.

Image description

In public access:

Image description

In additional configuration: the port of the database is 3306.

Image description

For the DB authentication: choose the option you use to be authentication your DB.
Here we use the password authentication to use username and password to log in to DB.

Image description

In additional configuration:
• You can choose make a backup, maintenance, ClodWatch logs, delete protection by click on the checkbox for any services.

Image description

The creation of database is being starting.

Image description
And after a few of minutes our database is successfully creation.

Image description

To open our database details, click on the database name to open it.

Image description

Connect to the database:

After we have created our database, we now need to connect to our database to enter the data we need.
There are several ways to connect to the database:
• One way is to use Connect with MySQL Workbench.
• Or through by ec2 instance to connect to the database.
In this practice, we will use an ec2 instance which is have the security group are all open inbound and outbound to connect to our database :
Connect to the previously created instance by selecting it and clicking Connect.

Image description
Choose any method of connection to connect to the instance and click on Connect.

Image description

To connect to the database via EC2:

  • After connect to the ec2 instance : install MySQL client 8.0 on Ubuntu by the commend:

Image description
The execution:

Image description

• After the installation is completely and the MySQL client has been install so the next step we will do is we will connect to our MySQL RDS instance.
To do the connection execute the following command:

Image description

Then click enter:

Image description

• Enter the password of the database and click enter:

Image description
Now to create simple table of data let us execute some commands :
• To create database:
Image description

Image description
• To create table:

Image description

Image description

• To insert data to the table:
Image description

Image description

• To view the table:

Image description

Image description
• Insert another row (data) to the table:

Image description
• To view a row :

Image description

Image description
• To exit from the database execute the command :
Image description

Image description

References:

[1]https://aws.amazon.com/rds/
[2]https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Overview.DBInstance.html
[3]https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_Storage.html

Top comments (0)