0 1 00:00:00,439 --> 00:00:06,180 Now that we've created our VPC architecture we can now look at 1 2 00:00:06,180 --> 00:00:12,360 deploying our ec2 instances into that VPC, so the first thing we need to do 2 3 00:00:12,360 --> 00:00:18,660 before we create an ec2 instance is that we need to create a security group for 3 4 00:00:18,660 --> 00:00:23,220 that instance so what we do is again we go to the ec2 section we scroll down to 4 5 00:00:23,220 --> 00:00:27,420 the security group and we drop that on to the VPC we don't drop that onto the 5 6 00:00:27,420 --> 00:00:34,170 public subnet drop it onto the VPC okay we'll rename that again so we click on 6 7 00:00:34,170 --> 00:00:43,290 components and I'm just going to rename there any in backspace ec2 SG will be 7 8 00:00:43,290 --> 00:00:52,800 fine for us and we'll update our designer so now our security group has a 8 9 00:00:52,800 --> 00:00:59,129 number of the dots that the the all of these icons have has depends on but the 9 10 00:00:59,129 --> 00:01:02,550 one that we're interested in now is in the bottom right hand side here we've 10 11 00:01:02,550 --> 00:01:09,180 got VPC ID so if we click on that we can see the VPC is seen highlighted and 11 12 00:01:09,180 --> 00:01:13,890 we just go through and drop that onto the VPC and that will make sure that 12 13 00:01:13,890 --> 00:01:20,909 our VPC ID is referenced in that security group so we also need to add 13 14 00:01:20,909 --> 00:01:25,650 some more properties in there so I've just copied those over from the lab 14 15 00:01:25,650 --> 00:01:32,490 notes and paste those in there okay so what we need to make sure is 15 16 00:01:32,490 --> 00:01:39,720 that when we paste it in that the indenting lines up with this here so it 16 17 00:01:39,720 --> 00:01:45,180 indents from properties and it will be in line with VPC id, it'll be like that 17 18 00:01:45,180 --> 00:01:50,159 and then when we go into our security ingress rule that will be indented again 18 19 00:01:50,159 --> 00:01:56,280 with IP protocol and then the from to port and side a block will then be 19 20 00:01:56,280 --> 00:02:02,000 indented again and then we go back and so that is a TCP port 80 connection for 20 21 00:02:02,000 --> 00:02:08,910 for everything and then we have our port 20 to ssh traffic 21 22 00:02:08,910 --> 00:02:15,780 therefore IP protocol TCP so that is our security group ingress rules that have 22 23 00:02:15,780 --> 00:02:21,510 been defined them so again we click on it refresh and that will update that for us 23 24 00:02:21,510 --> 00:02:28,620 okay so now that we've done that we can now look at saving it again as a 24 25 00:02:28,620 --> 00:02:36,450 different version so we'll save that local file and we'll call this one too 25 26 00:02:36,450 --> 00:02:48,540 so again we go into our cloud formation console we leave it we've already saved 26 27 00:02:48,540 --> 00:02:54,720 that that's fine and again we go through and we'll select our stack and we'll 27 28 00:02:54,720 --> 00:02:59,959 update our stack choose our file again 28 29 00:03:00,170 --> 00:03:19,949 and next and next next and update ok so that update has completed fine it's it's 29 30 00:03:19,949 --> 00:03:26,190 created the security group not a problem there ok so let's go back into designer 30 31 00:03:26,190 --> 00:03:33,290 so click on design template will load that back in again 31 32 00:03:38,209 --> 00:03:51,209 okay just zoom in a bit okay so I'll just minimize the editor now now that 32 33 00:03:51,209 --> 00:03:56,219 we've got our security grid created we now can go ahead and put our ec2 33 34 00:03:56,219 --> 00:04:01,139 instance in there so again we see two and drag an instance across into here 34 35 00:04:01,139 --> 00:04:08,549 again we'll rename that instance so we click on components and we'll rename 35 36 00:04:08,549 --> 00:04:20,669 that so we're just call a back space ec2 I that will be fine 36 37 00:04:20,669 --> 00:04:28,830 refresh our designer, Okay I'll just minimize the editor so that we can see 37 38 00:04:28,830 --> 00:04:33,570 it a little bit better so again we've got a lot of different stuff here but 38 39 00:04:33,570 --> 00:04:38,870 what we're interested in is that depends on so it depends we can't create this 39 40 00:04:38,870 --> 00:04:45,000 ec2 instance until our route to the Internet is there available otherwise 40 41 00:04:45,000 --> 00:04:48,509 it's just not going to be able to connect so has no point launching an ec2 41 42 00:04:48,509 --> 00:04:53,099 instance until that is ready to go so we put our depends on so the pink dot there 42 43 00:04:53,099 --> 00:05:03,090 and we drag that over to our public route okay so now that we've got that 43 44 00:05:03,090 --> 00:05:09,780 instance icon on there we need to actually define you know what what ami 44 45 00:05:09,780 --> 00:05:15,599 is instance using we need to define also what size that instance is so we can 45 46 00:05:15,599 --> 00:05:19,320 start off by putting that into the property so we click on that we'll just 46 47 00:05:19,320 --> 00:05:25,130 max or split screen to get the editor up click on components to bring that up and 47 48 00:05:25,130 --> 00:05:30,270 we can see that we've got our subnet ID reference that's fine so what we need to 48 49 00:05:30,270 --> 00:05:35,969 do is to go into properties and just before network interfaces and press 49 50 00:05:35,969 --> 00:05:43,620 enter and we're going to copy over the the details of that instance so just 50 51 00:05:43,620 --> 00:05:48,770 copy that over from the lab notes 51 52 00:05:51,180 --> 00:05:58,060 okay so make sure that it looks like that so you have properties and then you 52 53 00:05:58,060 --> 00:06:03,310 have an indent of two spaces then your image ID and then the instance type and 53 54 00:06:03,310 --> 00:06:09,150 then lining up again will be the network interfaces after that so again we 54 55 00:06:09,150 --> 00:06:17,440 refresh our designer so now that we've got our our image ID which is a 55 56 00:06:17,440 --> 00:06:21,699 wordpress image in our instance type we need to give information about the a 56 57 00:06:21,699 --> 00:06:26,020 network interface side of things so again we'll copy that over from the lab 57 58 00:06:26,020 --> 00:06:39,370 notes and we'll paste that in to where the current network interfaces section 58 59 00:06:39,370 --> 00:06:48,910 is delete that one and we'll paste the new one in okay so I'm just going to 59 60 00:06:48,910 --> 00:06:54,099 maximize this and we can see it a little bit better so there we go so we've got 60 61 00:06:54,099 --> 00:06:59,050 our image ID which is a wordpress AMI we've got our t2 micro and then in the 61 62 00:06:59,050 --> 00:07:04,360 networking section we've got our group set set which is our back space ec2 62 63 00:07:04,360 --> 00:07:09,669 security group which is associated with this instance we wanted to associate a 63 64 00:07:09,669 --> 00:07:13,630 public IP address when it launches it's going to be a webserver it needs a 64 65 00:07:13,630 --> 00:07:19,060 public IP address we have a device index air and delete on termination being true 65 66 00:07:19,060 --> 00:07:25,360 so when we terminate it we want it to go and we have a subnet ID there which is 66 67 00:07:25,360 --> 00:07:31,630 defined it's going into our public subnet so we'll just go back to split 67 68 00:07:31,630 --> 00:07:35,550 screen and we'll refresh our designer 68 69 00:07:37,289 --> 00:07:45,220 okay so now that we've done that we can look at now deploying our doing our 69 70 00:07:45,220 --> 00:07:49,419 final update which will deploy our WordPress server to this VPC 70 71 00:07:49,419 --> 00:07:55,870 architecture so again we save our current template to a local file we'll 71 72 00:07:55,870 --> 00:08:01,690 save that and we're going to give it the name backspace three 72 73 00:08:01,690 --> 00:08:06,590 and we'll save that one there when that's finished saving we go again into 73 74 00:08:06,590 --> 00:08:16,180 the cloud formation console we click on that stack and we update that stack 74 75 00:08:16,180 --> 00:08:30,199 we'll choose our new file upload that click on next and next and next and 75 76 00:08:30,199 --> 00:08:36,740 we'll update that stack so the update is near in progress after short them at a 76 77 00:08:36,740 --> 00:08:40,880 time it will be ready to go and we can start to have a look at our web server 77 78 00:08:40,880 --> 00:08:48,820 in action okay so our update has been completed so our architecture has been 78 79 00:08:48,820 --> 00:08:56,510 created and our ec2 instance has been created and a route through to the 79 80 00:08:56,510 --> 00:09:00,380 Internet has been created so we should be able to now point our web server 80 81 00:09:00,380 --> 00:09:05,810 you're sorry should be able to point our browser to this WordPress web server and 81 82 00:09:05,810 --> 00:09:17,240 we should get a web page so let's go to the ec2 console and then we can see we 82 83 00:09:17,240 --> 00:09:28,459 got one running instance seeing okay so there's our instance and it's still 83 84 00:09:28,459 --> 00:09:34,970 going through doing it status checks so we just wait for it to finish that okay 84 85 00:09:34,970 --> 00:09:41,240 so our status checks have completed so we should now be able to or very shortly 85 86 00:09:41,240 --> 00:09:46,250 be able to access our web server so we just go and get the public IP address 86 87 00:09:46,250 --> 00:09:52,339 and we'll go to that so just go to that and there you can see we have our 87 88 00:09:52,339 --> 00:09:58,250 WordPress server up and running so that's a pretty cool thing so this has 88 89 00:09:58,250 --> 00:10:04,010 been a very very long lab but I'm sure you can appreciate that this is a great 89 90 00:10:04,010 --> 00:10:09,410 way to really learn about VPC you're going to understand what is required for 90 91 00:10:09,410 --> 00:10:13,310 internet access you're going to understand exactly if any of this stuff 91 92 00:10:13,310 --> 00:10:17,040 is missing it's not going to I'm sure you've learned a lot about 92 93 00:10:17,040 --> 00:10:23,640 cloud formation as well and how how to launch a stack and how to fix a stack if 93 94 00:10:23,640 --> 00:10:28,290 there are problems with it so that brings us to the end all we need to do 94 95 00:10:28,290 --> 00:10:33,600 now is to clean this up so what we do is we just close out of here we don't go 95 96 00:10:33,600 --> 00:10:39,210 anywhere near the ec2 management console leave that alone if you delete it from 96 97 00:10:39,210 --> 00:10:42,600 here it's going to create problems when you go to delete the slacks and don't 97 98 00:10:42,600 --> 00:10:48,180 touch anything here go back into cloud formation and delete the stack from 98 99 00:10:48,180 --> 00:10:55,620 there first so just select it actions and delete stack so when you delete a 99 100 00:10:55,620 --> 00:11:00,660 stack it will delete every resource that was created so it's going to delete that 100 101 00:11:00,660 --> 00:11:05,130 entire VPC that we've created it's going to delete the security groups 101 102 00:11:05,130 --> 00:11:09,180 around tables it's going to delete finally delete that instance as well so 102 103 00:11:09,180 --> 00:11:18,060 we cook on yes delete that delete will be happening okay so after a certain 103 104 00:11:18,060 --> 00:11:22,230 amount of time you're going to see that stack deleted and all of the resources 104 105 00:11:22,230 --> 00:11:26,820 that were created by that stack will also be deleted now this is a very big 105 106 00:11:26,820 --> 00:11:33,420 lab quite a complex lab I've created almost 30 pages of lab notes and make 106 107 00:11:33,420 --> 00:11:38,040 sure you download those it's taken about a week of full time to get this lab up 107 108 00:11:38,040 --> 00:11:42,810 and running and I hope you appreciate it because it's going to really be a really 108 109 00:11:42,810 --> 00:11:48,150 good lab for you to learn and fully understand VPC so make sure you download 109 110 00:11:48,150 --> 00:11:53,730 those lab dates go through them very carefully take your time and you'll get 110 111 00:11:53,730 --> 00:11:59,990 there in the end and I'll look forward to seeing you in the next lecture