Build Your DB Server and Interact With Your DB Using an App
Objective:
This lab is designed to demonstrate how to set up and manage a relational database using Amazon RDS (Relational Database Service) with high availability features. It involves configuring an RDS instance, connecting it to a web application, and testing database interactions.
Summary:
Create a Security Group for the RDS DB Instance.
Create a DB Subnet Group
Create an Amazon RDS DB Instance
Interact with Your Database
Create a Security Group for the RDS DB Instance
Navigate to VPC:
Go to Services > VPC under Networking & Content Delivery.
Select Security Groups from the left navigation pane.
Create Security Group:
Click Create security group.
Set Security group name: DB Security Group.
Set Description: Permit access from Web Security Group.
Select VPC: Lab VPC.
Click Add rule:
Type: MySQL/Aurora (3306).
Source: Type sg and select Web Security Group.
Click Create security group.
Navigate to RDS:
Go to Services > RDS under Database.
Select Subnet groups from the left navigation pane.
Create DB Subnet Group:
Click Create DB Subnet Group.
Set Name: DB Subnet Group.
Set Description: DB Subnet Group.
Select VPC ID: Lab VPC.
Add subnets in at least two Availability Zones:
Availability Zones: Select two zones.
Subnets:
First AZ: 10.0.1.0/24
Second AZ: 10.0.3.0/24
Click Create.
Create an Amazon RDS DB Instance
Navigate to Databases:
- Go to Services > RDS > Databases.
Create Database:
Click Create database.
Choose Standard create and select MySQL as the engine.
Choose Dev/Test template and Multi-AZ DB Instance for availability.
Configure DB settings:
DB instance identifier: lab-db.
Master username: main.
Master password: lab-password.
Select instance class: db.t3.medium.
Configure storage: General Purpose (SSD).
Under Connectivity, select:
VPC: Lab VPC.
VPC security group: Select DB Security Group.
Uncheck Enable Enhanced monitoring.
Uncheck Enable automated backups.
Click Create database.
Wait for Database to be Available:
Monitor the status until it changes to Modifying or Available.
Copy the Endpoint from the Connectivity & Security section.
Interact with Your Database
Open Web Application:
Open a new browser tab, paste the IP address, and press Enter.
Click the RDS link in the web application.
Configure Application:
Enter the following details:
Endpoint: Paste the RDS endpoint.
Database: lab.
Username: main.
Password: lab-password.
Click Submit.
Test the Application:
- Add, edit, and remove contacts in the Address Book application to verify that data is stored in and retrieved from the RDS database.
Subscribe to my newsletter
Read articles from mahpara jabbar directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by