限制資源位置

總覽

本指南說明如何設定包括資源位置限制的組織政策

您可以使用機構政策服務資源位置限制,限制新資源的實際位置。也可以使用資源的位置屬性來識別服務部署和維護該資源的位置。對於某些 Google Cloud 服務中包含資料的資源,此屬性也反映了資料的儲存位置。這項限制可讓您定義允許的位置,在階層中建立支援服務的資源。 Google Cloud

定義資源位置後,這項限制只會套用至新建立的資源。在設定資源位置限制之前,您建立的資源將繼續存在並執行其功能。

對於某些服務 (例如 Cloud Storage 和 Managed Service for Apache Spark) 的子資源建立,不會強制執行包含此限制的政策。

限制

資源位置機構政策服務限制,可控制是否能建立可選取位置的資源。這項限制條件不會影響建立全域性資源的位置,例如 Compute Engine 全域位址,或不支援選取位置的資源。

為避免破壞現有的服務基礎架構,您應該先以非實際工作環境的專案和資料夾測試任何新政策,然後才在機構內逐步套用政策。

如需資料儲存承諾的相關資訊,請參閱Google Cloud 服務條款服務專屬條款。包含資源位置限制的組織政策不是資料儲存承諾。

此限制適用於部分特定的產品和資源類型。如需支援的服務清單,以及各項服務的行為詳細說明,請參閱「支援限制資源位置的服務」頁面。

位置類別

您可以在代表不同大小類別的位置類型中部署 Google Cloud 資源。最大的位置類型是 multi-region,其中包括多個 region。每個 region 進一步劃分為 zones。如要進一步瞭解地區和區域,請參閱地區和區域總覽

  • Multi-region 位置受到一或多個 region 的實體資源支援,並且通常僅由以儲存為基礎的資源使用。例如 usasiaeuropeglobal

  • Region 位置在地理位置上互相隔離。部分範例包括 us-west1 (奧勒岡)、asia-northeast1 (東京) 和 europe-west1 (比利時)。

  • Zone 位置是用於部署資源的最精細且隔離的位置類型。zoneregion 內的一個獨立故障網域。例如 us-east1-bus-west1-basia-northeast1-a。 Google Cloud 也提供專為 AI 和機器學習工作負載量身打造的AI 可用區,例如 us-central1-ai1a

設定地點時,請使用 in: 前置字元和值群組。使用 Google 收錄的值組 Google Cloud可讓您選擇地理位置,不必指定目前或未來的 Cloud 位置。

值組的 in: 前置字元指定值組內的所有值都視為政策的一部分。如果輸入群組值或 Google Cloud 區域時未加上前置字串,系統會根據下列規則自動加上 in: 前置字串:

  • 如果您輸入使用 in: 前置字串的位置,且該位置含有任何無效群組,政策變更就會失敗。
  • 如果您輸入的地區是區域,例如 us-east1,系統會加上 in: 前置字元,例如 in:us-east1-locations
  • 如果您輸入區域或多區域值群組 (例如 us-locations),系統會在前面加上 in: 前置字元,因此在這個範例中會變成 in:us-locations
  • 如果您輸入 us-east1-bus 等可用區或多區域,值不會變更。

設定機構政策

資源位置限制是一種舊版代管限制,具有清單規則。您可以從資源位置限制的 allowed_valuesdenied_values 清單新增或移除位置。如要防止組織政策在新位置加入可用清單時意外限制服務行為,請使用值群組或使用代表您要定義的整個地理界線的 allowed_values 清單。

如要設定包含資源位置限制的組織政策

控制台

  1. 前往 Google Cloud 控制台的「Organization policies」(組織政策) 頁面。

    前往「Organization policies」(組織政策)

  2. 在專案選擇工具中,選取要設定組織政策的機構、資料夾或專案。

  3. 選取「Google Cloud Platform - Resource Location Restriction」限制,開啟「Policy details」頁面。

  4. 按一下「Manage Policy」(管理政策)

  5. 在「Edit policy」(編輯政策) 頁面,選取「Override parent's policy」(覆寫上層政策)

  6. 在「Policy enforcement」(政策強制執行) 下方,選取「Replace」(取代)

  7. 按一下「Add rule」(新增規則)

  8. 在「Policy values」(政策值) 底下,選取「Custom」(自訂)。

  9. 在「政策類型」下方,選取「允許」即可建立允許的位置清單,或選取「拒絕」建立拒絕的位置清單。

  10. 在「Policy value」(政策值) 方塊中,輸入前置字串 in 以及值群組位置字串,然後按一下 Enter 鍵。

    例如 in:us-locationsin:us-west1-locations。按一下「新增值」,即可輸入多個位置字串。

    您也可以將特定可用區、區域或多區域位置輸入為位置字串。如需可用位置的清單,請參閱「支援限制資源位置的服務」頁面。

  11. 如要強制執行這項政策,請按一下「設定政策」

gcloud

如要建立強制執行資源位置限制的組織政策,請建立參照限制的政策 YAML 檔案:

name: organizations/ORGANIZATION_ID/policies/gcp.resourceLocations
spec:
  rules:
  - values:
      deniedValues:
      - in:us-east1-locations
      - in:northamerica-northeast1-locations

如要強制執行包含限制的機構政策,請執行下列指令:

gcloud org-policies set-policy POLICY_PATH

更改下列內容:

  • ORGANIZATION_ID:您的組織 ID,例如 01234567890。
  • POLICY_PATH:包含機構政策的 YAML 檔案完整路徑。

系統會傳回包含新機構政策結果的回應:

name: organizations/01234567890/policies/gcp.resourceLocations
spec:
  rules:
  - values:
      deniedValues:
      - in:us-east1-locations
      - in:northamerica-northeast1-locations

您也可以將特定可用區、區域或多區域位置輸入為位置字串。如需可用位置清單,請參閱「資源位置支援的服務」頁面。

API

您可以使用 Resource Manager API 在資源上設定機構政策。您需要 OAuth 2.0 不記名憑證才能進行身分驗證和授權。

如要使用資源位置限制設定組織政策:

curl -X POST -H "Content-Type: application/json" -H "Authorization: \
Bearer ${bearer_token}" -d '{policy: {etag: "BwVtXec438Y=", constraint: \
"constraints/gcp.resourceLocations", list_policy: {denied_values: \
["in:europe-locations", "in:southamerica-locations"] }}}' \
https://cloudresourcemanager.googleapis.com/v1/organizations/123456789:setOrgPolicy

系統會傳回包含新機構政策結果的回應:

name: organizations/01234567890/policies/gcp.resourceLocations
spec:
  rules:
  - values:
      deniedValues:
      - in:europe-locations
      - in:southamerica-locations

您也可以將特定可用區、區域或多區域位置輸入為位置字串。如需可用位置清單,請參閱「資源位置支援的服務」頁面。

如要瞭解如何在組織政策中使用限制,請參閱「建立組織政策」。

在機構政策中使用沿用

您可以修正機構政策,以繼承資源的父項節點機構政策。沿用讓您可以精確控制在整個資源階層中使用的組織政策。

如要在資源節點上啟用沿用,請在機構政策 YAML 檔案中設定 inheritFromParent = true。例如:

name: organizations/01234567890/policies/gcp.resourceLocations
spec:
  inheritFromParent: true
  rules:
  - values:
      deniedValues:
      - in:us-west1

允許或拒絕在 AI 可用區建立 VM

如要允許或拒絕在 AI 可用區建立 VM,請在自訂組織政策中建立及強制執行自訂限制。

AI 可用區的名稱中會包含 ai 字串。舉例來說,us-west4-ai2bus-west4 區域中的 AI 可用區,而 us-west4-b 是父項可用區。建立自訂限制時,請在條件中使用 -ai 字串。如要進一步瞭解 AI 可用區,請參閱「關於 AI 可用區」一文。

如要瞭解管理組織政策所需的權限,請參閱「建立及管理自訂限制」頁面的「必要角色」。

如要設定自訂機構政策,允許或拒絕在 AI 區域中建立 VM,請完成下列步驟:

  1. 為 AI 可用區建立自訂限制

    視要允許或拒絕在 AI 區域中建立 VM 而定,請使用下列其中一個限制建立 YAML 檔案。

    • 如要只允許在 AI 可用區建立 VM,請使用下列限制條件:

      name: organizations/ORGANIZATION_ID/customConstraints/custom.allowOnlyAiZones
      resource_types:
      - compute.googleapis.com/Instance
      method_types:
      - CREATE
      - UPDATE
      actionType: ALLOW
      condition: "resource.zone.contains('-ai')"
      displayName: allowOnlyAiZones
      description: Allow VMs to be created in AI zones only.
      
    • 如要禁止在 AI 可用區中建立 VM,請使用下列限制條件:

      name: organizations/ORGANIZATION_ID/customConstraints/custom.denyAiZones
      resource_types:
      - compute.googleapis.com/Instance
      method_types:
      - CREATE
      - UPDATE
      actionType: DENY
      condition: "resource.zone.contains('-ai')"
      displayName: denyAiZones
      description: Deny VMs from being created in AI zones.
      

      ORGANIZATION_ID 替換為您的機構 ID,例如 01234567890

  2. 設定自訂限制條件

    為自訂限制建立 YAML 檔案後,您必須設定自訂限制,才能用於組織政策。

    如要設定自訂限制,請使用 gcloud org-policies set-custom-constraint 指令:

    gcloud org-policies set-custom-constraint CONSTRAINT_PATH
    

    CONSTRAINT_PATH 替換成自訂限制 YAML 檔案的完整路徑,例如 /home/user/customconstraint.yaml

  3. 建立機構政策

    如要建立強制執行自訂限制的組織政策,請建立參照限制的政策 YAML 檔案:

    name: projects/PROJECT_ID/policies/CONSTRAINT_NAME
    spec:
      rules:
      - enforce: true
    

    更改下列內容:

    • PROJECT_ID:要強制執行限制的專案。

    • CONSTRAINT_NAME:自訂限制的名稱,例如 custom.allowOnlyAiZonescustom.denyAiZones

  4. 在專案中強制執行自訂組織政策

    如要強制執行包含自訂限制的機構政策,請執行下列指令:

    gcloud org-policies set-policy POLICY_PATH
    

    請將 POLICY_PATH 替換為組織政策 YAML 檔案的完整路徑。機構政策變更最多可能需要 15 分鐘才會全面生效。

如要進一步瞭解自訂限制,請參閱「建立自訂限制」。如要排解問題,請參閱「排解自訂限制問題」。

錯誤訊息示例

如果服務支援資源位置限制,就無法在違反限制的位置建立新資源。如果服務嘗試在違反限制的位置建立資源,這項嘗試將會失敗,並產生錯誤訊息。

這則錯誤訊息的格式如下: LOCATION_IN_REQUEST violates constraint constraints/gcp.resourceLocations on the resource RESOURCE_TESTED.

在下列範例中,由於政策強制執行,Compute Engine 資源無法建立新的執行個體

Location ZONE:us-east1-b violates constraint constraints/gcp.resourceLocations
on the resource
projects/policy-violation-test/zones/us-east1-b/instances/instance-3.

Google Cloud Observability 和 Cloud 稽核記錄記錄項目:

{
 insertId: "5u759gdngec"
 logName: "projects/policy-violation-test/logs/cloudaudit.googleapis.com%2Factivity"
 protoPayload: {
  @type: "type.googleapis.com/google.cloud.audit.AuditLog"
  authenticationInfo: {}
  authorizationInfo: [6]
  methodName: "beta.compute.instances.insert"
  request: {}
  requestMetadata: {}
  resourceLocation: {}
  resourceName: "projects/policy-violation-test/zones/us-east1-b/instances/instance-3"
  response: {
   @type: "type.googleapis.com/error"
   error: {
    code: 412
    errors: [
     0: {
      domain: "global"
      location: "If-Match"
      locationType: "header"
      message: "Location ZONE:us-east1-b violates constraint constraints/gcp.resourceLocations on the resource projects/policy-violation-test/zones/us-east1-b/instances/instance-3."
      reason: "conditionNotMet"
     }
    ]
    message: "Location ZONE:us-east1-b violates constraint constraints/gcp.resourceLocations on the resource projects/policy-violation-test/zones/us-east1-b/instances/instance-3."
   }
  }
  serviceName: "compute.googleapis.com"
  status: {
   code: 3
   message: "INVALID_ARGUMENT"
  }
 }
 receiveTimestamp: "2019-06-14T03:04:23.660988360Z"
 resource: {
  labels: {}
  type: "gce_instance"
 }
 severity: "ERROR"
 timestamp: "2019-06-14T03:04:22.783Z"
}

安全漏洞發現項目和修復

資源位置限制會在執行階段限制資源的建立。這項功能有助於避免發生地點違規情形,但不會找出或修正現有的違規問題。您可以透過 Security Command Center 的內建服務「安全狀態分析」,在資源階層中找出位置違規事項。詳情請參閱「組織政策安全漏洞發現」。

如果安全狀態分析發現有位置違規事項,請參閱「修正安全狀態分析發現項目」,瞭解如何修正這些發現項目。

值組搭配

值組搭配是由 Google 收錄的群組和位置的集合,提供簡易定義資源位置的方法。值組搭配包含許多相關位置,並且會隨著時間的演進而不斷擴展,所以無需更改您的機構政策來配合新位置。

如要在機構政策中使用值組,請先輸入 in: 字串再輸入值組。如要進一步瞭解如何使用值前置字串,請參閱「建立組織政策」。在設定機構政策的呼叫中會驗證群組名稱。使用無效的群組名稱會導致政策設定失敗。

下表包含目前可用群組的清單:

群組 說明 直接成員
約翰尼斯堡 約翰尼斯堡的所有位置:
in:africa-south1-locations
值:
  • africa-south1
  • africa-south1-a
  • africa-south1-b
  • africa-south1-c
亞洲 亞洲所有位置:
in:asia-locations
群組:
  • asia-east2-locations
  • id-locations
  • il-locations
  • in-locations
  • jp-locations
  • kr-locations
  • me-central1-locations
  • sa-locations
  • sg-locations
  • tw-locations

值:
  • asia
  • asia1
  • aws-ap-northeast-2
香港 香港所有位置:
in:asia-east2-locations
值:
  • asia-east2
  • asia-east2-a
  • asia-east2-b
  • asia-east2-c
印尼 印尼境內的所有地點:
in:id-locations
群組:
  • asia-southeast2-locations

值:
  • id
雅加達 雅加達所有位置:
in:asia-southeast2-locations
值:
  • asia-southeast2
  • asia-southeast2-a
  • asia-southeast2-b
  • asia-southeast2-c
以色列 以色列境內所有地點:
in:il-locations
群組:
  • me-west1-locations

值:
  • il
以色列 以色列境內所有地點:
in:me-west1-locations
值:
  • me-west1
  • me-west1-a
  • me-west1-b
  • me-west1-c
印度 印度境內所有地點:
in:in-locations
群組:
  • asia-south1-locations
  • asia-south2-locations

值:
  • in
孟買 孟買所有位置:
in:asia-south1-locations
值:
  • asia-south1
  • asia-south1-a
  • asia-south1-b
  • asia-south1-c
德里 德里境內的所有地點:
in:asia-south2-locations
值:
  • asia-south2
  • asia-south2-a
  • asia-south2-b
  • asia-south2-c
日本 日本境內所有地點:
in:jp-locations
群組:
  • asia-northeast1-locations
  • asia-northeast2-locations

值:
  • jp
東京 東京所有位置:
in:asia-northeast1-locations
值:
  • asia-northeast1
  • asia-northeast1-a
  • asia-northeast1-b
  • asia-northeast1-c
大阪 大阪所有位置:
in:asia-northeast2-locations
值:
  • asia-northeast2
  • asia-northeast2-a
  • asia-northeast2-b
  • asia-northeast2-c
韓國 韓國境內所有地點:
in:kr-locations
群組:
  • asia-northeast3-locations

值:
  • kr
首爾 首爾所有位置:
in:asia-northeast3-locations
值:
  • asia-northeast3
  • asia-northeast3-a
  • asia-northeast3-b
  • asia-northeast3-c
杜哈 多哈所有地點:
in:me-central1-locations
值:
  • me-central1
  • me-central1-a
  • me-central1-b
  • me-central1-c
沙烏地阿拉伯 沙烏地阿拉伯境內的所有地點:
in:sa-locations
群組:
  • me-central2-locations

值:
  • sa
達曼 達曼所有位置:
in:me-central2-locations
值:
  • me-central2
  • me-central2-a
  • me-central2-b
  • me-central2-c
新加坡 新加坡所有位置:
in:sg-locations
群組:
  • asia-southeast1-locations

值:
  • sg
新加坡 新加坡所有位置:
in:asia-southeast1-locations
值:
  • asia-southeast1
  • asia-southeast1-a
  • asia-southeast1-b
  • asia-southeast1-c
台灣 臺灣所有位置:
in:tw-locations
群組:
  • asia-east1-locations

值:
  • tw
台灣 臺灣所有位置:
in:asia-east1-locations
值:
  • asia-east1
  • asia-east1-a
  • asia-east1-b
  • asia-east1-c
澳洲 澳洲境內所有地點:
in:australia-locations
群組:
  • australia-southeast1-locations
  • australia-southeast2-locations

值:
  • au
雪梨 雪梨所有位置:
in:australia-southeast1-locations
值:
  • australia-southeast1
  • australia-southeast1-a
  • australia-southeast1-b
  • australia-southeast1-c
墨爾本 墨爾本所有位置:
in:australia-southeast2-locations
值:
  • australia-southeast2
  • australia-southeast2-a
  • australia-southeast2-b
  • australia-southeast2-c
AWS 所有 AWS 位置:
in:aws-locations
值:
  • aws-ap-northeast-2
  • aws-ap-southeast-2
  • aws-eu-central-1
  • aws-us-east-1
Azure 所有 Azure 位置:
in:azure-locations
值:
  • azure-eastus2
  • azure-westus2
歐盟 歐盟境內所有地點:
in:eu-locations
群組:
  • de-locations
  • europe-central2-locations
  • europe-north1-locations
  • europe-north2-locations
  • europe-southwest1-locations
  • europe-west1-locations
  • europe-west4-locations
  • europe-west9-locations
  • it-locations

值:
  • EU
  • eu
  • eur3
  • eur4
  • eur8
  • europe-west
德國 德國境內所有地點:
in:de-locations
群組:
  • europe-west10-locations
  • europe-west3-locations

值:
  • de
柏林 柏林所有位置:
in:europe-west10-locations
值:
  • europe-west10
  • europe-west10-a
  • europe-west10-b
  • europe-west10-c
法蘭克福 法蘭克福所有位置:
in:europe-west3-locations
值:
  • europe-west3
  • europe-west3-a
  • europe-west3-b
  • europe-west3-c
華沙 華沙境內的所有地點:
in:europe-central2-locations
值:
  • europe-central2
  • europe-central2-a
  • europe-central2-b
  • europe-central2-c
芬蘭 芬蘭境內的所有地點:
in:europe-north1-locations
值:
  • europe-north1
  • europe-north1-a
  • europe-north1-b
  • europe-north1-c
斯德哥爾摩 斯德哥爾摩所有位置:
in:europe-north2-locations
值:
  • europe-north2
  • europe-north2-a
  • europe-north2-b
  • europe-north2-c
馬德里 馬德里所有位置:
in:europe-southwest1-locations
值:
  • europe-southwest1
  • europe-southwest1-a
  • europe-southwest1-b
  • europe-southwest1-c
比利時 比利時所有位置:
in:europe-west1-locations
值:
  • europe-west1
  • europe-west1-b
  • europe-west1-c
  • europe-west1-d
荷蘭 荷蘭境內所有地點:
in:europe-west4-locations
值:
  • europe-west4
  • europe-west4-a
  • europe-west4-b
  • europe-west4-c
巴黎 巴黎境內的所有地點:
in:europe-west9-locations
值:
  • europe-west9
  • europe-west9-a
  • europe-west9-b
  • europe-west9-c
義大利 義大利境內的所有地點:
in:it-locations
群組:
  • europe-west12-locations
  • europe-west8-locations

值:
  • it
杜林 杜林所有位置:
in:europe-west12-locations
值:
  • europe-west12
  • europe-west12-a
  • europe-west12-b
  • europe-west12-c
米蘭 米蘭境內的所有地點:
in:europe-west8-locations
值:
  • europe-west8
  • europe-west8-a
  • europe-west8-b
  • europe-west8-c
歐洲 歐洲所有位置:
in:europe-locations
群組:
  • ch-locations
  • de-locations
  • europe-central2-locations
  • europe-north1-locations
  • europe-north2-locations
  • europe-southwest1-locations
  • europe-west1-locations
  • europe-west4-locations
  • europe-west9-locations
  • gb-locations
  • it-locations

值:
  • EU
  • eu
  • eur3
  • eur4
  • eur5
  • eur7
  • eur8
  • europe
  • europe-west
瑞士 瑞士境內所有地點:
in:ch-locations
群組:
  • europe-west6-locations

值:
  • ch
蘇黎世 蘇黎世所有位置:
in:europe-west6-locations
值:
  • europe-west6
  • europe-west6-a
  • europe-west6-b
  • europe-west6-c
英國 英國境內所有地點:
in:gb-locations
群組:
  • europe-west2-locations

值:
  • gb
倫敦 倫敦所有位置:
in:europe-west2-locations
值:
  • europe-west2
  • europe-west2-a
  • europe-west2-b
  • europe-west2-c
低碳地點 所有碳影響較低的地點:
in:low-carbon-locations
群組:
  • canada-low-carbon-locations
  • eu-low-carbon-locations
  • europe-low-carbon-locations
  • northamerica-low-carbon-locations
  • southamerica-low-carbon-locations
  • us-low-carbon-locations
加拿大低碳 加拿大境內所有低碳影響的地點:
in:canada-low-carbon-locations
群組:
  • northamerica-northeast1-locations
  • northamerica-northeast2-locations
蒙特婁 蒙特婁所有位置:
in:northamerica-northeast1-locations
值:
  • northamerica-northeast1
  • northamerica-northeast1-a
  • northamerica-northeast1-b
  • northamerica-northeast1-c
多倫多 多倫多所有位置:
in:northamerica-northeast2-locations
值:
  • northamerica-northeast2
  • northamerica-northeast2-a
  • northamerica-northeast2-b
  • northamerica-northeast2-c
低碳歐盟 碳影響較低的歐盟境內所有位置:
in:eu-low-carbon-locations
群組:
  • europe-north1-locations
  • europe-southwest1-locations
  • europe-west1-locations
  • europe-west9-locations
歐洲低碳 碳影響較低的歐洲所有位置:
in:europe-low-carbon-locations
群組:
  • europe-north1-locations
  • europe-southwest1-locations
  • europe-west1-locations
  • europe-west6-locations
  • europe-west9-locations
北美洲低碳 北美洲所有低碳影響位置:
in:northamerica-low-carbon-locations
群組:
  • northamerica-northeast1-locations
  • northamerica-northeast2-locations
  • us-central1-locations
  • us-west1-locations
愛荷華州 愛荷華州所有位置:
in:us-central1-locations
值:
  • us-central1
  • us-central1-a
  • us-central1-b
  • us-central1-c
  • us-central1-f
奧勒岡州 奧勒岡州所有位置:
in:us-west1-locations
值:
  • us-west1
  • us-west1-a
  • us-west1-b
  • us-west1-c
低碳南美洲 碳影響較低的南美洲所有位置:
in:southamerica-low-carbon-locations
群組:
  • southamerica-east1-locations
聖保羅 聖保羅所有位置:
in:southamerica-east1-locations
值:
  • southamerica-east1
  • southamerica-east1-a
  • southamerica-east1-b
  • southamerica-east1-c
美國低碳 美國境內所有低碳影響位置:
in:us-low-carbon-locations
群組:
  • us-central1-locations
  • us-west1-locations
北美洲 北美洲所有位置:
in:northamerica-locations
群組:
  • canada-locations
  • northamerica-south1-locations
  • us-locations

值:
  • nam14
加拿大 加拿大境內的所有地點。
in:canada-locations
群組:
  • northamerica-northeast1-locations
  • northamerica-northeast2-locations

值:
  • ca
墨西哥 墨西哥境內所有地點:
in:northamerica-south1-locations
值:
  • northamerica-south1
  • northamerica-south1-a
  • northamerica-south1-b
  • northamerica-south1-c
美國 美國境內所有地點:
in:us-locations
群組:
  • us-central1-locations
  • us-central2-locations
  • us-east1-locations
  • us-east4-locations
  • us-east5-locations
  • us-south1-locations
  • us-west1-locations
  • us-west2-locations
  • us-west3-locations
  • us-west4-locations

值:
  • US
  • aws-us-east-1
  • azure-eastus2
  • nam10
  • nam11
  • nam12
  • nam13
  • nam15
  • nam3
  • nam4
  • nam5
  • nam6
  • nam7
  • nam8
  • nam9
  • us
  • us-central
奧克拉荷馬州 奧克拉荷馬州所有位置:
in:us-central2-locations
值:
  • us-central2
  • us-central2-a
  • us-central2-b
  • us-central2-c
  • us-central2-d
南卡羅來納州 南卡羅來納州所有區域:
in:us-east1-locations
值:
  • us-east1
  • us-east1-a
  • us-east1-b
  • us-east1-c
  • us-east1-d
北維吉尼亞州 北維吉尼亞州所有位置:
in:us-east4-locations
值:
  • us-east4
  • us-east4-a
  • us-east4-b
  • us-east4-c
哥倫布 哥倫布所有位置:
in:us-east5-locations
值:
  • us-east5
  • us-east5-a
  • us-east5-b
  • us-east5-c
達拉斯 達拉斯所有位置:
in:us-south1-locations
值:
  • us-south1
  • us-south1-a
  • us-south1-b
  • us-south1-c
洛杉磯 洛杉磯境內的所有地點:
in:us-west2-locations
值:
  • us-west2
  • us-west2-a
  • us-west2-b
  • us-west2-c
鹽湖城 鹽湖城的所有地點:
in:us-west3-locations
值:
  • us-west3
  • us-west3-a
  • us-west3-b
  • us-west3-c
拉斯維加斯 拉斯維加斯所有位置:
in:us-west4-locations
值:
  • us-west4
  • us-west4-a
  • us-west4-b
  • us-west4-c
南美洲 南美洲所有位置:
in:southamerica-locations
群組:
  • br-locations
  • cl-locations
巴西 巴西境內的所有地點:
in:br-locations
群組:
  • southamerica-east1-locations

值:
  • br
智利 智利境內所有地點:
in:cl-locations
群組:
  • southamerica-west1-locations

值:
  • cl
聖地牙哥 聖地牙哥所有位置:
in:southamerica-west1-locations
值:
  • southamerica-west1
  • southamerica-west1-a
  • southamerica-west1-b
  • southamerica-west1-c
泰國 泰國境內的所有地點:
in:th-locations
群組:
  • asia-southeast3-locations

值:
  • th
曼谷 曼谷境內的所有地點:
in:asia-southeast3-locations
值:
  • asia-southeast3
  • asia-southeast3-a
  • asia-southeast3-b
  • asia-southeast3-c

驗證

機構政策服務使用 OAuth 2.0 進行 API 身分驗證和授權。如要取得 OAuth 2.0 不記名憑證,請按照下列步驟操作:

  1. 前往 OAuth 2.0 Playground 頁面

  2. 在「Step 1」所列的範圍中,選取 [Cloud Resource Manager API v2] > [https://www.googleapis.com/auth/cloud-platform],然後點選 [Authorize APIs]

  3. 「Sign in with Google」(使用 Google 帳戶登入) 頁面上,選擇您的帳戶並登入。

  4. 如要提供 Google OAuth 2.0 Playground 的存取權,請在出現的提示中按一下「允許」

  5. 在「Step 2」,點選 [Exchange authorization code for tokens]

  6. 在右側「Request / Response」窗格的底部,會顯示您的存取憑證字串。

    {
      "access_token": "ACCESS_TOKEN",
      "token_type": "Bearer",
      "expires_in": 3600
    }
    

    其中「ACCESS_TOKEN」ACCESS_TOKEN是可用於 API 授權的 OAuth 2.0 不記名憑證字串。