3

I've created a preemptible virtual instance in Google Compute Engine. And I understand the following warning:

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

According to the docs, preemptible instances get terminated after 24 hours or before based on computing resources available. That said, I'm not very clear about what terminated means here.

In particular, do my instances and all the related resources connected to my instances (i.e GPU, Disk(100GB)) get deleted when my instances are terminated? (or) Do I have to manually remove everything so I won't get charged (or) Does terminate means that my instance will get shutdown (i.e stop) and when I start it again everything will be there (like my data in my Disk(100GB)). It wasn't very detailed in the docs.

robsiemb
  • 6,157
  • 7
  • 32
  • 46
user_12
  • 1,778
  • 7
  • 31
  • 72

2 Answers2

4

When a preemptable instance is terminated, it is moved to the TERMINATED machine state, it is not deleted (nor are the affiliated resources) as documented here.

This is the relevant part of the documentation for preemptable instances:

Preempted instances still appear in your project, but you are not charged for the instance hours while it remains in a TERMINATED state. You can access and recover data from any persistent disks that are attached to the instance, but those disks still incur storage charges until you delete them. As with normal instances, persistent disks that are marked for auto-delete are deleted when you delete the preemptible instance.

Further down, there is docmentation related to GPUs that clarifies that the GPUs only exist for the life of the instance, so I would not expect that you would be charged for that when your instance is in the TERMINATED state.

robsiemb
  • 6,157
  • 7
  • 32
  • 46
  • Thank you for clearing that. Just a query, Is it possible to restart the terminated preempted instance like we would on a normal instance and continue where we left off? – user_12 Oct 23 '19 at 22:43
  • I haven't personally tried this, but I believe so (though I expect they would continue to be a preemptable instance). That said, [this question](https://stackoverflow.com/questions/31343498/how-do-i-automatically-restart-a-gce-preemptible-instance) asks about automatically bringing preemptable instances back up -- and using them within an instance group does make a bit more sense to me than using them on a one-off basis. – robsiemb Oct 23 '19 at 22:51
1

You can restart your VM when it is in a Terminated state. It's very interesting when you create a Instance Group, (or a NodePool in K8S/GKE, which mean exactly the same thing).

When your VM is unhealthy, which is normal, because it is terminated, the Instance Group tries to start it again automatically. For not critical jobs, like CI worker, it's the perfect choice for reducing cost.

guillaume blaquiere
  • 66,369
  • 2
  • 47
  • 76