【问题标题】:How to reuse static IP address on google cloud compute engine from command line如何从命令行重用谷歌云计算引擎上的静态 IP 地址
【发布时间】:2019-09-27 16:02:48
【问题描述】:

我在谷歌云中保留了一个静态 IP 地址。 但是我不明白如何使用 gcloud 配置新实例并指定使用这个私有 ip。目前我的命令看起来像:

gcloud compute instances create demo-instance-1 \
--image-family debian-9 \
--image-project debian-cloud \
--machine-type n1-standard-1 \
--scopes "userinfo-email,cloud-platform" \
--metadata-from-file startup-script=instance-startup.sh \
--zone europe-west2-b \
--tags http-server

【问题讨论】:

    标签: google-cloud-platform google-compute-engine google-cloud-networking


    【解决方案1】:

    要分配静态外部 IP 地址,请在创建实例期间添加 --address 标志并提供静态外部 IP 地址:

    gcloud compute instances create [INSTANCE_NAME] --address [IP_ADDRESS]
    

    在列出计算实例的详细信息时,外部 IP 地址定义为 networkInterfaces/accessConfigs/natIP

    使用此命令修改现有实例

    gcloud compute instances add-access-config [INSTANCE_NAME] --access-config-name=external-nat --zone [ZONE_NAME] --address=[IP_ADDRESS]
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-09-05
      • 2017-04-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-08-18
      相关资源
      最近更新 更多