Please note that this content is targeted for SysOps administrators. If 1
you're a Solutions Architect or a developer you may want to skip over this 2
one. Welcome back to BackSpace Academy. In this hands-on lecture I'm 3
just going to run through some of the techniques that are available for us for 4
troubleshooting our ec2 instances. So I'm just starting off here in the ec2 5
dashboard. What I'm going to look at here is on the left hand side we can see we 6
have our limits. So we click on that, it's going to provide us with all of the 7
available limits that we have, so we can see here on this account that I've got 8
here I can run five c1 medium instances but I can only run one 9
c3 for extra large instances, so just one of those so if I try and run 10
more than that it's not going to let me, so I would have to go through and 11
request a limit increased, so what I'll do now is I'm just going to try and 12
launch two of these instances now I don't recommend that you do this 13
yourself because they're very expensive instances sand if you forget to delete 14
them you're going to end up with a pretty nasty bill at the end of the 15
month. So just go back to the ec2 dashboard, launch instance, I'm just going 16
to grab a Linux AMI will be fine, let's scroll down to a c4 17
extra-large. Okay c4 4xextra large, I'm just going to review and launch 18
that 19
so it's allowed me to launch that instance it's quite a big one and I'm 20
just going to try and launch another one of those so again we're just you see 21
Linux AMI and c4 for extra-large and we'll just review and launch 22
select our key pair and launch, ok so the launch has failed, so we've exceeded our 23
limits and it's stopped us from launching that second instance, so I just 24
cancel that before I get a big bill and I'll just terminate the one that 25
I've created there. 26
okay so what I'll do now is just launch a smaller instance and we'll just see 27
what tools are available for us to troubleshoot that instance so we just 28
launched another instance again we'll just use the Amazon Linux will be fine 29
and a t2 micro will be fine and it's going to review and launch 30
so we'll just wait for that to finish being launched and finish all that 31
status checks okay so after a certain amount of time we have our instance up 32
and running and it's status checks have passed now if we select that instance 33
and we click on the status checks tab we can see there that yes it has passed its 34
system status checks and it's instant status checks now if you want to 35
understand the difference between the two just hover over the information icon 36
there and the system status check check verifies that your instance is reachable 37
whereas we look at the instant status check that verifies that your is 38
instances operating system is accepting traffic also it tells you what to do if 39
there is a problem that you fail that check so you can see there that the if 40
you fail an instant status check that's an operating system is not operating 41
correctly then you you are best off to reboot that instance whereas if you look 42
at the system status check if something goes wrong with that then it's obviously 43
at a system level and there is a problem with the underlying host that is running 44
that that that instance and so the best thing to do is to stop and start it or 45
else replace that instance now the next thing we can look at the system logs for 46
the instance so we go to instance settings and then get a system log so 47
what that is it's an output of the console of our Linux operating system so 48
that is if we were connected to this Linux instance this is what we would see 49
from from the console and so that gives you a lot of information as to what is 50
going on so we can scroll down here to the latest and we can see it's at the at 51
the login stage they are waiting for a login to the instance so just close that 52
and what we can also do is we can go into again into instant settings and we 53
can get a a screenshot of the console of that instance 54
as it is right now and so there we can see it's it's waiting for a logging and 55
we can refresh that every want as well and get a later one and so these are 56
quite quite good because it allows you to see exactly what has gone going on 57
from a historical perspective through the booting up stage and also what the 58
console is telling the telling you right at this point in time just close out of 59
that now if we find that we have a problem with an instance status check 60
what we can do is we can implement an a cloud watch action or a cloud watch 61
alarm so we just go into cloud watch monitoring and add edit alarms and 62
create alarm so what we can do is we obviously can send a notification as we 63
can do with most cloud watch alarms but we can also take an action on that 64
instance so we click on take action we can actually recover that instance so if 65
it it's if it's filed a status check then we can automatically repair this 66
instance in in the event of that but you can only recover certain types not all 67
ec2 instance types again but you can recover t2 and most of the common types 68
of of ec2 instance you can also take an action to stop the instance now if you 69
want to stop the instance as opposed to recover the instance the cloud watch 70
service needs to have an IAM role to do that so you need to select here create 71
IAM role and you can only stop an instance if it's if it's an EBS volume 72
backed instance, so you can't stop an a an instance that is instance store back 73
it will just need to be terminated so then we've got terminate instance as 74
well and we can also reboot that instance but again we need to create or 75
we need to have an I am role created for that so what we can do is if we would 76
like to have different stages that kick in we can first off try and recover the 77
instance if it's filed for so meters consecutive periods and we can create 78
alarm for that and then we can look at rebooting the 79
instance and we can do that after say you know ten consecutive periods same 80
and then we can create create another alarm to terminate that instance if it's 81
which would be very handy bits in an auto scaling group so you can terminate 82
that and then another instance can be created quite quickly for you so I'll 83
just get out of that now so just back here in our status checks tab we can see 84
here there is also a link to create a status check alarm and that is the same 85
alarm that we are talking before and so we can take an action to recover the 86
instance now if we want to terminate an instance one thing I didn't mention 87
before is it we need to make sure that termination protection on that instance 88
is disabled otherwise CloudWatch won't be able to terminate that instance, so 89
that's about all I need to tell you about troubleshooting of ec2 coming up 90
next we'll have the same for troubleshooting RDS I'll see you in the 91
next lesson