Google云:使用空磁盘创建实例模板

问题描述:

如何创建将在实例中创建空磁盘的实例模板?在创建实例模板时,似乎磁盘属性是磁盘所必需的。Google云:使用空磁盘创建实例模板

- name: {{ TEMPLATE_NAME }} 
    type: compute.v1.instanceTemplate 
    properties: 
    properties: 
     machineType: {{ properties["machine_type"] }} 
     canIpForward: False 
     networkInterfaces: 
     - network: "projects/mapreng-1/global/networks/{{ VPC }}" 
     #No internet access if this is not specified 
     accessConfigs: 
     - name: External NAT 
      type: ONE_TO_ONE_NAT 
     disks: 
     - deviceName: boot 
     type: PERSISTENT 
     boot: true 
     autoDelete: true 
     initializeParams: 
      sourceImage: https://www.googleapis.com/compute/v1/projects/{{ PROJECT }}/global/images/{{ IMAGE }} 
     - deviceName: dev1 
     type: SCRATCH 
     autoDelete: true 
     initializeParams: 
      diskType: pd-ssd 
      diskSizeGb: 20 

这种失败在与“源图像必须被指定”

我想的实例模板的一点是,他们让你轻松地创造出许多的机器,看起来都一样,当他们启动通过使用运行时磁盘映像。您是如何考虑使用实际上不启动的实例,因为它们没有磁盘上的操作系统?

+0

不是启动盘。引导磁盘我将在上面的示例中指定。这是我想添加到我的机器上的其他磁盘 - 例如设备dev1在我上面的例子中。 – Neel

+0

那么你可以用新磁盘创建一个实例,从中获取图像,然后将其添加到此模板中? –