身為雲端管理員,您可以在 Automation Assembler 中建立和管理以外掛程式為基礎的 Google Cloud Platform (GCP) 磁碟快照。
如果需要建立磁碟備份,可以在雲端範本中使用快照資源。可以將快照資源連結到任何類型的磁碟。還可以使用快照建立新的執行個體或磁碟。建立快照後,可以登入 Google Cloud 主控台以查看快照。
以下部分包含一些使用快照的範例雲端範本。
建立開機磁碟的快照
以下雲端範本顯示了如何為連結到執行個體的開機磁碟建立快照。在此範例中,將使用計算協助程式、網路協助程式、映像協助程式以及類型模板協助程式。
formatVersion: 1
inputs: {}
resources:
Allocations_Image_1:
type: Allocations.Image
properties:
image: ubuntu
Allocations_Network_1:
type: Allocations.Network
properties:
networkType: existing
Allocations_Compute_1:
type: Allocations.Compute
properties:
accountType: gcp
Allocations_Flavor_1:
type: Allocations.Flavor
properties:
flavor: small
mysql:
type: Idem.GCP.COMPUTE.INSTANCE
properties:
name: mysql
zone: ${resource.Allocations_Compute_1.selectedPlacementCompute.id}
account: ${resource.Allocations_Compute_1.selectedCloudAccount.name}
project: ${resource.Allocations_Compute_1.selectedCloudAccount.additionalProperties.gcp.project}
network_interfaces:
- name: nic0
stack_type: IPV4_ONLY
subnetwork: ${'/projects/' + resource.Allocations_Compute_1.selectedCloudAccount.additionalProperties.gcp.project + '/regions/' + resource.Allocations_Compute_1.selectedRegion.id + '/subnetworks/' + resource.Allocations_Network_1.selectedSubnet.name}
disks:
- device_name: ${resource.mysql-boot-disk.name}
source: ${resource.mysql-boot-disk.resource_id}
boot: true
- boot: false
device_name: ${resource.mssql-attached-disk.name}
source: ${resource.mssql-attached-disk.resource_id}
machine_type: ${'/projects/' + resource.Allocations_Flavor_1.selectedCloudAccount.additionalProperties.gcp.project + '/zones/' + resource.Allocations_Compute_1.selectedPlacementCompute.id + '/machineTypes/' + resource.Allocations_Flavor_1.selectedInstanceTypeName}
mssql-attached-disk:
type: Idem.GCP.COMPUTE.DISK
properties:
name: attached-disk
account: ${resource.Allocations_Compute_1.selectedCloudAccount.name}
size_gb: 1
project: ${resource.Allocations_Flavor_1.selectedCloudAccount.additionalProperties.gcp.project}
zone: ${resource.Allocations_Compute_1.selectedPlacementCompute.name}
type: ${'/projects/' + resource.Allocations_Flavor_1.selectedCloudAccount.additionalProperties.gcp.project + '/zones/' + resource.Allocations_Compute_1.selectedPlacementCompute.id + '/diskTypes/pd-extreme'}
mysql-boot-disk:
type: Idem.GCP.COMPUTE.DISK
properties:
name: mysql-boot-disk
account: ${resource.Allocations_Compute_1.selectedCloudAccount.name}
size_gb: 12
project: ${resource.Allocations_Flavor_1.selectedCloudAccount.additionalProperties.gcp.project}
zone: ${resource.Allocations_Compute_1.selectedPlacementCompute.name}
type: ${'/projects/' + resource.Allocations_Flavor_1.selectedCloudAccount.additionalProperties.gcp.project + '/zones/' + resource.Allocations_Compute_1.selectedPlacementCompute.id + '/diskTypes/pd-balanced'}
mysql-disk-snapshot:
type: Idem.GCP.COMPUTE.SNAPSHOT
dependsOn: ''
properties:
name: mysql-boot-disk-snapshot
account: ${resource.Allocations_Compute_1.selectedCloudAccount.name}
source_disk: ${resource.mysql-boot-disk.resource_id}
使用繫結將 mysql-boot-disk 的 resource_id 傳遞到快照資源。
從快照建立新執行個體
以下雲端範本顯示了如何從快照建立新執行個體。在此範例中,還使用計算協助程式、映像協助程式、網路協助程式以及類型模板協助程式。
atVersion: 1
inputs:
disk-snapshot-Id:
type: string
title: Disk Snapshot Link id
resources:
Allocations_Image_1:
type: Allocations.Image
properties:
image: ubuntu
Allocations_Network_1:
type: Allocations.Network
properties:
networkType: existing
Allocations_Compute_1:
type: Allocations.Compute
properties:
accountType: gcp
Allocations_Flavor_1:
type: Allocations.Flavor
properties:
flavor: small
mysql:
type: Idem.GCP.COMPUTE.INSTANCE
properties:
name: mysql-from-snapshot
zone: ${resource.Allocations_Compute_1.selectedPlacementCompute.id}
account: ${resource.Allocations_Compute_1.selectedCloudAccount.name}
project: ${resource.Allocations_Compute_1.selectedCloudAccount.additionalProperties.gcp.project}
network_interfaces:
- name: nic0
stack_type: IPV4_ONLY
subnetwork: ${'/projects/' + resource.Allocations_Compute_1.selectedCloudAccount.additionalProperties.gcp.project + '/regions/' + resource.Allocations_Compute_1.selectedRegion.id + '/subnetworks/' + resource.Allocations_Network_1.selectedSubnet.name}
disks:
- device_name: ${resource.restored-disk.name}
source: ${resource.restored-disk.resource_id}
boot: true
machine_type: ${'/projects/' + resource.Allocations_Flavor_1.selectedCloudAccount.additionalProperties.gcp.project + '/zones/' + resource.Allocations_Compute_1.selectedPlacementCompute.id + '/machineTypes/' + resource.Allocations_Flavor_1.selectedInstanceTypeName}
restored-disk:
type: Idem.GCP.COMPUTE.DISK
properties:
name: restored
account: ${resource.Allocations_Compute_1.selectedCloudAccount.name}
disk_name: restored-boot
zone: ${resource.Allocations_Compute_1.selectedPlacementCompute.id}
source_snapshot: ${input.disk-snapshot-Id}
boot: true
使用輸入參數,以允許使用者輸入要用於開機磁碟的快照的 snapshot-Id。