Day 44: Relational Database Service in AWS
Relational Database Service in AWS Create database Page.

Day 44: Relational Database Service in AWS

Dear Learners, In Today's article we will explain Amazon Relational Database Service (Amazon RDS) that how RDS work,definitions & Tasks. So now let's start without wasting the time.

RDS:-

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

No alt text provided for this image
Relational Database in AWS Types flow Diagram

I will Explain with the help of Tasks:

Prerequisites:-

Task-01

Login to your Amazon Account with username and Passoword.

Go to the Amazon EC2 console.

Click on "Launch Instance" on the right side of page. Highlight in orange colour.

Choose a "Linux AMI", give a name to your Ec2 instance.

Choose an instance type according to your need, I have select the t2.micro.

Configure the Security group rules to allow inbound traffic on the Appropriate port for the type of database you are using (e.g port 3306 used for the MySQL).

No alt text provided for this image
Choose an instance type according to your need, I have select the t2.micro Diagram
No alt text provided for this image
In Our Security Group, I will allow the port 3306 used for the MySQL

Launch the instance.

No alt text provided for this image
Launch the instance mention a tag on your isntance Diagram

2 Create a Free tier RDS instance of MYSQL.

Go to the Amazon RDS console. Click on "Create Database option" highlight in orange colour.

No alt text provided for this image
Click on "Create Database option" highlight in orange colour Diagram

In the Database creation method choose the Standard Create.

In Engine option:- I will select the MySQL, you can select according to your need like:- MariaDB, Oracle & PostgreSQL etc.

No alt text provided for this image
choose the Standard Create select the MySQL Diagram.

Choose the "Free tier" template for "DB instance class" no charges for the "free tier"

No alt text provided for this image
Choose the "Free tier" template for "DB instance Diagram.

Next Step:- Enter a unique name for the "DB instance identifier".

Set the "Master username" & "Master Password" for the database, It will used while login the database from the terminal, I will explain in it in Today Task.

No alt text provided for this image
Enter a uniqu e name for the "DB instance Set the "Master username" & "Master Password" Diagram.

Set the "Virtual Private Cloud" and "Subnet group" to create the instance in.

Leave the other settings at their default values.

No alt text provided for this image
"Virtual Private Cloud" and "Subnet group" Diagram.
No alt text provided for this image
Select the Storafe Type Diagram.

Select EC2 instance.

No alt text provided for this image
Select EC2 instance Diagram.

Choose VPC Security Group:-

No alt text provided for this image
Choose VPC Security Group Diagram.

Click on the "Create database" to start the instance creation.

No alt text provided for this image
Click on the "Create database" Diagram.
No alt text provided for this image
Click on the "Create database" Diagram.

Database is created.

No alt text provided for this image
Database is created Diagram.

After completing the Point 1 & Point 2, Move forward to Point to no 3:-

3. Create an IAM role for with RDS access.

Go to the IAM console in AWS. Click on "Roles". click on "Create Role" show in blue colour right side.

No alt text provided for this image
Create an IAM role for with RDS access Diagram.

Choose the "AWS Service"

Choose "Allows Ec2 instance to call AWS Services on your behalf".

No alt text provided for this image
Choose the "AWS Service" Diagram.

Need to be attached the "AmazonRDSFullAccess" policy.

No alt text provided for this image
Need to be attached the "AmazonRDSFullAccess" policy. Diagram

Enter a Unique name for the role.

No alt text provided for this image
Enter a Unique name for the role Diagram.

Click on "Create role"

No alt text provided for this image
Click on "Create role" Diagram

IAM Role is Successfully created, I will highlight in Blu Tick.

No alt text provided for this image

Point No 4 is very Important:-

4 Assign the role to EC2 so that your EC2 instance can connect with RDS.

Go to the Ec2 console.

Select the instance you just created.

Click on "Actions" option then "Instance Settings", then "Attach/Replace IAM Role".

No alt text provided for this image
Click on "Actions" option then "Instance Settings", then "Attach/Replace IAM Role" Diagram

Choose the IAM role you just created.

Click on the "Updated IAM role"

No alt text provided for this image
Choose the IAM role you just created Click on the "Updated IAM role" Diagram.

5 Once the RDS instance is up and running,get the Credentials and connect your EC2 instance using a MySQL client.

Go to RDS console in AWS.

Select the Instance you just created.

Click "Configuration" and note the endpoint address.

No alt text provided for this image
Click "Configuration" and note the endpoint address Diagram.

Click "Security" and note the username and Password.

No alt text provided for this image
Click "Security" and note the username and Password Diagram.

SSH into your EC2 instance using a Terminal or remote access tool.

No alt text provided for this image
SSH into your EC2 instance Diagram.
No alt text provided for this image
Successfully login in account with SSH Key Diagram.

Need to be install the MySQL Client, such as "mysql".I will share the commands it will helpful for you for the installtion.

Syntax:-

sudo apt install mysql-client-core-8.0

mysql --version

No alt text provided for this image
install the MySQL Client, such as "mysql" & Version check Diagram.

Connect to the RDS instance using the MySql client and the endpoint address username, and Password.

mysql -h <endpoint address> -P <port.no> -u <username> -p        

Enter the password when prompter and press enter:-

you should now be connected to the MySQL database on the RDS instance.

Syntax:-

sudo mysql -h database-1.c4mwnlabtvwh.ap-south-1.rds.amazonaws.com -P 3306 -u admin -p

Enter the Password:- <>

you are enter in the mysql:-

mysql>

show databases;

No alt text provided for this image
sudo mysql -h database-1.c4mwnlabtvwh.ap-south-1.rds.amazonaws.com -P 3306 -u admin -p Diagram

(Note) if your RDS are not access please check the Endpoint address in RDS. It will take one or 2 min for access.


In this blog, I have discussed RDS Definition, create a database,attach with the IAM Role . If you have any questions or would like to share your experiences, feel free to leave a comment below. Don't forget to read my blogs and connect with me on LinkedIn and let's have a conversation.

Thank you for reading !! I hope you find this article helpful!!

Happy Learning!!


Next Topic:

Day 45: Deploy Wordpress Website on AWS


Aakib Khan

Cloud computing | AWS | GCP | Azure | DevOps | 30k+ LinkedIn |Kubernetes | Docker| Terraform | Jenkins | 5 million+ impressions

1y

Well written

To view or add a comment, sign in

Insights from the community

Others also viewed

Explore topics