You are on page 1of 7

Premier University

Department of Computer Science & Engineering

Course Code : CSE 454

Course Title : Contemporary Course of Computer Science Laboratory

Report No : 04

Report Name : Building DB Server and Interact with DB using an App.

Submission Date : 02.09.2023

SUBMITTED BY

Name : Apurba Ghosh

ID : 1803510201620

Semester : 8th

Section : A2
Title: Building DB Server and Interact with DB using an App.
Objective:
1. Initiate the creation of an Amazon RDS DB instance designed for robust availability.
2. Configure the DB instance to allow connections from a web server.
3. Access a web application and engage with the database.

Introduction:
Amazon Relational Database Service (Amazon RDS) simplifies the process of establishing,
operating, and expanding a cloud-based relational database. It offers cost-effective and scalable
capacity while managing the laborious aspects of database administration, freeing users to
concentrate on their applications and business endeavors. Amazon RDS supports six well-known
database engines: Amazon Aurora, Oracle, Microsoft SQL Server, PostgreSQL, MySQL, and
MariaDB.
Amazon RDS Multi-AZ deployments heighten availability and resilience for Database (DB)
instances, rendering them a logical choice for production-level database workloads. When
provisioning a Multi-AZ DB instance, Amazon RDS automatically generates a primary DB
instance and synchronously duplicates the data to a backup instance located in a separate
Availability Zone (AZ).

Working Methodology:
1. Accessing the AWS Management Console: To start, select "Begin Lab." Once you see the
message indicating "Lab status: ready," close the "Begin Lab" panel by clicking the 'X' and
then select "AWS."
2. Setting Up a Security Group for the RDS DB Instance: We will establish a security group
to enable our web server to connect to our RDS DB instance. This security group will be
employed during the database instance launch. Begin by launching the AWS Management
Console, navigating to the Services menu, and choosing "VPC." In the left-hand navigation
pane, select "Security Groups."
Now, proceed to create the security group and configure it based on the provided instructions.

Security Group Name DB Security Group


Description Permit access from Web Security Group
VPC Lab VPC
Inbound Rules Type Lab VPC
CIDR, IP, Security Group or Type→sg Web
Prefix List Security
Group

1
Figure 1:Security Group Details

Currently, the security group doesn't have any rules. We'll add a rule to permit incoming requests
from the Web Security Group. This configuration allows the Database security group to accept
incoming traffic on port 3306 from any EC2 instance associated with the Web Security Group.
We'll apply this security group when launching the Amazon RDS database.
3. Establishing a DB Subnet Group: We're going to generate a DB subnet group that
informs RDS about the subnets suitable for the database. Each DB subnet group must
include subnets located in at least two different Availability Zones. To do this, navigate to
the Services menu, select RDS, and then choose "Subnet groups" in the left-hand
navigation pane.
Now, follow the instructions to create and configure the DB Subnet Group:

Figure 2:Subnet Groups Info

Name DB-Subnet-Group
Description DB Subnet Group
VPC Lab VPC
Add Subnets Availability Zones us-east-1a
us-east-1b

2
Subnets 10.0.1.0/24
10.0.3.0/24
We will use this DB subnet group when creating the database in the next task.
4. Setting Up an Amazon RDS DB Instance: We'll set up and launch a Multi-AZ
Amazon RDS for MySQL database instance. To start, go to the left-hand navigation
pane and select "Databases." Afterward, click on "Create database."
Now, proceed to configure the database instance as per the following instructions:

Engine Options MySQL


Templates Dev/Test

Availability and durability Multi-AZ DB instance


Settings DB instance identifier lab-db

Master username main


Master password lab-password
Confirm password lab-password

DB instance class (select) Burstable classes (includes t classes)


db.t3.micro
Storage Storage type General Purpose
(SSD)
Allocated storage 20
Connectivity Virtual Private Cloud Lab VPC
(VPC)
Existing VPC security groups Choose DB Security Group

Deselect default
Additional configuration Initial database lab
name

Uncheck Enable automatic


backups
Uncheck Enable encryption

Uncheck Enable Enhanced


monitoring

3
Figure 3: Databases Info

Figure 4: Connectivity & Security Section


We have to paste the Endpoint value into a text editor.
lab-db.cii7laif3bhb.us-east-1.rds.amazonaws.com
Figure 5: Endpoint Value

5. Interacting with the Database: We'll access a web application hosted on our web server
and set it up to utilize the database. To do this, once you've copied the IP address of the
web server, go to the Details dropdown menu located above these instructions, and then
select "Show."

6. 3.92.79.249

Figure 6: WebServer IP Address

4
Now we need to open a new web browser tab, paste the WebServer IP address and press Enter.
The web application will be displayed, showing information about the EC2 instance.

Figure 7: Web Application Homepage

Next, you should click on the RDS link at the page's top. This will initiate the configuration of
your application to establish a connection with the database.
Now we have to configure the following settings:

Endpoint lab-db.cii7laif3bhb.us-east-1.rds.amazonaws.com
Database lab
Username main
Password lab-password

Figure 8: Address Book Info

The Address Book application is using the RDS database to store information.

Now we need to test our application by adding, editing and removing contacts.

5
Figure 9: Edit Contact

Figure 10: Address Book Info

Figure 11: Address Book Info

Discussion:
In this lab, we've gained valuable practical experience in deploying a highly available Amazon
RDS database instance and establishing effective communication between this database and a web
server. The process of launching the RDS DB instance has provided us with insights into creating
a robust and fault-tolerant database infrastructure.
The hands-on interaction with a web application has offered us valuable insights into the seamless
exchange of data between the database and an application. Additionally, we've acquired
knowledge about the importance of optimizing database performance and ensuring the security of
web applications.
In summary, this lab experiment has delivered a comprehensive educational experience in
constructing and managing a resilient database ecosystem that is well-suited for web-oriented
applications.

You might also like