作为云管理员,您可以在构建基础架构时利用 Google Cloud Platform (GCP) 插件置备基于插件的存储桶。此外,还可以使用分配帮助程序为存储桶提供分配逻辑。基于插件的存储桶支持包括创建多区域或双区域存储桶资源、受限的公共访问和加密。
要了解有关 VMware Aria Automation 中的插件和分配的更多信息,请参见 Automation Assembler 中基于插件的设计和部署
存储桶属性
基于插件的存储桶资源需要以下属性。有关实例属性的完整列表,请参见 Google Cloud REST 文档。GCP 文档中的资源属性以驼峰形式编写,而 Automation Assembler 中的资源属性以蛇形形式编写。
| 属性 | 说明 |
|---|---|
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
metadata:
layoutPosition:
- 0
- 0
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。
注: 客户管理的加密密钥必须与存储桶位于同一区域中。