I need to create preemptive VMs programmatically. I'm trying to make VMs using the Google Cloud SDK for Java but I'm unable to find any documentation about creation of Preemptive VMs.
Asked
Active
Viewed 191 times
1 Answers
1
I suspect you're not finding the answer because you're searching on "preemptive", when the term that is used in the Google Documentation is "preemptible". So the answer you want can be found here at google:
In answer to your question, though, if you are using the Google Cloud SDK for Java, when you create the instance you need to create a "preemptible" property under "scheduling", and set it to true.
The equivalent if you were sending the SOAP command over https:
POST https://www.googleapis.com/compute/v1/projects/[PROJECT_ID]/zones/[ZONE]/instances
{
'machineType': 'zones/[ZONE]/machineTypes/[MACHINE_TYPE]',
'name': '[INSTANCE_NAME]',
'scheduling':
{
'preemptible': true
},
...
}
... and if you are using the Google Cloud SDK CLI, then it's a matter of using the --preemtible
command flag:
gcloud compute instances create [INSTANCE_NAME] --preemptible

zx485
- 28,498
- 28
- 50
- 59

Theodore Ts'o
- 556
- 2
- 8