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