Okay hello bloggers and welcome to this lecture in this lecture we're going to look at how we can build
a fault tolerant or WordPress site on a W.S..
We're going to use a whole bunch of different technologies.
So here's a network diagram what it's going to look like.
Got our user here.
They're going to be browsing to the Internet.
They're going to hit our Route 53 domain name.
This is completely optional you don't have to do it.
You could just use our application load balancer and then essentially they're going to go in and that's
going to connect up to an elastic load balancer in the cloud where they're going to have some easy two
instances behind an auto scaling group.
They're going to be in separate Availability Zones and we're then going to have some ideas instances.
Again this is going to be multi easy going to have to S3 Buckets one is going to have our media assets
for our WordPress site and the other one's going to have our code for wordpress.
And essentially we're going to serve out all our pitches from our WordPress sites through cloud front.
So we're going to be using a whole bunch of different AWOL technologies.
Once this has been built we're going to go in and simulate a failure in our easy to environment as well
as in our ideas environments see how that affects our site.
So let's go and log into the adobe us console.
Okay.
So here I am in the age of Yes management console.
We're going to go over to S3.
We're going to set up our S3 Buckets first.
Then we're going to go ahead and create a bucket.
I'm going to call this a cloud guru Wordpress and then my initials and then the year.
So 19 something like that going to do this in the Irish Region.
You can do this in USD 1.
The reason I'm not using USD 1 right now is I'm having DNS issues within my default VPC.
Not really sure what it is but I'm just gonna use the Irish Region.
I'm gonna go ahead and just create this bucket Oh before I do this.
So this is a cloud guru WordPress.
And then I'm going to put in here what it's for.
So this bucket is going to have our code and I'm just going to go ahead and copy this into the clipboard
and go ahead and hit create.
And that has now created my bucket.
Then I'm going to go in here and change this from code I'm going to call it images something like that.
So this is where all our media assets are.
Maybe I'll just call it media and there we go.
I'm going to go ahead and hit create soon now go to our two buckets that are in there our easy two instances
will be using this as will cloud front.
Let's go over it and create a cloud front distribution because that does take some time.
So we're going to go over to cloud front in network content and delivery and I'm going to go ahead.
I've got my cloud front distribution left over from another lab has been disabled so I'm just going
to quickly delete that as well.
And then what I'm going to do is I'm going to go in and create a new distribution.
So that has now been deleted and I'm gonna go and use a web distribution the origin domain name.
So where what is this going to be doing.
Well this is going to be fronting our media bucket.
So you want to click on the media on the origin path.
We can leave as blank because we're not going to have any pilots within it.
Origin idea can be that restrict bucket access I'm just going to leave that as no GDP in each.
Yes I'm basically going to leave everything as the default values scroll all the way down to my at the
very bottom.
I'm going to go ahead and hit create distribution and that has now created a distribution and that's
going to take some time.
The other thing that will take some time is our ideas provisioning.
So before we go to ideas what we need to do is just go down to our network.
So we need to go over to VPC.
And what we're going to do is just create some security groups.
So we're going to create a web DMZ.
If you don't already have one.
So let's go over to our security groups and just to clean up.
I'll just delete this one and my RDX launch was its one so that we don't have them.
So delete those security groups.
And there we go.
One of them has a dependent objects probably like an easy to instance.
So I'm just gonna go ahead and cancel.
So let's just look at where DMZ rather than deleting it.
We're gonna go to my inbound rules server.
Loud port 80 and port 22 hopefully you've done that as well with the address security group in here
we've got RDX and you just need to make sure that you've got the mice sequel port support 3 3 0 6 open
to your Web DMZ security groups.
That's to be eight.
And if I just click over here I should be able to see it.
So to be eight you haven't done that's very easy to do or you need to do is go in and hit Admiral and
then custom rule and then scroll down until you find the sequel or report and then in here just type
SMG and you'll be able to see your security groups sometimes you can get a weird UI thing where it's
like hidden or you have to do is hit space and then you'll be able to select it.
So I'm going to open it up to my Web DMZ and I'm going to go ahead and hit say rules and there we go
soon.
Now I've got my my sequel port which has opened up to my secure my web DMZ security group.
Next thing we need to do is go over and provision our ideas for instance.
So we're gonna go over to databases Okay so we're gonna go ahead and hit create database.
And we're going to go and do this using the my sequel database a click in here and then we're gonna
go down and you just want to use the dev test template.
I'm gonna leave my sequel at the latest version.
The database names we're just gonna do a cloud guru for everything so just copy and paste that into
your clipboard and use it for the master user name the master password and to confirm the master password
in here.
Let's go over to our personal class and just do a T2 micro.
I was going to scroll down but just going to use general purpose storage.
We will enable storage order scaling but we shouldn't really go over the 20 gigs.
Depends how big your WordPress site gets to be honest.
And here we are going to create a stand by instance for multi easy.
So we are definitely going to do that down here.
We're going to deploy it into our default BPC.
Make sure you click in here and do additional connectivity configuration.
We don't want it publicly accessible and we want to instead of putting it to our default security group
we want to put it into our RDX launch was one which we just you know previously opened up to our Web
DMC.
So go ahead and select that and then we're gonna go all the way down in here we've got our additional
configuration.
It's really important to click in here because you need to name your database if you do not specify
a database name Amazon ideas will not create a database and that means when you're provisioning your
WordPress instance it has no database to connect into.
So let's just call the database a cloud guru.
We're going to leave everything else as default monitoring we probably don't want enhanced monitoring.
So I'm just gonna uncheck that I'm going to leave everything else as default and then I'm gonna go ahead
and create my database.
So that is now creating our database.
It will take a little bit of time to bring that up online.
So it is now creating our RDX instance we've created our to S3 Buckets we've changed our security groups.
Let's go just over to identity access management first of all and you'll probably already have a role
that allows us to talk to S3.
I'm just going to create a new one just so we can see how we do it.
So you're gonna need this role for our easy two instances to speak to S3 just type in S3 and now we
can add the S3 full access gonna go add my tags I don't need any.
And in here I'm just going to call it s for wordpress.
So this is the new role and we're gonna go ahead and create this role and that has now created the role
and the very last thing we need to do is go over and provision our easy to instance.
So I'm gonna go in and launch our instance we're gonna use the amazon Linux 2 a.m..
And we're gonna go ahead and head next.
And in here we're going to leave everything as default except we are going to change the roll over to
our S3 for wordpress and then in here we're going to paste in a boot straps script.
So this is our WordPress script.
Essentially what it's gonna do is it's gonna go in.
It's gonna install Apache page P and my sequel.
In fact on also just make sure it does a young update first see update minus.
Yes so it's going to update our OS.
It's gonna go and install Apache pitch and my sequel it's going to go to Alvar dub dub dub.
Each metal directory.
It's gonna create a file for our health checks.
So when we put our health checks on our elastic load balancer it's gonna add it in.
And it's just going to create a file called Healthy dot reached him all saying gonna go and get the
latest version of WordPress essentially what it does here is it unzips it it copies it across to the
right directory it then removes the install directory it then removes the file that it downloaded the
zip file in order to install it we then do some permission changes so WordPress will actually work in
our directory and then we go and we're going to go and get what's called a hasty access and I'll explain
that a bit later and then we just rename it so that it's a hidden file which he access will allow us
to do our U.R.L. rewrites or allow us to serve content out of cloud front rather than doing it out of
out of our S3 Buckets and then it's going to make sure that our Apache will start backup in case our
easy two instances restarts.
So that's all this script does.
Let's copy it into a clipboard and then just down here we can paste it in and there we go.
And next we're going to go ahead and add our storage and I'm just going to use general purpose next.
Going to add our tags I am going to give this a name.
It's gonna be name and then my golden image.
Something like that.
Then go ahead and configure our security groups select an existing one and then just using our Web DMZ
security group that's where we're gonna put it in and then we're gonna go ahead and hit review and launch
and we're going to go ahead and launch our easy to instance and make sure you've got access to your
key pair.
So that is now launching.
So it will take a while for everything to come back up.
You're gonna have to go over and check cloud front to make sure that the distribution is ready so my
one is now enabled.
And you're also gonna have to go over two ideas and make sure your ideas database is ready to go as
well.
Have a look at my one whether or not it's already in here.
We can see it's still modifying so I need this to be active and then I also need my AC to instance to
come up online.
So I'm going to pause a video or going to end the video here.
I'm gonna wait for about probably about 10 or 15 minutes and then we'll go on and do some more clouding
so if you've got the time please join me in the next lecture.
Thank you.