For our project we need a static IP binding to our Google Cloud VM instance due to IP whitelisting. Since it's a managed group preemptible, the VM will terminate once in a while.
However, when it terminates I see in the operations log compute.instances.preempted
directly followed by compute.instances.repair.recreateInstance
with the note:
Instance Group Manager 'xxx' initiated recreateInstance on instance 'xxx'. Reason: instance's intent is RUNNING but instance's status is STOPPING.
After that follows a delete
and a insert
operation in order to restore the instance.
The documentation states:
You can simulate an instance preemption by stopping the instance.
In which case the IP address will stay attached when the VM is started again.
A) So my question, is it possible to have the instance group manager stop and start the VM in the event of preemption, instead of recreating? Since recreating means that the static IP will be detached and needs to be manually attached each time.
B) If option A is not possible, how can I attach the static IP address automatically so that I don't have to attach it manually when the VM is recreated? I'd rather not have an extra NAT VM instance to take care of this problem.
Thanks in advance!