Google Cloud Platform会在没有提示的情况下删除或停止实例 [英] Google Cloud Platform delete or stop instances without prompt

查看:52
本文介绍了Google Cloud Platform会在没有提示的情况下删除或停止实例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以使用Google计算api毫无问题地启动实例.我实际上是在使用脚本进行一些轻型自动缩放.我从快照成功启动了这些实例,没有任何障碍.但是,删除实例要求我确认.

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 ...

以下实例将被删除.附加磁盘配置为被自动删除的文件将被删除,除非它们被附加到其他任何文件上实例.删除磁盘是不可逆的,并且磁盘上的任何数据会迷路.-[us-central1-f]中的[xxx-client-1]-[us-central1-f]中的[xxx-client-2]-[us-central1-f]中的[xxx-client-3]

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 would be ok with stopping the instances, but this seems to fail:

gcloud compute instances stop ...

错误:(gcloud.compute.instances)选择无效:停止".您是说列出"吗?

ERROR: (gcloud.compute.instances) Invalid choice: 'stop'. Did you mean 'list'?

停止"是否已更改?

推荐答案

在删除命令上指定-quiet -q .这将禁用提示(并采用默认值). gcloud帮助描述了该命令以及所有命令中可用的其他gcloud标志选项.

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.

关于停止",您正在使用什么版本的gcloud(您可以运行 gcloud --version 进行查找)?听起来您的gcloud客户端旧了.

Regarding 'stop', what version of gcloud are you using (you can run gcloud --version to find out)? Sounds like your gcloud client is old.

这篇关于Google Cloud Platform会在没有提示的情况下删除或停止实例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆