[英]How to attach a static external IP address to a google cloud compute instance using the CLI
I want to create a google cloud compute instance with a static external ip address.我想使用 static 外部 ip 地址创建一个谷歌云计算实例。 I can do that if I manually do it with the console in the browser.
如果我使用浏览器中的控制台手动执行此操作,我可以做到这一点。
I have been looking through the documentation, I can't see an argument to create the static external IP address on creation using the CLI tools.我一直在查看文档,在使用 CLI 工具创建时,我看不到创建 static 外部 IP 地址的参数。
To create instances I have been using gcloud compute instances create --zone us-central1-a --source-instance-template instance-template instance-node-1
要创建实例,我一直在使用
gcloud compute instances create --zone us-central1-a --source-instance-template instance-template instance-node-1
How do I attach a static external IP address to it using the CLI so that when I shut it down and restart it, it will have the same IP address?如何使用 CLI 将 static 外部 IP 地址附加到它,以便在我将其关闭并重新启动时,它将具有相同的 IP 地址?
You can get exactly you want with "--address" flag.您可以使用“--address”标志获得您想要的。
According to Google document, You can create a vm instance with static external IP address like below.根据 Google 文档,您可以使用 static 外部 IP 地址创建一个 vm 实例,如下所示。
gcloud compute instances create INSTANCE_NAME --address IP_ADDRESS
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.