You can use Autohealing
with managed instance group with instances that don't have external IPs. To achieve this goal you should whitelist access to your service from subnets 130.211.0.0/22
, 35.191.0.0/16
as it mentioned in the documentation. If you concerned that your instances don't have external IPs there's nothing to worry about - requests from health check will be routed internally to your instances from health check subnets.
I successfully tried it on my test project, for test service on my instances (without external IPs) I decided to run web server Apache. Please find my steps below:
- create custom VPC
- create subnet
- create external static IP
- create router
- create nat
- create instance
- install Apache web server to instance
- create custom disk image
- create instance template
- create managed instance group template
- create managed instance group without health check
- allow connection to port 80 from subnets
130.211.0.0/22
, 35.191.0.0/16
at firewall
- edit managed instance group and add health check (port 80)
- check status of managed instance group

- shut down Apache2 on 2 instances
- check status of managed instance group

- wait a few minutes for Autohealing
- check status of managed instance group

So, as you can see, two new instances were created and replaced two instances with stopped Apache.