遷移工作負載
本頁面說明如何在將現有專案遷移至 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 資料夾控制套件的限制進行,不會評估所有專案的限制值。可能會發生以下幾種情況:
- 您的專案和目的地的有效政策不相容。
- 您的專案有未在目的地設定的機構政策限制值,或反之。
- 您的專案有與目標控制項套件不相容的機構政策限制值。
如果系統偵測到機構政策限制的封鎖項目,回應就會包含與目標控制項套件相符的預期值。您可以在執行遷移作業前,使用這些預期值來變更專案。
如要解決這個問題,請判斷需要修改哪些機構政策限制,然後進行必要變更。
不支援的檢測結果類型
遷移分析不支援下列類型的檢測結果:
- 除了
gcp.resourceLocations
以外,機構政策限制的資源層級不相容。舉例來說,部分控制項套件會使用全域gcp.restrictCmekCryptoKeyProjects
限制或 Compute Engine 專屬的compute.disableNestedVirtualization
限制進行設定,因此系統不會分析或回報來源和目的地之間的這些限制不相容情形。 - 可為特定控制項套件停用的服務專屬功能。舉例來說,Cloud Monitoring 的正常運作時間檢查已停用 IL4 資料夾,而 BigQuery 的遠端函式已停用 ITAR 資料夾;如果來源專案使用這類已停用的功能,系統就不會分析或回報這些不相容性。
分析將專案移至 Assured Workloads 資料夾
analyzeWorkloadMove
方法會執行分析,將來源專案移至目的地 Assured Workloads 資料夾。
在下列要求範例中,請將下列參數替換為您的參數:
- ENDPOINT_URI:Assured Workloads 服務端點 URI。此 URI 必須是與目的地工作負載位置相符的端點,例如
https://us-west1-assuredworkloads.googleapis.com
(us-west1
區域內的地區性工作負載) 和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" }
執行遷移分析後,請檢查並解決所有警告或阻斷項目,然後再次執行分析,確認已解決這些問題。接著,您可以繼續移動專案。