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. 3
Welcome back to BackSpace Academy one thing that a SysOps administrator 4
will be doing a lot of and that is troubleshooting of services and one of 5
those services which you will no doubt be involved in troubleshooting will be 6
Amazon ec2. So this lecture is going to run through all of the different issues 7
that may arise with the ec2 service and how to troubleshoot those so we'll look 8
at launching issues. We'll look at issues with failed status checks. We'll also 9
look at where you where you are unable to terminate or stop an instance and 10
then we'll finally look at connection issues with the Linux instances and also 11
with Windows instances as well. There are a range of probable causes that can lead 12
to your ec2 instance failing to launch the first one and probably the most 13
significant one would be that you've exceeded the ec2 service limits and that 14
can be a range of things, for example a lot of instances you may only be able to 15
launch one or two of those, others you may be able to launch 20 of, so if you 16
exceed that limit then AWS is not going to let you launch any more instances and 17
the same with the EBS volume limits if you exceed those then you are also 18
going to run into problems when you go to launch an instance. There are other 19
issues you could have a corrupt EBS snapshot that you are trying to launch 20
your instance with you could also have a problem with an instant store backed 21
AMI and with those they will be, and this is only for instance store backed AMI, is 22
that they will be stored to Amazon s3 in parts and the AWS service when it goes 23
to launch it will piece those parts back together to create that AMi that is 24
going to be used to launch that instance. So if you're missing one of those part 25
files then you're not going to be able to launch that instance. If you have 26
insufficient instance capacity to run your application for example if you'll 27
have a very compute intensive application or 28
intensive application and your instance that your selected might be a t2 nano or 29
something like that it may not have enough capacity to actually run that 30
application and finally you may encounter account issues if you haven't 31
paid your bill then you're not going to be able to launch instances so any one 32
of those can fail to launch or cause you to fail to launch or ec2 instances so 33
the action that we can take the first thing we should do is to look at the 34
instance or the state-transition reason which will be in the instance 35
description so when we go to the console we click on our on our instance and 36
we'll be able to get that state-transition reason we can also get 37
similar information by using the CLI describe-instances command and if we 38
find that it is something around limits then we can check our limits in the ec2 39
console so there will be a menu option there on the left hand side that we can 40
click on to have a look at our available limits if we find that we're exceeding 41
those limits for example the number of instances that we may be able to launch 42
we can request an increase from AWS to correct that problem if an ec2 instance 43
fails its status checks there are a number of probable causes for that it 44
can be memory issues it can be problems with EBS with an i/o device it could be 45
kernel issues it could be filesystem issues and it could be other issues with 46
the operating system so the action that we would want to take is that first of 47
all we would like to wait for it to resolve itself obviously if we find that 48
it's not resolving itself then we can if it's an EBS based instant or EBS backed 49
instance we can restart it by stopping and then starting it or we can relaunch 50
it so with with an instant store you can't stop that you'll have to terminate 51
it and then relaunch it to see if it fixes it. You can also retrieve the 52
system log which is basically the console output for their instance so 53
it's a Linux operating system you can actually retrieve all of the output from 54
the console or from the Linux console there 55
and we can also look at creating an instant recovery alarm with cloud watch 56
and so if there is an issue then we can have cloud watch take an action to 57
recover that instance automatically for us. If we have problems with terminating 58
or stopping our instance it's most likely going to be a problem with the 59
underlying host computer or the underlying host computer is processing 60
scripts that haven't been finished before you can actually stop or 61
terminate that instance. Another common problem is that you might have that 62
instance inside of an auto scaling group or it might be part of Elastic Beanstalk 63
and every time you terminate that instance it's actually replaced with 64
another instance so quite a common problem that you that you can encounter 65
so the action that you can take is that you can use a CLI stop instance command 66
with the force option on it or you can actually create an ami of that instance 67
and then terminate it and replace it with another instance if you find that 68
you just cannot terminate that ec2 instance and you're going to have to 69
contact AWS support and they can terminate that instance for you. If you 70
are having trouble connecting to your ec2 Linux instance it may be that the 71
instance is overloaded and just doesn't have the resources available to do that 72
connection it could and most probably would be a problem with your VPC setup 73
it could be a problem with your private key that you're using to connect to that 74
instance if you're looking to ping that instance and it could be a problem with 75
setting up ICMP so the action available if it's a VPC issue make sure that you 76
that you have your security group rules set up and your network access control 77
is set up to allow inbound traffic on that port make sure they have an 78
Internet gateway or a virtual private gateway and that you have a route from 79
your subnet through to that internet gateway also make sure that you have a 80
public IP address if you don't have a public IP then you're not got your 81
instance will not be visible on the wider internet if you find you've got a 82
problem with your private keep and it's not recognized you need to 83
check the format of that private key so if you're using putty make sure that 84
you're using the PPK format it could be that you're using the wrong username to 85
connect so if you are looking at a AWS ami or an Amazon ami the user will be 86
ec2 - user if it's an Ubuntu instance it will be ubuntu as the user. You also 87
need to make sure that you've got permission to access that private key 88
and also make sure that it is not a completely unprotected file because 89
either those will prevent you your side from connecting to that that ec2 Linux 90
instance the issues where the failing to connect with Windows instances are 91
similar to Linux instances so you still have problems that may arise from the 92
instance being overloaded or VPC issues or problems with the credentials but we 93
also have a Windows Firewall that may also be giving us issues and we also 94
have a maximum number of RDB sessions that we can can currently have 95
connecting to that instance so we exceed that we're going to run into issues so 96
with our credentials we need to make sure that a username and password is 97
correct and also make sure that that password has not expired if we find that 98
we've found Windows Firewall issues on our Windows server we need to disable 99
that Windows Firewall and use our security group rules to control access 100
via RDP for our instance so that's all I'm going to talk to you now about 101
troubleshooting coming up next we'll have a hands-on lesson on how to 102
actually uses so I'll see you in the next one