ROGER MARTINEZ: OK, so today, I'm
going to talk about Google Cloud's managed instance
groups, specifically the auto healing feature.
So, to show you what I'm talking about,
let's head over here to the navigation menu on the left.
Then down to Compute Engine.
And then over to Instance Groups.
So what I have on this project is one managed
and since group called WebApp.
There it is.
Let's click the name to go to the Overview page.
And you'll see that this instance group is
comprised of eight instances.
So each of these instances is just an HTTP application.
And it spits out some basic instance information,
and also has some built-in functionality
that lets me change its health state.
Let's go back to the Overview page.
So as you can see, each of these instances
is currently reporting back as healthy.
And the reason for that is that I have auto healing configured
on this managed instance group.
So let's check out that configuration.
So when you create a new managed interest group,
or when you edit an existing one,
you'll find the auto healing configuration down here
at the bottom.
And all it really is is a health check.
So any health check that you have on the project
will show up right here, or you can create a new one up here.
It's worth noting that these health checks are the same ones
that you would use to configure a load balancer.
So if you want to use a load balancer in conjunction
with auto healing, you want to make sure
that the health check that you use for your load balancer is
more aggressive, and checks more frequently than the one you
use here for auto healing.
So the reason for that is that if something
goes wrong with one of your instances,
you'd want your load balancer to start directing traffic away
from that instance before auto healing gets
started with recreating that instance.
So once you've selected your health check,
you need to specify an appropriate initial delay.
So the initial delay tells the instance group manager
how long before it should start running
the health check against the instance after its provision.
This is especially important if you've got any startup scripts
or configuration management that needs
to complete before an instance is ready to do its job.
So I know that this particular application doesn't
take very long to start up.
So I've set my initial delay to just 15 seconds.
So if you like to use the CLI, you
can use gcloud compute instance-groups managed
list-instances followed by the name of the managed interest
group and the region.
And they'll return the instances that are currently
in your managed instance group, along with the zone, status,
and health state.
So let's keep this running down here while we
see auto healing in action.
So let's select one of these instances up here.
1RJ5.
Hit the front end.
And let's make it unhealthy.
And now that it's unhealthy, the health check
should pick up on it.
So to see what's going on, let's actually
see the health check that I have configured for this managed
instance group by going over here, down to Health Checks.
And there's my health check.
HTTP health check in use by WebApp.
And as you can see down here, that instance
is already picked up as being unhealthy
and it's currently being recreated.
So let's check out this configuration.
Let's hit Edit.
So what I have here is an HTTP health check
that is checking against Port 80,
and requesting the path health.
But you can select from these five different protocols.
If you scroll down here to the bottom,
you'll get the health criteria.
So according to the configuration,
this health check will check each of my instances
every 5 seconds.
If it doesn't get a response it wants within 4 seconds,
it's going to count that as a failure.
Three consecutive failures is going
to mark that instance as being unhealthy.
And it's going to keep that health state
as unhealthy or unknown until it has two consecutive successes.
So my managed instance group is in the process
of recreating 1RJ5.
And soon, it'll be back up and running in a healthy state.
So in conclusion, using auto healing in a managed instance
group makes sure that your instances are running the way
that they're supposed to.
And in any case that they aren't, they
can quickly and automatically be reprovisioned and made
available to make sure that your managed instance group is up
and running at full capacity.
So that was just a quick look at Google Cloud's manage instance
groups auto healing feature.
[MUSIC PLAYING]