1 00:00:00,650 --> 00:00:06,569 okay so I'm just now in the ec2 console I've created an ec2 instance here and I've 2 00:00:06,569 --> 00:00:10,190 just called it cloud watch test and 3 00:00:10,190 --> 00:00:15,240 we can see here it's got out we click on monitoring and we've got our cloud watch 4 00:00:15,240 --> 00:00:19,380 metrics set up here so the first thing I would like to do is to enable detail 5 00:00:19,380 --> 00:00:24,600 monitoring so I'll just click on that and there we go we have no alarms 6 00:00:24,600 --> 00:00:28,380 configured that's fine we already know how to create an alarm we've already 7 00:00:28,380 --> 00:00:31,199 done that in the highly available and fault tolerant lip so we want to do that 8 00:00:31,199 --> 00:00:34,980 again so let's have a look at our cloud what make cloud watch some metrics so we 9 00:00:34,980 --> 00:00:40,530 just click on here view all cloud watch metrics okay so we can see here we've 10 00:00:40,530 --> 00:00:45,239 got a number of metrics available but it's not going to be the same as what's 11 00:00:45,239 --> 00:00:50,100 available in US East so I'm in asia-pacific you see me here so I'm just going to 12 00:00:50,100 --> 00:00:54,690 jump into US East and see what it looks like so you can 13 00:00:54,690 --> 00:00:59,190 see here we've got a lot more available in the north virginia or the US - 14 00:00:59,190 --> 00:01:04,019 east region so that's something to be aware of that when you're when you're 15 00:01:04,019 --> 00:01:06,659 setting up your infrastructure you know one of those things you need to consider 16 00:01:06,659 --> 00:01:09,840 is if you're going to take advantage of cloud watch make sure that the metrics 17 00:01:09,840 --> 00:01:13,680 you want to monitor are available in the in the region you're looking at so I'll 18 00:01:13,680 --> 00:01:22,049 just jump back into into the asia-pacific region ok so let's have a 19 00:01:22,049 --> 00:01:26,100 look at some ec2 metrics so we can see here we've got our I've only got one 20 00:01:26,100 --> 00:01:31,829 instance set up in this account there in this region and so we can see here here 21 00:01:31,829 --> 00:01:37,020 is our instance cloud watch test so let's have a look at CPU utilization so 22 00:01:37,020 --> 00:01:41,970 just click on and select that we can see our CPU utilization there and so there 23 00:01:41,970 --> 00:01:44,939 to cut the spikes here so I did a bit of load testing on it and just to see if it 24 00:01:44,939 --> 00:01:50,759 would work you can see we're down quite low here so what I'm going to do now is 25 00:01:50,759 --> 00:01:56,340 I'm going to go get back into the ec2 console and I'm going to grab the public 26 00:01:56,340 --> 00:01:59,119 IP from this 27 00:02:01,220 --> 00:02:06,680 okay so I'm just going to jump into a web app called loadimpact.com so they 28 00:02:06,680 --> 00:02:12,020 allow you to do some load testing on on a server so it's pretty quick and quick 29 00:02:12,020 --> 00:02:17,780 and easy way to go so you can create a free account in which I've just done not 30 00:02:17,780 --> 00:02:21,920 Normally I wouldn't use this service but I just think it's if 31 00:02:21,920 --> 00:02:24,920 you're not conversant with testing software then it's a great thing to do 32 00:02:24,920 --> 00:02:30,680 you can just jump online here and put in your your URL of your server and where 33 00:02:30,680 --> 00:02:33,950 you go so I'm just going to do that I've already put it in there and then I'm 34 00:02:33,950 --> 00:02:43,040 going to rerun that test a lot of that I've already set up so I just scroll 35 00:02:43,040 --> 00:02:48,280 down here and we can see that this is starting to happen so testing progress 36 00:02:48,850 --> 00:02:55,580 okay so just fast forward along here the test is now finished and we can see here 37 00:02:55,580 --> 00:03:01,340 that we've got our be used now the user virtual users you can see here we just 38 00:03:01,340 --> 00:03:07,250 it's the service is continually adding on virtual users and there we can see as 39 00:03:07,250 --> 00:03:12,590 our response time is getting higher and higher so it's getting up to two minutes 40 00:03:12,590 --> 00:03:15,440 here at one stage and then it's getting to the point where it's just not not 41 00:03:15,440 --> 00:03:19,850 getting a response back in time so you can see very very quick and easy to do a 42 00:03:19,850 --> 00:03:25,220 very quick load test on server so it's um and it's a free service for just one 43 00:03:25,220 --> 00:03:30,920 server so if you're not conversant with with testing software and have a 44 00:03:30,920 --> 00:03:37,100 look at this so just jumping back into the ec2 management console and we'll 45 00:03:37,100 --> 00:03:41,120 click on monitoring again and here you can see we've got our spike and our CPU 46 00:03:41,120 --> 00:03:49,160 utilization here and so that corresponds with with what we're seeing over over on 47 00:03:49,160 --> 00:03:57,230 here so that's pretty good so let's a little bit cloud watch and so here we 48 00:03:57,230 --> 00:04:00,940 can see and we'll just refresh this and 49 00:04:01,330 --> 00:04:07,430 there we can see we've got our big spike from the tests we done so that's coming 50 00:04:07,430 --> 00:04:11,300 in at one-minute intervals and so that's that's looking really good so what we 51 00:04:11,300 --> 00:04:14,450 can do now is we can look at creating a dashboard so 52 00:04:14,450 --> 00:04:20,840 into dashboards now and they're pretty good because they allow you to put in a 53 00:04:20,840 --> 00:04:24,290 number of different metrics for all different resources and display them on 54 00:04:24,290 --> 00:04:29,300 a screen there so which you can which you can share with others so let's just 55 00:04:29,300 --> 00:04:46,280 put a dashboard name in here ok so just click create dashboard so we can we just 56 00:04:46,280 --> 00:04:50,210 do a metric graph now and then we'll look at text widgets in a sec so we're 57 00:04:50,210 --> 00:04:54,590 just going to put metric graph on it which is going to monitor our so let's 58 00:04:54,590 --> 00:05:02,389 have a look at our ec2 metrics and there's our CPU utilization for our 59 00:05:02,389 --> 00:05:09,440 cloud watch test so we're going to put that on there as a widget and there it 60 00:05:09,440 --> 00:05:13,790 is so there's our widget we can resize it we can we can do whatever you want 61 00:05:13,790 --> 00:05:18,229 with it so it's pretty good so we can put a number of these on here so you can 62 00:05:18,229 --> 00:05:23,150 also put different types we can put a text widget so it's a look at that okay 63 00:05:23,150 --> 00:05:28,840 so what we've got here is is text that is being formatted with markdown so 64 00:05:28,840 --> 00:05:37,640 markdown is just a formatting language that you use to put your text into into 65 00:05:37,640 --> 00:05:41,750 something nice you know a little bit like HTML that puts puts a web page into 66 00:05:41,750 --> 00:05:46,430 a nice format if you have you get up before and you've had to have the the 67 00:05:46,430 --> 00:05:51,260 readme for the github you know the front page for your GitHub repository 68 00:05:51,260 --> 00:05:56,000 then that will be done normally in markdown so so you'd be conversant with 69 00:05:56,000 --> 00:06:00,770 that if you're a developer or use github so we're just going to use it as is you 70 00:06:00,770 --> 00:06:06,169 can see here it's putting a heading and then a subheading so the the the way of 71 00:06:06,169 --> 00:06:09,650 doing that is that hash signal followed by two of those for a 72 00:06:09,650 --> 00:06:15,620 subheading and so that's how you create a markdown tick so just going to click 73 00:06:15,620 --> 00:06:19,550 on create widget and you can see that it's put a nicely formatted bit of text 74 00:06:19,550 --> 00:06:22,520 there and so they could be anything that we want to put in there and could be 75 00:06:22,520 --> 00:06:27,380 some help screen or something like that so it's a pretty handy thing so we can 76 00:06:27,380 --> 00:06:33,080 also get rid of it if we look on here we go delete we can 77 00:06:33,080 --> 00:06:36,550 get rid of it and we can also get rid of this one as well a good one or two so 78 00:06:36,550 --> 00:06:42,770 easy to put on easy to take off and then we can save our dashboard so the next 79 00:06:42,770 --> 00:06:47,210 thing I want to look at now is events so reasonably its marked in new so reasonably 80 00:06:47,210 --> 00:06:54,440 new service for 2016 so again we know that we have to create a rule for our 81 00:06:54,440 --> 00:06:59,300 event to occur so this is so we got determine events of interest in the 82 00:06:59,300 --> 00:07:03,230 cloud watch event stream create rules to select those events of interests and 83 00:07:03,230 --> 00:07:09,170 then specify our actions to take when a rule matches an event so it's create a 84 00:07:09,170 --> 00:07:16,310 rule okay so here we have our step one which is create rule so we can select an 85 00:07:16,310 --> 00:07:22,730 event source so it could be an instance state change notification it could be on 86 00:07:22,730 --> 00:07:28,700 a schedule it or it could be an AWS API call so to 87 00:07:28,700 --> 00:07:34,520 do that you would have to implement cloud trail to make that happen we could 88 00:07:34,520 --> 00:07:40,060 be an auto scaling event that has occurred so auto scaling invoking an 89 00:07:40,060 --> 00:07:45,110 instance for example so they're the kind of event sources that we can use so if I 90 00:07:45,110 --> 00:07:49,340 just click on here on on API call you can see it's not going to work because 91 00:07:49,340 --> 00:07:53,870 we haven't got cloud trail logging turn on for this account so in the cloud 92 00:07:53,870 --> 00:07:58,250 cloud trial lesson we'll we'll look at implementing cloud trail and then 93 00:07:58,250 --> 00:08:03,980 setting up cloud watch to monitor those cloud cloud trail logs so in this one 94 00:08:03,980 --> 00:08:08,240 we're just going to confine it to cloud watch we won't get involved in cloud 95 00:08:08,240 --> 00:08:11,870 trail we'll do that in the next lesson so I just click on OK for that so I'm 96 00:08:11,870 --> 00:08:17,990 just going to select and into the East Sea to instance change notification so 97 00:08:17,990 --> 00:08:22,070 we can select any state let's select a specific state say something that 98 00:08:22,070 --> 00:08:27,650 happens so when it's terminated okay so when something is terminated we want to 99 00:08:27,650 --> 00:08:31,220 get a notification or no we want an event to occur it doesn't have to be a 100 00:08:31,220 --> 00:08:37,010 notification it could be invoking a lambda function or something so any 101 00:08:37,010 --> 00:08:41,830 instance or we could specify a single instance so we could specify our cloud 102 00:08:41,830 --> 00:08:48,339 test for example we could put that in there and then we look at our targets so 103 00:08:48,339 --> 00:08:54,550 again what our targets so they can be an SNS topic they can be an sqs queue they 104 00:08:54,550 --> 00:08:59,920 can be a Kinesis stream or they can be a built-in target so one thing you'll 105 00:08:59,920 --> 00:09:05,140 notice here is that there is not a lambda selection okay, so if I went into 106 00:09:05,140 --> 00:09:09,250 because I'm in the Sydney region if I went into u.s. East there'd be another 107 00:09:09,250 --> 00:09:12,610 another target therefore land to say something again to consider if you're 108 00:09:12,610 --> 00:09:19,360 going to take advantage of of events make sure that the the target and 109 00:09:19,360 --> 00:09:22,269 everything that you need is available in your region that you're using or else 110 00:09:22,269 --> 00:09:27,880 change regions so maybe we want to put in a built in target so what do we want 111 00:09:27,880 --> 00:09:33,220 to happen so we can create a step shop when the winner test is so so when an 112 00:09:33,220 --> 00:09:37,360 instance is terminated we can create a snapshot of that volume and we can 113 00:09:37,360 --> 00:09:41,769 select the volume that we're going to select a take a snapshot off okay we can 114 00:09:41,769 --> 00:09:45,700 add additional targets and we can keep adding them in there so I just delete 115 00:09:45,700 --> 00:09:53,860 that okay so maybe we just give the rule a name and a description and then 116 00:09:53,860 --> 00:10:03,070 permissions so we can use a basic built-in targets role and then we do 117 00:10:03,070 --> 00:10:06,670 allow and not allow that to happen so I'm not going to do that now but that's 118 00:10:06,670 --> 00:10:10,750 how we can do a role and then we can click on create rule which will create 119 00:10:10,750 --> 00:10:13,510 our rule for us so we're not going to do that I think I've gone far enough that 120 00:10:13,510 --> 00:10:20,079 you get the the idea of how this works so what I want to do is jump into the 121 00:10:20,079 --> 00:10:28,600 u.s. east region, so I'm just going to go back and now if we look at, and 122 00:10:28,600 --> 00:10:32,260 then see here we've got our Lambda function so there we go so we can 123 00:10:32,260 --> 00:10:36,459 actually have a function so we need to create the function first and then we 124 00:10:36,459 --> 00:10:40,690 can select that function here and we can have it so when this particular event 125 00:10:40,690 --> 00:10:45,160 occurs for anybody we could have it scheduled for every five minutes or 126 00:10:45,160 --> 00:10:48,130 something or we can have it on a cron expression we can put in here for a 127 00:10:48,130 --> 00:10:53,380 schedule or we could have it you know if we know auto-scaling event occurs we can 128 00:10:53,380 --> 00:10:57,190 run this Lambda function okay so that brings us to the end of our 129 00:10:57,190 --> 00:11:03,670 hands-on of using cloud watch as an administration tool and I'll see you in 130 00:11:03,670 --> 00:11:06,060 the next lesson