Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I automatically restart a GCE preemptible instance?

Tags:

How do I automatically restart a preemptible Google Compute Engine instance? I only have one instance that doesn't need 100% uptime but that I would like to restart once the data center becomes unloaded again. The instance/server that I'm trying to automatically restart has its own boot disk that I'd like to use each time it restarts.

like image 343
interestedparty333 Avatar asked Jul 10 '15 14:07

interestedparty333


People also ask

How do I reset GCE instance?

Using vCenter. In the vSphere vCenter, select the virtual machine. Right-click the VM and select Migrate for Google Compute Engine Operations > Restart.

How long will a preemptible instance run in your GCP environment?

Preemptible VMs always stop after 24 hours. Preemptible VMs are recommended only for fault-tolerant applications that can withstand VM preemption.

What is reset in GCP instance?

Performing a reset on your instance is similar to pressing the reset button on your computer, which wipes the memory contents of the machine and resets the virtual machine to its initial state. https://cloud.google.com/compute/docs/instances/restarting-an-instance.


1 Answers

You could try using Instance Group Manager to set up a pool of size 1. It will then try to re-create instances after they are preempted.

You should be aware that there is no guarantee that there is going to be capacity for your instance. As the docs say:

Preemptible instances are available from a finite amount of Compute Engine resources, and might not always be available.

like image 147
David Avatar answered Sep 17 '22 15:09

David