【问题标题】:Create GCE VM with internet connection via API通过 API 创建具有 Internet 连接的 GCE VM
【发布时间】:2021-11-26 15:12:39
【问题描述】:

我可以通过云控制台从映像创建一个新 VM,并在该 VM 上自动获取外部 IP 和互联网连接。但是当通过 API (node.js) 这样做时,我没有获得外部 IP,并且该 VM 上没有互联网连接。我的代码:

 var vmName = 'testvm1';
 const [vm, operation] = await zone.createVM(vmName, { os: 'ubuntu' });
 zone.createVM('debian-http', {
            disks: [{
                boot: true,
                source: 'https://www.googleapis.com/compute/v1/projects/[project-id]/zones/us-central1-f/disks/debian-http'
            }],
            http: true,
            machineType: 'f1-micro'
        })

我必须应用哪些参数才能获取外部 IP?

【问题讨论】:

  • 问题是否已解决或仍有问题?
  • 我解决了,看答案

标签: google-cloud-platform virtual-machine google-compute-engine


【解决方案1】:

我刚刚添加了:

const config = {
            machineType: 'n1-standard-1',
            maintenancePolicy: 'MIGRATE',
            http: true,
          ...
}

不行

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-05-31
    • 1970-01-01
    • 1970-01-01
    • 2018-11-18
    • 2020-07-24
    • 2016-07-11
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多