I can use Google compute api to start instances with no problem. I am actually using a script for some light auto-scaling. I boot these instances from a snapshot successfully with no block. However, deleting the instances asks me for confirmation.
gcloud compute instances delete ...
The following instances will be deleted. Attached disks configured to be auto-deleted will be deleted unless they are attached to any other instances. Deleting a disk is irreversible and any data on the disk will be lost. - [xxx-client-1] in [us-central1-f] - [xxx-client-2] in [us-central1-f] - [xxx-client-3] in [us-central1-f]
Do you want to continue (Y/n)? Y
I want to delete without prompt.
I would be ok with stopping the instances, but this seems to fail:
gcloud compute instances stop ...
ERROR: (gcloud.compute.instances) Invalid choice: 'stop'. Did you mean 'list'?
Has 'stop' been changed?
To stop a VM, use the Google Cloud console, the gcloud CLI, or the Compute Engine API. In the console, go to the VM instances page. Select one or more VMs that you want to stop. Click Stop.
A stopped instance does not incur charges, but all of the resources that are attached to the instance will still be charged. For example, you are charged for persistent disks and external IP addresses according to the price sheet, even if an instance is stopped.
If you would like to completely reset an instance to it's original, unmodified state, the most efficient method would be to simply create a new instance of the same specification (i.e. by selecting the same source image and machine settings), and then to delete the old/modified one.
Specify --quiet
or -q
on your delete command. This will disable prompts (and assume defaults). gcloud help
describes this and other gcloud flag options available on all commands.
Regarding 'stop', what version of gcloud are you using (you can run gcloud --version
to find out)? Sounds like your gcloud client is old.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With