Please note that this content is targeted for solutions architects and 1
SysOps administrators if you're a developer you may want to skip over this 2
one. Welcome back to BackSpace Academy. In this lab we're going to 3
create two ec2 service one of them running the WordPress application and 4
then another that will be running the Magento application once we've done that 5
and we've got those set up and running we're going to put an application load 6
balancer in front of those and then we're going to put them inside of a 7
target group and then implement path based routing for requests that have to 8
go to either that WordPress application or the Magento ecommerce application 9
okay so starting off now in the ec2 console I'm just going to create these 10
two instances one first one being for the WordPress application so we just go 11
into the ID our AWS marketplace and we just search for WordPress and we just 12
grab that that Bitnami one there. We'll select the t2 micro and we'll give it a 13
public IP address and we'll leave storage as it is we're going to add a 14
tag just for the name of those instances and we'll call this one WordPress and we 15
just create a new security group there and we'll launch that 16
okay now we just launched our Magento server as well so again we go into the 17
marketplace and just search for a Magento AMI that one will be fine from 18
BitNami and again a t2 micro will be okay we'll give this one a public IP 19
addresse and we'll give it a name as well so name has to be with a capital 20
"n" at the start as well and a new security group will be fine and we'll 21
just launch that 22
after a certain amount of time those instances will be up and running and 23
have passed their status checks so we just have a look at the Magento one and 24
if we go to the public IP address for that one and have a look at it we can 25
see there that we've got the luma standard template for Magento there so 26
Magento is working fine and we'll just check that the WordPress is working as 27
well so just go to the public IP address for that and there is the WordPress 28
front page so everything everything seems to be working fine so the next 29
thing we'll do is that we will create targets for our load balancers so we're 30
going to target groups and we create a target group so the first one we will call 31
WordPress and we just leave that as it is and create that and we'll create 32
another target group and that one of course will be Magento and create that 33
so now that we have our target groups created we need to add targets to them 34
so we'll go to the Magento one and we just click on the targets tab and we 35
edit that and then we can select our Magento target there or a Magento 36
instance and we can add two registered and there it is up the top there and 37
then we just click on save and we do the same for WordPress so we select the 38
WordPress target or target group we click on edit and again we select the 39
WordPress instance we add two registered and it comes at the top there and we say 40
that so now when we look at our WordPress target group we can see that 41
there is actually a target in there which is our WordPress instance and the 42
same with a Magento we can see there that we've got that Magento instance 43
there so we have our target group set up and we also have our target inside that 44
being the relevant instances now what we can do start creating our load balancer 45
so we click on low balances and create load balancer now we 46
have the three options here so we've got our application our network and our 47
classic load balancer of course we're selecting here application load balancer 48
and we'll call this one log will be fine 49
and we just leave it with a port 80 Lister and our availability zones will 50
select all of the available zones even though we've only got instances in 51
in one availability zone we'll select all of them and the elastic load 52
balancer will look after that force just click on configure security settings and 53
configure security groups will create a new security group and we'll leave that 54
as it is so now we've got a Kent configure our default route for the 55
elastic load balancer so when when requests come in and there is no actual 56
rule for that particular request by default they will go to this actual 57
route so we want them to by default there is no other rule we would block it 58
to go to our WordPress site and so we just do that exit the existing target 59
group WordPress and that will be fine and register targets and we can see 60
we've already got an instance that we've registered before with that target 61
group anyway, we review and then we can create 62
so now we've created our load balancer and we've got a default route so that 63
when something comes through it can go straight through to that WordPress site 64
but we haven't got it set up to handle requests to our story to our Magento 65
site so what we've got to do is we've got to do that so what we need to do is 66
we we select our elastic load balancer we click on the listeners tab and we go 67
to our existing listen that we've got there and we need to view/edit rules 68
because we can see there we've got our default which is forwarding to WordPress 69
so now we need to view/edit rules and add another rule for that so we click on 70
add rule and insert rule we select path and the first path will be we'll call it 71
store and that forwards to a Magento and we'll save that now we need to do 72
another rule which is for everything below store so again we select path and 73
we can we do store and then we do forward slash and then the wild-card 74
symbol and that again will forward to Magento so anything that has store in 75
its path will get forwarded through to our Magento site so that's fine now we 76
can go back to our load balancer and what we can do now is we can go to the 77
the dns name for our load balancer and we should see our wordpress site and 78
there we have our wordpress site as we would expect so now we need to do is is 79
put our path for store and see what happens okay so it's it's directed to 80
our Magento site we can see there we've got the luma template for Magento it has 81
said it that it cannot find that actual page and the reason for that is that the 82
the URL for the home page that he set in the Magento software will not be the 83
same as what we've got here so if you're going to do this for real you would go 84
back into your Magento software and make sure that the home page setting for 85
Magento will be the same as what you've got up here so that brings us to an end 86
what we'll do now is we'll go through and delete everything to make sure that 87
we don't get a nasty bill at the end of the month now the first thing we need to 88
do is to first off delete our load balancer, so we go actions delete and 89
that's gone, and now we need to delete our target groups, so we'll select our 90
target groups here and we'll delete those as well and they're gone, and then 91
once we've done that we can then delete our instances or terminated instances so 92
we just select both of those and we'll terminate both of those instances okay 93
so that brings us to the end of this lab I hope you've enjoyed it and I'll see 94
you in the next one