Amazon RDS

Lab Goal

In this lab, we will launch Amazon RDS with high availability and configure it for a web server to access. In addition to that, we will test a web application to interact with the database. This would be the network scenario look like. The setup has been initially created except all the configurations for RDS.

Figure 1. Lab scenario

Create a Security Group for the RDS DB Instance

Go to Services > VPC to create a security group for RDS. On the left pane, go to Security Groups and find Create security group button. Configure you security group as below. Click Create.

Figure 2. Create security group for DB

Now, select the DB Security Group and go to Inbound Rules. Click Edit rules. Add a rule as configured below. The source is from the Web Security Group which is a security group used by the web server instance. Save the rule.

Figure 3. Add inbound rules

Create a DB Subnet Group

Move to RDS dashboard from the Services menu. Then, go to Subnet groups fromt the left pane. Click on Create DB Subnet Group. Configure the subnet as shown in figure 4 and 5. AWS will require the DB subnets to cover at least 2 availability zones. Click Create to finish.

Figure 4. Create DB subnet group
Figure 5. Configure subnets

Create an Amazon RDS DB Instance

To create the RDS instance, go to databases from the left pane and click on Create database. Make sure you select MySQL as the engine. Give the DB a name and credentials as well.

Figure 6. Database engines

For instance size, select burstable classes and for this lab purpose we will use db.t3.micro. Minimum storage for the database is 100 GiB so we will leave it that.

Figure 7. Database size configuration

For the connectivity setting, make sure the correct VPC is selected and configure the rest as below. In addition to that, make sure the DB security group is added to the database.

Figure 8. Database network configuration

Under Additional configuration, give the Intial database name (mine is lab) and uncheck Enable automatic backups and Enable Enhanced monitoring. These components are recommended to be on but for the purpose of this lab, it would be faster and easier to turn it off. Click create database.

It will take several minutes to wait until the database becomes available. After it is done, it will look like the figure below. Notice the URL under Endpoint, for the next task, copy the URL to the clipboard.

Figure 9. Database created

Interact with the Database

The idea here is that this web application which is already provided will connect the user to the DB instance with the correct credentials. Get your web server IP address either from the lab details or you can find it on your running instances in EC2.

Access that IP address from your browser and you will access the web application. Click on RDS from the top navigation and paste the DB endpoint to the Endpoint field. fill in the database name and the credentials.

Figure 10. Connect to mySQL

It will take several minutes to process and once it is done, the web application will successfully retreive the data from the database.

Figure 11. MySQL successfully connected

Critical Thinking

What we have done in the lab was actually implementing a high availability database which resides in two availability zones. Even AWS requires the database subnet group to be set up with a minimum of 2 subnets to provide redundancy. The lab was pretty straightforward, however there were just slight differences from what the lab has given that I would assume that changes from recent updates. This would include setting up 2 subnets at once and having a minimum of 100 GiB of storage for the database.

RDS can also activate a read replica which can highly increase the overall performance of an application. The idea is to deploy the DB on more than one Availability zones, one of the instances will provide the capacity to write and the other replica would be used for read replica. Thus, this provides two ways communication through different connection and will result in better performance.

In my opinion, one of the best feature of RDS is its ease of use. The databse you deployed are already pre-configured and are fully ready to be connected to your application. It also supports most database engines. AWS is also equipped with different kinds of database services which might fit the need of the architecture better. Amazon RDS is just one of the most commonly used and versatile service that fits in most cases.

Leave a comment