身為雲端管理員,您可以在建置基礎結構時利用 Google Cloud Platform (GCP) 外掛程式佈建以外掛程式為基礎的儲存區值區。此外,還可以使用配置協助程式為儲存區值區提供配置邏輯。以外掛程式為基礎的儲存區值區支援包括建立多區域或雙區域值區資源、受限的公用存取和加密。
若要進一步瞭解 VMware Aria Automation 中的外掛程式和配置,請參閱〈Automation Assembler 中以外掛程式為基礎的設計和部署〉
儲存區值區內容
以外掛程式為基礎的儲存區值區資源需要以下內容。如需有關執行個體內容的完整清單,請參閱 Google Cloud REST 說明文件。GCP 說明文件中的資源內容以駝峰形式撰寫,而 Automation Assembler 中的資源內容以 snake case (蛇形命名法) 撰寫。
| 內容 | 說明 |
|---|---|
name |
儲存區值區的名稱。建立後,無法變更與值區關聯的名稱,因此該名稱必須唯一且人工可讀。 如需值區名稱需求,請參閱 Google Cloud 說明文件中的值區名稱。 |
account |
您的團隊在其中部署雲端範本的帳戶區域的 GCP 雲端帳戶。 如需詳細資訊,請參閱〈在 VMware Aria Automation 中建立 Google Cloud Platform 雲端帳戶〉。 |
以下部分包含一些用於在 Automation Assembler 中佈建以外掛程式為基礎的儲存區值區的範例雲端範本。
佈建單一區域儲存區值區
可以透過在雲端範本中對區域進行硬式編碼,佈建單一區域儲存區值區,如以下範例所示。
formatVersion: 1
inputs: {}
resources:
Idem_GCP_STORAGE_BUCKET_1:
type: Idem.GCP.STORAGE.BUCKET
metadata:
layoutPosition:
- 0
- 0
properties:
name: bucket-test
account: gcp-account
location: us-central1
(可選) 可以使用 enum 內容建置區域清單,供使用者進行選擇。在此範例中,還為值區啟用版本設定,使用值區標籤,並允許使用者選擇儲存區類別。
formatVersion: 1
inputs:
region:
type: string
title: Region
description: Google region
# This enumeration is used to simplify the choosing of a region. You can just hardcode the region in the "region" section.
enum:
- europe-central2
- europe-north1
- europe-southwest1
- europe-west1
- europe-west2
- europe-west3
- europe-west4
- europe-west6
- europe-west8
- europe-west9
- europe-west12
loc:
type: string
title: Location label
bucket:
type: string
title: Bucket name
storage_class:
type: string
title: Storage class
enum:
- STANDARD
- NEARLINE
- COLDLINE
- ARCHIVE
versioning:
type: string
title: Enable versioning
enum:
- 'Yes'
- 'No'
resources:
Idem_GCP_STORAGE_BUCKET_1:
type: Idem.GCP.STORAGE.BUCKET
properties:
name: ${input.bucket}
account: gcp-account
labels:
location: ${input.loc}
location: ${input.region}
storage_class: ${input.storage_class}
versioning:
enabled: ${input.versioning=="Yes"?true:false}
佈建雙區域儲存區值區
以下雲端範本顯示了如何建立雙區域儲存區值區。若要使用此範本,請完成以下步驟:
- 建立一個 GCP 雲端帳戶,該帳戶至少具有兩個雲端區域,且這些雲端區域對應於將部署值區的區域。在此範例中,區域為 europe-central2 和 europe-north1。
- 建立新專案並新增雲端區域。
- 使用功能標籤標記區域。在此範例中,對於 europe-central2,標籤為
location:eu1,對於 europe-north1,標籤為location:eu2。 - 部署藍圖。
inputs: {}
resources:
Idem_GCP_STORAGE_BUCKET_1:
type: Idem.GCP.STORAGE.BUCKET
metadata:
layoutPosition:
- 0
- 1
properties:
name: bucket-dual-region-idem
account: ${resource.Allocations_Compute_1.selectedCloudAccount.name}
labels:
a: b
c: d
custom_placement_config:
data_locations: ${[resource.Allocations_Compute_1.selectedRegion.name, resource.Allocations_Compute_2.selectedRegion.name]}
location: EU
Allocations_Compute_1:
type: Allocations.Compute
metadata:
layoutPosition:
- 1
- 0
properties:
groupId: 1
constraints:
- tag: location:eu1
Allocations_Compute_2:
type: Allocations.Compute
metadata:
layoutPosition:
- 1
- 2
properties:
groupId: 2
constraints:
- tag: location:eu2
備註: 如果需要移除值區標籤,請將標籤的值變更為
null,然後重新部署範本。可以在 Google Cloud 主控台中驗證是否已移除標籤。
佈建多區域儲存區值區
以下雲端範本顯示了如何建立多區域儲存區值區。依預設,值區為多區域,包括位於美國位置的區域。
formatVersion: 1
inputs: {}
resources:
Idem_GCP_STORAGE_BUCKET_1:
type: Idem.GCP.STORAGE.BUCKET
metadata:
layoutPosition:
- 0
- 0
properties:
name: bucket-test-1
account: gcp-account
以下雲端範本顯示了如何建立加密多區域儲存區值區。
formatVersion: 1
inputs: {}
resources:
Idem_GCP_STORAGE_BUCKET_1:
type: Idem.GCP.STORAGE.BUCKET
metadata:
layoutPosition:
- 0
- 0
properties:
name: bucket-test-0
account: gcp-account
labels:
a: b
c: d
encryption:
default_kms_key_name: projects/gcp-account/locations/us/keyRings/gcp-test-1/cryptoKeys/key-2
如果要建立公用存取受限且透過 CMEK 加密的儲存區值區,需要滿足一些必要條件,如以下連結中所述:
https://cloud.google.com/storage/docs/encryption/using-customer-managed-keys。
備註: 客戶管理的加密金鑰必須與儲存區值區位於同一區域中。