使用預先定義的機構政策

如要對 AlloyDB for PostgreSQL 叢集和備份強制執行組織層級的加密規定,您可以在專案、資料夾或組織層級,套用預先定義的組織政策限制。

客戶自行管理的加密金鑰 (CMEK) 組織政策

您可以使用 CMEK 組織政策,控管 AlloyDB 叢集和備份的 CMEK 設定。這項政策可讓您控管用於保護資料的 Cloud Key Management Service (Cloud KMS) 金鑰。

AlloyDB 支援兩項組織政策限制,可協助在整個組織中強制執行 CMEK 保護措施:

  • constraints/gcp.restrictNonCmekServices:要求 alloydb.googleapis.com 服務使用 CMEK 保護機制。新增這項限制,並將 alloydb.googleapis.com 新增至 Deny 政策服務清單後,AlloyDB 會拒絕建立新的叢集或備份,除非這些叢集或備份已啟用 CMEK。

  • constraints/gcp.restrictCmekCryptoKeyProjects:限制 AlloyDB 叢集和備份中,可用於 CMEK 保護的 Cloud KMS CryptoKey。有了這項限制,當 AlloyDB 使用 CMEK 建立新的叢集或備份時,CryptoKey 必須來自允許的專案、資料夾或組織。

這些限制只會對新建立的 AlloyDB 叢集和備份強制執行。

如需更多總覽資訊,請參閱「CMEK 組織政策」。如要瞭解 CMEK 組織政策限制,請參閱「組織政策限制」。

事前準備

  1. 登入 Google Cloud 帳戶。如果您未曾使用過 Google Cloud,歡迎 建立帳戶,親自體驗實際使用我們產品的成效。新客戶還能獲得價值 $300 美元的免費抵免額,用於執行、測試及部署工作負載。
  2. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Roles required to select or create a project

    • Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
    • Create a project: To create a project, you need the Project Creator role (roles/resourcemanager.projectCreator), which contains the resourcemanager.projects.create permission. Learn how to grant roles.

    Go to project selector

  3. Verify that billing is enabled for your Google Cloud project.

  4. Install the Google Cloud CLI.

  5. If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.

  6. To initialize the gcloud CLI, run the following command:

    gcloud init
  7. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Roles required to select or create a project

    • Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
    • Create a project: To create a project, you need the Project Creator role (roles/resourcemanager.projectCreator), which contains the resourcemanager.projects.create permission. Learn how to grant roles.

    Go to project selector

  8. Verify that billing is enabled for your Google Cloud project.

  9. Install the Google Cloud CLI.

  10. If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.

  11. To initialize the gcloud CLI, run the following command:

    gcloud init
  12. 在「IAM & Admin」(IAM 與管理) 頁面中,將「Organization Policy Administrator」(組織政策管理員) 角色 (roles/orgpolicy.policyAdmin) 新增至使用者或服務帳戶。

    前往「IAM accounts」(IAM 帳戶) 頁面

新增 CMEK 組織政策

如要新增 CMEK 組織政策,請按照下列步驟操作:

  1. 前往「組織政策」頁面。

    前往「Organization Policies」(組織政策) 頁面

  2. 按一下 Google Cloud 控制台選單列中的下拉式選單,然後選取需要組織政策的專案、資料夾或組織。「Organization policies」(組織政策) 頁面會顯示可用的組織政策限制清單。

  3. 如要設定 constraints/gcp.restrictNonCmekServices,請按照下列步驟操作:

    1. 使用 ID:constraints/gcp.restrictNonCmekServices 或 Name:Restrict which services may create resources without CMEK 篩選限制。
    2. 按一下限制「名稱」。
    3. 按一下 [編輯]。
    4. 點按「自訂」。
    5. 按一下「Add rule」(新增規則)。
    6. 在「Policy values」(政策值) 底下,點選「Custom」(自訂)。
    7. 在「Policy types」(政策類型) 下方,選取「Deny」(拒絕)。
    8. 在「Custom values」(自訂值)下方輸入 alloydb.googleapis.com。這項設定會在建立 AlloyDB 叢集和備份時強制執行 CMEK。
  4. 如要設定 constraints/gcp.restrictCmekCryptoKeyProjects,請按照下列步驟操作:

    1. 篩選限制 ID:constraints/gcp.restrictCmekCryptoKeyProjects 或 Name:Restrict which projects may supply KMS CryptoKeys for CMEK。
    2. 按一下限制「名稱」。
    3. 按一下 [編輯]。
    4. 點按「自訂」。
    5. 按一下「Add rule」(新增規則)。
    6. 在「Policy values」(政策值) 底下,點選「Custom」(自訂)。
    7. 在「Policy types」(政策類型),選取「Allow」(允許)。
    8. 在「Custom values」(自訂值) 下方,使用下列格式輸入資源:under:organizations/ORGANIZATION_ID、under:folders/FOLDER_ID 或 projects/PROJECT_ID。

      這項設定會限制 AlloyDB 叢集和備份,只能使用允許的專案、資料夾或組織中的 Cloud KMS 金鑰。

  5. 依序按一下 [完成] 和 [儲存]。

後續步驟