遷移工作負載

本頁面說明如何先執行法規遵循分析,再將現有專案遷移至 Assured Workloads 資料夾。這項分析會比較來源專案和目的地 Assured Workloads 資料夾,判斷在啟動遷移作業前後可能需要進行哪些變更。舉例來說,如果您想將專案移至為 FedRAMP 中等風險設定的 Assured Workloads 資料夾,可以主動解決移動專案前可能發生的任何潛在法規遵循違規事項。

遷移分析會傳回下列類型的發現項目:

  • 來源專案使用不支援的產品或服務。
  • 來源專案包含位於不允許位置的資源。
  • 來源專案設定的組織政策限制值,與目的地 Assured Workloads 資料夾不相容。

在嘗試遷移之前,請務必先找出這些問題。根據預設,Assured Workloads 資料夾只能包含資料夾資料邊界支援服務的資源類型。如果專案包含的資源屬於資料邊界不支援的服務,您可能需要重新部署或移除這些資源。

雖然您可以變更 Assured Workloads 資料夾的資源使用限制組織政策,藉此變更預設的支援服務清單,允許在資料夾中部署不符合規定的服務,但背景法規遵循檢查會忽略不符合規定的服務及其資源。因此,如果啟用不支援的服務,就必須承擔工作負載可能不符合法規遵循規定的風險。

遷移 Assured Workloads 資料夾和專案

如要遷移 Assured Workloads 資料夾或專案,請務必遷移至使用相同資料邊界的資料夾。否則,您可能會產生額外的帳單費用,並影響法規遵循狀態。

事前準備

  • 收集來源專案和目的地 Assured Workloads 資料夾的資源 ID。
  • 在來源專案和目的地 Assured Workloads 資料夾中,指派或驗證 IAM 權限,確保呼叫端有權執行遷移作業。

必要的 IAM 權限

如要執行遷移分析,呼叫端必須透過包含更廣泛權限集的預先定義角色,或僅限必要最低權限的自訂角色,取得 IAM 權限。

必須具備下列權限:

  • 目的地 工作負載上的 assuredworkloads.workload.get
  • 來源專案的 cloudasset.assets.searchAllResources
  • 來源專案和目的地 Assured Workloads 資料夾的 orgpolicy.policy.get

執行遷移分析

對來源專案和目的地 Assured Workloads 資料夾執行分析時,請先解決所有發現項目,再將專案移至目的地。雖然這些發現項目不會阻止您移動專案,但可能會導致目的地 Assured Workloads 資料夾違反法規。

這些發現項目分為兩種類型:

  • 警告:如果來源專案可能與目的地不相容,且可能導致違反法規遵循,就會出現警告結果。請務必調查警告,確認不相容問題是否可接受,或應在遷移前解決。
  • 封鎖:如果系統偵測到來源專案和目的地之間有違反法規遵循的情況,就會顯示封鎖結果。必須先解決阻礙,才能繼續遷移。

系統會回報下列類型的發現項目:

  • 資源位置:許多資料邊界會強制執行資源位置限制,以遵守法規遵循要求,例如來源專案包含位於不允許位置的資源。

    如要解決這個問題,請將受影響的資源移至允許的位置、刪除這些資源,或修改目標的 gcp.resourceLocations 組織政策限制設定。

  • 不支援的產品/服務:每個資料邊界都支援特定的 Google Cloud 產品和服務清單。如果專案使用的服務不受目標 Assured Workloads 資料夾的資料邊界支援,系統會將其列為發現項目。

  • 組織政策限制:來源專案設定的組織政策限制值,可能與目的地 Assured Workloads 資料夾的有效政策不同,或不符合目標資料邊界。這項分析只會針對與目的地 Assured Workloads 資料夾資料邊界相關的限制執行,不會評估專案的所有限制值。可能會有幾種結果,例如下列問題:

    • 您的專案與目的地的有效政策不相容。
    • 專案的組織政策限制值未在目的地設定,反之亦然。
    • 專案的組織政策限制值不符合目標資料邊界。

    如果發現組織政策限制的阻礙因素,回應會包含符合目標控制套件的預期值。您可以在執行遷移作業前,根據這些預期值變更專案。

如要解決這個問題,請判斷需要修改哪項組織政策限制,並進行必要變更。

不支援的發現項目類型

遷移分析不支援下列類型的發現項目:

  • gcp.resourceLocations 以外的組織政策限制,在資源層級不相容。舉例來說,部分資料邊界是使用全域 gcp.restrictCmekCryptoKeyProjects 限制或 Compute Engine 專屬 compute.disableNestedVirtualization 限制設定,系統不會分析或回報來源和目的地之間與這些限制不相容的情況。
  • 特定資料邊界可能停用的服務專屬功能。舉例來說,IL4 資料夾會停用 Cloud Monitoring 的運作時間檢查,ITAR 資料夾則會停用 BigQuery 的遠端函式。如果來源專案使用這類停用的功能,系統不會分析或回報這些不相容問題。

分析將專案移至 Assured Workloads 資料夾

analyzeWorkloadMove 方法會分析將來源專案移至目的地 Assured Workloads 資料夾的作業。

在下列要求範例中,請將下列參數替換為您自己的參數:

  • ENDPOINT_URI:Assured Workloads 服務端點 URI。這個 URI 必須是與目的地工作負載位置相符的端點,例如 us-west1 區域中的區域化工作負載為 https://us-west1-assuredworkloads.googleapis.com,美國的多區域工作負載則為 https://us-assuredworkloads.googleapis.com。
  • DESTINATION_ORGANIZATION_ID:來源專案要遷移至的目的地工作負載組織 ID。例如:919698201234
  • DESTINATION_LOCATION_ID:目的地工作負載的位置。例如:us-west1 或 us。這會對應到工作負載的 data region 值。
  • DESTINATION_WORKLOAD_ID:來源專案要遷移至的目的地 Assured Workloads 資料夾 ID。例如:00-701ea036-7152-4780-a867-9f5
  • SOURCE_PROJECT_ID:要遷移的來源專案 ID 查詢參數。例如:my-project-123
  • ASSET_TYPES:選用。每個查詢參數一個資產類型,只篩選出指定類型的發現項目。例如:cloudresourcemanager.googleapis.com/Project
  • PAGE_SIZE:選用。查詢參數,用於指定每頁傳回的結果數量,最多 50 個。例如:5
  • PAGE_TOKEN:選用。權杖的查詢參數,用於繼續分頁結果。例如:CiAKGjBpNDd2Nmp2Zml2cXRwYjBpOXA

HTTP 方法、網址和查詢參數:

GET https://[ENDPOINT_URI]/v1/organizations/[DESTINATION_ORGANIZATION_ID]/locations/[DESTINATION_LOCATION_ID]/workloads/[DESTINATION_WORKLOAD_ID]:analyzeWorkloadMove?project=projects/SOURCE_PROJECT_ID&page_size=PAGE_SIZE&page_token=PAGE_TOKEN

例如:

GET https://us-west1-assuredworkloads.googleapis.com/v1/organizations/919698298765/locations/us-west1/workloads/00-701ea036-7152-4781-a867-9f5:analyzeWorkloadMove?project=projects/my-project-123&page_size=5&page_token=CiAKGjBpNDd2Nmp2Zml2cXRwYjBpOXA

您應該會收到如下的 JSON 回覆:

{
  "assetMoveAnalyses": [
    {
      "asset": "//orgpolicy.googleapis.com/projects/130536381852/policies/container.restrictNoncompliantDiagnosticDataAccess",
      "assetType": "orgpolicy.googleapis.com/Policy"
    },
    {
      "asset": "//compute.googleapis.com/projects/my-project-123/global/routes/default-route-9ca6e6b0ab7326f0",
      "assetType": "compute.googleapis.com/Route",
      "analysisGroups": [
        {
          "displayName": "RESOURCE_LOCATIONS",
          "analysisResult": {
            "warnings": [
              {
                "detail": "The asset's location 'global' is incompatible with the gcp.resourceLocations org policy effective at the target. In case of 'global only' assets, this may be ignored."
              }
            ]
          }
        }
      ]
    },
    {
      "asset": "//compute.googleapis.com/projects/my-project-123/regions/europe-west10/subnetworks/default",
      "assetType": "compute.googleapis.com/Subnetwork",
      "analysisGroups": [
        {
          "displayName": "RESOURCE_LOCATIONS",
          "analysisResult": {
            "blockers": [
              {
                "detail": "The asset's location 'europe-west10' is incompatible with the gcp.resourceLocations org policy effective at the target."
              }
            ]
          }
        }
      ]
    },
    {
      "asset": "//serviceusage.googleapis.com/projects/130536381852/services/servicemanagement.googleapis.com",
      "assetType": "serviceusage.googleapis.com/Service"
    },
    {
      "asset": "//serviceusage.googleapis.com/projects/130536381852/services/monitoring.googleapis.com",
      "assetType": "serviceusage.googleapis.com/Service"
    },
    {
      "asset": "//serviceusage.googleapis.com/projects/130536381852/services/bigquerymigration.googleapis.com",
      "assetType": "serviceusage.googleapis.com/Service",
      "analysisGroups": [
        {
          "displayName": "DISALLOWED_SERVICES",
          "analysisResult": {
            "warnings": [
              {
                "detail": "This service is not allowed by the gcp.restrictServiceUsage org policy effective at the target"
              }
            ]
          }
        }
      ]
    },
    {
      "asset": "//cloudresourcemanager.googleapis.com/projects/my-project-123",
      "assetType": "cloudresourcemanager.googleapis.com/Project",
      "analysisGroups": [
        {
          "displayName": "ORG_POLICIES",
          "analysisResult": {
            "warnings": [
              {
                "detail": "constraints/gcp.resourceLocations: Target applies/inherits this custom policy and it is not applied by the source. Upon moving, this policy will get inherited from the target."
              },
              {
                "detail": "constraints/compute.disableInstanceDataAccessApis: Source applies this custom policy and it is not applied by the target."
              },
              {
                "detail": "constraints/cloudkms.allowedProtectionLevels: Source and target set different values for this policy."
              },
              {
                "detail": "constraints/container.restrictNoncompliantDiagnosticDataAccess: Source and target set different values for this policy."
              },
              {
                "detail": "constraints/gcp.restrictServiceUsage: Target applies/inherits this custom policy and it is not applied by the source. Upon moving, this policy will get inherited from the target."
              }
            ],
            "blockers": [
              {
                "detail": "constraints/gcp.resourceLocations: The value applied at the source is not compliant with the target compliance program. The expected allowed values are [us-west4, us-west1, us-west2, us-west3, us-central1, us-east1, us-east4, us-south1, us-central2, us-east5]."
              },
              {
                "detail": "constraints/container.restrictNoncompliantDiagnosticDataAccess: The value applied at the source is not compliant with the target compliance program. The expected value is [true]."
              },
              {
                "detail": "constraints/container.restrictTLSVersion: The value applied at the source is not compliant with the target compliance program. The expected denied values are [TLS_VERSION_1, TLS_VERSION_1_1]."
              }
            ]
          }
        }
      ]
    }
  ],
  "nextPageToken": "Ch8wLDc0MzY3NTExNCwzMzg4ODM1NTM2NDQ0NTg4MDMy"
}

如要依特定資產類型篩選發現項目,請使用 asset_types 查詢參數:

GET https://assuredworkloads.googleapis.com/v1/organizations/919698298765/locations/us-west1/workloads/00-701ea036-7152-4781-a867-9f5:analyzeWorkloadMove?project=projects/my-project-123&asset_types=cloudresourcemanager.googleapis.com/Project&page_size=5&page_token=CiAKGjBpNDd2Nmp2Zml2cXRwYjBpOXA

結果只會包含指定類型 (cloudresourcemanager.googleapis.com/Project) 的發現項目:

{
  "assetMoveAnalyses": [
    {
      "asset": "//cloudresourcemanager.googleapis.com/projects/my-project-123",
      "assetType": "cloudresourcemanager.googleapis.com/Project",
      "analysisGroups": [
        {
          "displayName": "ORG_POLICIES",
          "analysisResult": {
            "warnings": [
              {
                "detail": "constraints/gcp.resourceLocations: Target applies/inherits this custom policy and it is not applied by the source. Upon moving, this policy will get inherited from the target."
              },
              {
                "detail": "constraints/compute.disableInstanceDataAccessApis: Source applies this custom policy and it is not applied by the target."
              }
            ],
            "blockers": [
              {
                "detail": "constraints/gcp.resourceLocations: The value applied at the source is not compliant with the target compliance program. The expected allowed values are [us-west4, us-west1, us-west2, us-west3, us-central1, us-east1, us-east4, us-south1, us-central2, us-east5]."
              }
            ]
          }
        }
      ]
    }
  ],
  "nextPageToken": "Ch8wLDc0MzY3NTExNCwzMzg4ODM1NTM2NDQ0NTg4MDMy"
}

如要依多個資產類型篩選發現項目,請將每個資產類型新增為額外的查詢參數:

GET https://assuredworkloads.googleapis.com/v1/organizations/919698298765/locations/us-west1/workloads/00-701ea036-7152-4781-a867-9f5:analyzeWorkloadMove?project=projects/my-project-123&asset_types=cloudresourcemanager.googleapis.com/Project&asset_types=serviceusage.googleapis.com/Service&page_size=5&page_token=CiAKGjBpNDd2Nmp2Zml2cXRwYjBpOXA

結果只會包含指定類型的發現項目 (cloudresourcemanager.googleapis.com/Project 和 serviceusage.googleapis.com/Service):

{
  "assetMoveAnalyses": [
    {
      "asset": "//serviceusage.googleapis.com/projects/130536381852/services/bigquerymigration.googleapis.com",
      "assetType": "serviceusage.googleapis.com/Service",
      "analysisGroups": [
        {
          "displayName": "DISALLOWED_SERVICES",
          "analysisResult": {
            "warnings": [
              {
                "detail": "This service is not allowed by the gcp.restrictServiceUsage org policy effective at the target"
              }
            ]
          }
        }
      ]
    },
    {
      "asset": "//cloudresourcemanager.googleapis.com/projects/my-project-123",
      "assetType": "cloudresourcemanager.googleapis.com/Project",
      "analysisGroups": [
        {
          "displayName": "ORG_POLICIES",
          "analysisResult": {
            "warnings": [
              {
                "detail": "constraints/gcp.resourceLocations: Target applies/inherits this custom policy and it is not applied by the source. Upon moving, this policy will get inherited from the target."
              },
              {
                "detail": "constraints/compute.disableInstanceDataAccessApis: Source applies this custom policy and it is not applied by the target."
              }
            ],
            "blockers": [
              {
                "detail": "constraints/gcp.resourceLocations: The value applied at the source is not compliant with the target compliance program. The expected allowed values are [us-west4, us-west1, us-west2, us-west3, us-central1, us-east1, us-east4, us-south1, us-central2, us-east5]."
              }
            ]
          }
        }
      ]
    }
  ],
  "nextPageToken": "Ch8wLDc0MzY3NTExNCwzMzg4ODM1NTM2NDQ0NTg4MDMy"
}

執行遷移分析後,請查看並解決所有警告或阻礙,然後再次執行分析,確認問題已解決。接著,您可以繼續移動專案。

後續步驟