設定 Cloud Storage bucket

在 App Design Center,您可以設定 Cloud Storage bucket,儲存及擷取工作負載的非結構化物件資料,例如提供網站內容、封存和災難復原,或發布大型物件。您可以根據 terraform-google-cloud-storage Terraform 模組,自訂 bucket 的元件連線和設定參數。

元件連線

下表列出可連結至 Cloud Storage bucket 的元件,以及應用程式和產生的 Terraform 程式碼會有哪些更新。

連通元件

應用程式更新

背景資訊

Compute Engine 執行個體範本

  • Compute Engine 執行個體可以控管 bucket 物件,包括列出、建立、查看及刪除物件。
  • roles/storage.objectAdmin 角色已指派給 Compute Engine 執行個體範本服務帳戶。
在 bucket 上設定及管理 IAM 政策

服務帳戶

  • 服務帳戶可以管理 Cloud Storage bucket 中的物件。
  • 服務帳戶 IAM 資訊會新增至 Cloud Storage bucket。
  • roles/storage.objectAdmin 角色已指派給服務帳戶。
在 bucket 上設定及管理 IAM 政策

Cloud Run

  • Cloud Run 服務可以管理 Cloud Storage bucket 中的物件。
  • Cloud Run 服務帳戶 IAM 資訊會新增至 Cloud Storage bucket。
  • Cloud Run 服務帳戶已獲派roles/storage.objectAdmin角色。
連線至 Google Cloud 服務

Pub/Sub

  • Pub/Sub 訂閱項目可將訊息寫入 Cloud Storage bucket。
  • Cloud Storage bucket 資訊會新增至 Pub/Sub 訂閱項目欄位。
Cloud Storage 訂閱項目

必要設定參數

如果範本包含 Cloud Storage 元件,您必須先設定下列參數,才能部署。

參數名稱

說明與限制

背景資訊

專案 ID

要部署 Cloud Storage 資源的專案。

設定元件

區域

location 值區位置

名稱

name bucket 名稱

選用設定參數

以下為選用參數。如要顯示進階參數,請在「Configuration」(設定) 區域中選取「Show advanced fields」(顯示進階欄位)。

功能

參數名稱

說明和限制資訊

背景資訊

儲存空間級別

storageClass 儲存空間級別

僅限值區政策

iamConfiguration.uniformBucketLevelAccess 統一值區層級存取權

版本管理

versioning.enabled 物件版本管理

Autoclass

autoclass.enabled Autoclass
資料保留政策

已鎖定

retentionPolicy.isLocked bucket 鎖定功能

保留期限

retentionPolicy.retentionPeriod 資料保留政策

加密

預設 KMS 金鑰名稱

encryption.defaultKmsKeyName 使用客戶自行管理的加密金鑰

生命週期規則

類型

lifecycle.rule[].action.type 物件生命週期管理

儲存空間級別

lifecycle.rule[].action.storageClass setStorageClass

年齡

lifecycle.rule[].condition.age age

Send Age If Zero

send_age_if_zero lifecycle_rules

建立時間早於

lifecycle.rule[].condition.createdBefore createdBefore

With State

with_state lifecycle_rules

符合儲存空間級別

lifecycle.rule[].condition.matchesStorageClass[] matchesStorageClass

符合前置字串

lifecycle.rule[].condition.matchesPrefix[] matchesPrefix 和 matchesSuffix

符合後置字串

lifecycle.rule[].condition.matchesSuffix[] matchesPrefix 和 matchesSuffix

較新版本數量

lifecycle.rule[].condition.numNewerVersions numNewerVersions

自訂時間早於

lifecycle.rule[].condition.customTimeBefore customTimeBefore

自訂時間至今的天數

lifecycle.rule[].condition.daysSinceCustomTime daysSinceCustomTime

變更為非現行版本後至今的天數

lifecycle.rule[].condition.daysSinceNoncurrentTime daysSinceNoncurrentTime

非現行版本時間早於

lifecycle.rule[].condition.noncurrentTimeBefore noncurrentTimeBefore

內部加密設定

建立加密金鑰

如要建立 Cloud Key Management Service 金鑰環和金鑰,請勾選核取方塊。 客戶自行管理的加密金鑰

防止刪除

如要避免 Cloud KMS 金鑰遭到刪除,請勾選核取方塊。 金鑰版本和鎖定的物件

金鑰排定刪除時間長度

destroyScheduledDuration 金鑰版本和鎖定的物件

金鑰輪替週期

rotationPeriod 金鑰輪替

強制刪除

如要在刪除 bucket 時一併刪除其中所有物件,請勾選核取方塊。

force_destroy

IAM 成員

角色

您要授予的一組權限。

在 bucket 上設定及管理 IAM 政策

成員

獲派角色的主體。

在 bucket 上設定及管理 IAM 政策

標籤

金鑰

labels 標記和標籤

值

labels 標記和標籤

自訂刊登位置設定

資料位置

customPlacementConfig.dataLocations[] 雙區域

CORS

來源

cors[].origin[] 跨源資源共享 (CORS)

方法

cors[].method[] CORS 的運作方式

回應標頭

cors[].responseHeader[] CORS 設定的元件

Max Age Seconds

cors[].maxAgeSeconds[] CORS 設定的元件

記錄檔 bucket

logging.logBucket 用量記錄和儲存空間記錄

記錄物件前置字元

logging.logObjectPrefix 用量記錄和儲存空間記錄

網站

Main Page Suffix

website.mainPageSuffix 建議:指派專頁

找不到網頁

website.notFoundPage 建議:指派專頁

禁止公開存取

iamConfiguration.publicAccessPrevention 禁止公開存取

虛刪除政策

保留時間長度 (秒)

softDeletePolicy.retentionDurationSeconds 虛刪除