I want to automatically delete instances in google compute engine.
For that I use gcloud gcloud compute instances delete instance-name --zone instance-zone
However gcloud asks me to confirm the action. Is it possible to omit this step and do it automatically?
You can override the default region and zone set in the metadata server by setting the default region and zone in your local client, setting the default region and zone in environment variables, or by including the --zone or --region flag in your commands.
You use the gcloud compute ssh command to connect to your VM. Compute Engine sets a username and creates a persistent SSH key pair with the following configurations: Your username is set as the username in your local machine.
gcloud -q compute instances delete instance-name --zone instance-zone
(--quiet, -q Disable all interactive prompts.)
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