and welcome to the final video of our VPC labs.
In our last video, we were able to create a gnat gateway
and perform a yum update
of our private server
Well, actually create a relational database instance and launch it from within our private sudden it.
We will also create a script
to build and launch our public facing PHP Sever.
It's going to be a fun lesson, so let's get started.
Since this is an introductory AWS course, I haven't included the topic of databases
provided within the AWS platform.
Amazon has a great selection of sequel and no sequel database offerings
that you can and will use as you go further in your cloud career.
Database theory is beyond the scope of our course,
but I will give you the 20,000 foot view
of the my sequel Relational Database
that we will create in this lesson.
Amazon Relational Database service
that makes it easier
for us to build, operate and scale a relational database In the AWS clout,
Amazon RD s manages the backups,
handles software, patching
automatic failure, detection
Essentially, A W s handles all of the data base maintenance for us
permitting us to focus on its administration
for more information about a W S R. D s.
Here is the link to the
frequently asked questions page.
let's get into the AWS console
and type R D s in the search bar.
This takes us to the Amazon RGs dashboard
scroll down to create database,
then scroll down until we reach the setting section.
I'm going to name the instance Cyber Very my sequel, D B.
Since this is just a demo,
I will use this also as mine database, user name and password.
So just copy and paste that in,
under advanced settings,
the subject group remains the same.
By default, our database will not be public
for availability zone.
I will select our private sudden it
We will be creating a new V p C security group
paste in the same value that we use previously.
Leave everything else is default.
Then we just scroll down.
I will disable delish in protection because we will want to delete this data base at the end of the demonstration,
then select, Create database.
Now are instances being created
Quick view database instance details.
And here we can see some of the metrics
that are instances already collecting.
Now we will need to create a new security group. So let's scroll down to the security groups section
Next, click the inbound tab under our security group,
We were at a role to our security group that will permit our public sub net
to talk to our private instance on TCP 3306
which is the port that our database uses.
toe auto populate our security group.
Remember, we have to perform this step
or else our RD s instance will not be able to communicate with our front end PHP server
in the public sub net.
So now let's launch our public facing server.
we will use a script to create our PHP, sir.
select the usual tea to micro instance,
we will launch within our public vpc
in our public sub net
leave. The rest is default.
quick advanced details.
Here's the script that we will be adding
the first line begins with shebang and then points to the path of our bash interpreter.
The next line installs our PHP Apache server.
we perform a U M update of the OS
Next line we checked to see if our
server process is running.
Next time we start the service
we will print out the PHP info toe our landing page called index dot PHP.
Then we change directories to the Apache server directory.
we issue a w get to retrieve a file
that I have already uploaded to an S three bucket
that will contain the connection information for our database. Instance
that PHP file looks like this.
It's a small P H P script
that creates connection to our database.
It supplies the AWS in point
the database user name
invariable called con.
If it fails to connect, then it will give us an error.
If the connection is successful, then it will print
that it successfully connected.
that's paste in our bootstraps script.
then let's add attack
for name. I would just re use our old public Web server name
select an existing security group.
Let's select our existing key pair.
Next, I will filter on just our new instance.
So let's give that some time to boot up.
Great. Now it's running.
Let's copy the I P address to the clipboard
and test it out on our browser.
Cool. So our Pitch P bootstrap script worked.
Now let's log into our PHP server. Instance.
We will copy our private key to the dashboard,
then connect to our PHP server using the SS H agent forwarding
Awesome we were able to authenticate.
Now let's make ourselves route
and then change directories to our Apache server directory.
That's if I can type in the correct directory.
So when we perform a list on the directory, we see two files.
If you recall in our script,
D B Connect that PHP file
from Rs three Bucket toe are patchy server directory.
our script appears to have worked correctly.
Let's edit the D B connect dot PHP file
type nano space, D B connect dot PHP.
We will need to edit the variable d be host
2.2 R. A W. S R. D s in point.
let's go back out to the council
toe R. R. D s instance
and copy our database in point.
Quick database instances
select our instance.
Then copy our in point.
Now let's paste that into our PHP file,
Now let's go back to our browser
when our PHP info landing page
d b connect dot PHP to connect to our database server
our connection was successful.
If you have remained with us this long,
awesome job, everyone.
You've actually learned quite a bit
and you are well on your way to becoming
and AWS solution architect.
we have created a custom VPC
and we have tested our V p C for reach ability.