Lab 2: Using RDS with ASP.NET Applications

In this lab, I move my local Dino Store database to Amazon’s RDS.

First I had to go to RDS in AWS and create a new instance, this was a free tier instance so the settings are default, besides the username and password.

rds.PNG

I also had to set a security group to allow inbound from only my IP address, now I have changed this to anywhere. Reason being is my IP address is not static and I am also moving to and from tech so my IP address will not stay to that IP. Sames me pulling out my hair when I’m trying figure out why my SQL database is not working.

I now need to go to MySQL workbench and connect to my new RDS using the endpoint address.

sql2.PNG

I then edit an excel file with the cloud links and import that into my new cloud database.

excel.PNG

I then imported that and ran it. Now to check my tables have been populated

sql3.PNG

Now that my database is in the cloud I need to create a replica for backup, this is a simple task.

First I need to run the Create a read replica action in AWS

read

I created this in a different zone from my other database because well… If my database goes down because of that zone then so does my backup… Your site is only as smart as you make it!

sql4.PNG

Now I have my replica up I need to connect to in MySQL Workbench.

replica.PNG

Let’s make sure our dinos are in this one.

replica3.PNG

Now let’s make some adjustments so our code takes into account our replica database.

code.PNG

Now I’ll make an adjustment to default.aspx.cs so that the images are pulled from the replica databse,┬átakes the load off the main database a bit, TEAMWORK!

sql5.PNG

Now let’s check it’s still all working.

works.PNG

So now I need to make an account, log in and check that the accounts are being made in the database.

loginlogout

Let’s check that database.

datavse.PNG

It’s all there, this is also on my replica server just to show it’s on both

Now the moment of truth of shutting down the master server and seeing if the website is still active. I can’t really show this is a picture but it worked very well. I am being asked why this still works.

Well, the point of having a replica is that it takes the position of that master if it goes down. It has all the same information as the master database. The point is that you should not even notice if one went down.

 

 

 

Post Author: Techdox

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.