We are employing a GPU instance in google cloud to run a machine learning related service. Google cloud has these un-scheduled maintenance plans for their GPU instances. Before the instance is down for maintenance, google cloud api would send notification to this instance 1 hour prior to the instance being turned down.
Suppose the GPU instance is named "vm1" We want to spin up a backup GPU instance, "vm1-duplicate", once "vm1" receives the notice that it will be going thru maintenance later, so that the service to our clients would be affected by this maintenance. And once the maintenance on "vm1" is completed, stop "vm1-duplicate" so that there is no extra costs.
Is there a elegant way in google cloud to program such an automatic vm starting/stopping based on some conditions/triggers/events?