1 00:00:00,110 --> 00:00:07,350 so let's start by creating an OPS works stack and launching an application on 2 00:00:07,350 --> 00:00:11,490 top of that so when you first start you get this sale welcome to AWS opsworks 3 00:00:11,490 --> 00:00:16,980 screen so we can launch a sample stack is so it's going to go here add your 4 00:00:16,980 --> 00:00:25,769 first stack okay so it's going to use the sample stack so sample stack here we're 5 00:00:25,769 --> 00:00:29,640 not going to do our own cookbooks or anything like that so just select Linux 6 00:00:29,640 --> 00:00:38,250 and create the stack so that will go through create the stack it will set up 7 00:00:38,250 --> 00:00:43,170 the cookbook and the recipes in that responsible repository and it will 8 00:00:43,170 --> 00:00:48,120 create the layer and and instance to that layer so that's all done very 9 00:00:48,120 --> 00:00:56,969 quickly very quickly so there we go so we've now made this slack the stack it's 10 00:00:56,969 --> 00:01:02,129 got a node app server on there as a layer get a little message here saying 11 00:01:02,129 --> 00:01:06,630 we can start the instance so once we start the instance we can actually start 12 00:01:06,630 --> 00:01:11,430 to what once it's running we can deploy our application to that so I just click 13 00:01:11,430 --> 00:01:14,189 on got it so we'll just have a look is so we've got our instance here so there 14 00:01:14,189 --> 00:01:20,549 is one instance but it's stopped we have a layer and we have an application there 15 00:01:20,549 --> 00:01:25,619 so I'm just going to have a look at this application first so this is the 16 00:01:25,619 --> 00:01:29,880 application that's going to be running on the infrastructure that we have 17 00:01:29,880 --> 00:01:35,759 defined using a chef recipe and you can see here it's pulling it in from a 18 00:01:35,759 --> 00:01:39,960 github repository. So if I just go have a look at that github repository 19 00:01:39,960 --> 00:01:47,009 and have a look and see what's in there ok so that looks just like any 20 00:01:47,009 --> 00:01:51,710 ordinary nodejs application so just have a look in here so there we go so 21 00:01:51,710 --> 00:01:57,240 require Express so it's an Express node.js application that developers 22 00:01:57,240 --> 00:02:04,079 would certainly recognize so that is the application node.js application that is 23 00:02:04,079 --> 00:02:07,079 going to be launched on this infrastructure so we'll just go back to 24 00:02:07,079 --> 00:02:12,819 our stack and I'm going to start up these instances so 25 00:02:12,819 --> 00:02:19,349 or the single instance here so it's currently stopped and we'll start that 26 00:02:19,769 --> 00:02:26,560 and that will go through and do its usual boot up and health checks and 27 00:02:26,560 --> 00:02:30,579 whatever that a ec2 instance does it take some time so while that's running a 28 00:02:30,579 --> 00:02:37,959 right run around or something per stack again so what we can have a look at is 29 00:02:37,959 --> 00:02:44,829 the layers so here's our layer which has got one instance inside it it has 30 00:02:44,829 --> 00:02:52,540 recipes there it has some EBS volumes So lets have a look at the recipes so there we can see 31 00:02:52,540 --> 00:02:58,599 so there's a nodejs demo recipe that is used for deployment and that is located 32 00:02:58,599 --> 00:03:07,269 in an Amazon s3 bucket there so that is a code that defines our infrastructure 33 00:03:07,269 --> 00:03:10,540 so when we talk about infrastructure as a code this is what we're talking about 34 00:03:10,540 --> 00:03:17,199 so we have we have code they're located in a repository and that defines our 35 00:03:17,199 --> 00:03:22,180 infrastructure we also have code for our actual application that we're going to 36 00:03:22,180 --> 00:03:27,370 run on this app server okay so there are two repositories there one for our our 37 00:03:27,370 --> 00:03:31,389 infrastructure as code and the other one for our actual application that we're 38 00:03:31,389 --> 00:03:37,000 going to run on ad destruction okay so we've just fast forward it took a little 39 00:03:37,000 --> 00:03:40,329 bit of time to to do that but it's finally finished 40 00:03:40,329 --> 00:03:45,310 so we have our instance up and running there so we can see it's being assigned 41 00:03:45,310 --> 00:03:49,840 a public IP and if we go to that public IP it won't really do anything as 42 00:03:49,840 --> 00:03:56,709 there is no application running on it so let's go back to apps and there is our 43 00:03:56,709 --> 00:04:02,739 nodejs sample app that was located in that github repository so we're going to 44 00:04:02,739 --> 00:04:09,400 deploy that to that infrastructure okay this is selling here our ops works 45 00:04:09,400 --> 00:04:16,479 we'll run this command on one of one instances so we deploy that so that 46 00:04:16,479 --> 00:04:23,620 should be running now and what I'm going to do is go back to that instance I'm 47 00:04:23,620 --> 00:04:26,560 going to go to this public IP and see what see 48 00:04:26,560 --> 00:04:34,009 and there we go so opsworks has created the infrastructure that we require it's 49 00:04:34,009 --> 00:04:38,750 used a chef recipe to do that a chef recipe has defined all of the 50 00:04:38,750 --> 00:04:43,639 infrastructure as code it has deployed all of that infrastructure and then 51 00:04:43,639 --> 00:04:50,570 subsequently it has deployed our nodejs application from a github repository so 52 00:04:50,570 --> 00:04:54,110 there you can see that is the the application that within that github 53 00:04:54,110 --> 00:04:59,960 repository that's been launched on a node.js server so pretty good so a lot 54 00:04:59,960 --> 00:05:06,050 more powerful than elastic Beanstalk or or ec2 container service and certainly 55 00:05:06,050 --> 00:05:11,240 if you're going to be looking at really advanced this is probably the high end 56 00:05:11,240 --> 00:05:18,410 of the deployment options on AWS okay so so that we don't actually get a nasty 57 00:05:18,410 --> 00:05:21,470 bill at the end of the month for all these services that we're not going to 58 00:05:21,470 --> 00:05:26,660 be using we're just going to delete this stack and all the associated resources 59 00:05:26,660 --> 00:05:32,030 so the first thing we need to do is we need to stop and then after it's stopped 60 00:05:32,030 --> 00:05:37,970 we need to delete our instance so which is chugging away there to stop we also 61 00:05:37,970 --> 00:05:43,430 need to delete the application as well so if we delete that out and confirm 62 00:05:43,430 --> 00:05:51,770 deletion of that and we just need to wait for that to finish stopping that 63 00:05:51,770 --> 00:05:59,030 instance so that instance is now stopped so we can delete that so once that's 64 00:05:59,030 --> 00:06:02,930 deleted then we can go back into our stack and we can delete the stack once 65 00:06:02,930 --> 00:06:11,169 the instance has been deleted so we just delete that and that's done