您必須先在 Google Cloud 上啟用 Migrate to Virtual Machines 服務,並啟用 Migrate to Virtual Machines 所需的所有其他 Google Cloud服務,才能開始遷移作業。
找出主專案
Google Cloud 專案是建立、啟用及使用 Google Cloud 服務的基本要件,包括管理 API、啟用計費功能、新增及移除協作者,以及管理 Google Cloud 資源的權限。
Migrate to Virtual Machines 會使用下列類型的專案:
主專案 (必要)
使用主機專案控管遷移程序,並視需要託管執行已遷移工作負載的 Compute Engine 執行個體。您必須按照下列各節的說明來建立及設定主機專案。
目標專案 (選用)
目標專案會定義執行已遷移 VM 的 Compute Engine 執行個體的目標專案。主機專案可用做為目標專案。如果您想將 VM 遷移至其他專案,請將這些專案新增為「遷移至虛擬機器」的目標專案。詳情請參閱「新增目標專案」。
如要啟用「Migrate to Virtual Machines」服務,您必須指出要用來做為主機專案的Google Cloud 專案:
在 Google Cloud 控制台的專案選擇器頁面中,選取或建立要用做主機專案的Google Cloud 專案:
記下所選專案的名稱和 ID。
安裝 gcloud CLI
在工作站上安裝 gcloud CLI,這也會安裝 Google Cloud CLI。gcloud
是用來建立及管理 Google Cloud 資源的主要 CLI 工具。您可以使用 gcloud
從指令列或指令碼和其他自動化機制中,執行許多常見的平台工作。
如要安裝 gcloud CLI,請按照下列步驟操作:
安裝並初始化 gcloud CLI。
更新 gcloud CLI:
gcloud components update
確認 gcloud CLI 已獲授權,可存取您的資料和服務:
gcloud auth login
系統將開啟新的瀏覽器分頁,並提示您選擇一個帳戶。
在主機專案中啟用必要服務
在主專案中,啟用 Migrate to Virtual Machines 服務所需的 Google Cloud 服務。如要進一步瞭解這些服務,請參閱 gcloud 服務。
Migrate to Virtual Machines 的主機專案需要啟用下列 Google Cloud 服務:
名稱 | 標題 |
---|---|
vmmigration.googleapis.com
|
Migrate to Virtual Machines API |
servicemanagement.googleapis.com
|
Service Management API |
servicecontrol.googleapis.com
|
Service Control API |
iam.googleapis.com
|
Identity and Access Management (IAM) API |
cloudresourcemanager.googleapis.com
|
Cloud Resource Manager API |
compute.googleapis.com
|
Compute Engine API |
如要啟用必要服務,請按照下列步驟操作:
請確認您已將預設專案設為主專案。請將 PROJECT_ID 替換為主機專案的專案 ID:
gcloud config set project PROJECT_ID
查看專案中已啟用的服務清單:
gcloud services list
如果必要的服務並未列出,請執行下列指令加以啟用:
gcloud services enable vmmigration.googleapis.com servicemanagement.googleapis.com servicecontrol.googleapis.com iam.googleapis.com cloudresourcemanager.googleapis.com compute.googleapis.com
您現在應該可以在Google Cloud 控制台中開啟「Migrate to Virtual Machines」(遷移至虛擬機器) 頁面:
使用預先定義的角色
身分與存取權管理功能包含兩個預先定義的角色,可用於控管機構內使用者的存取權:
角色 | 名稱 | 說明 |
---|---|---|
roles/vmmigration.admin | VM Migration 管理員 | 允許使用者建立新的 Migrate to Virtual Machines 來源,並執行所有其他遷移作業。 |
roles/vmmigration.viewer | VM Migration 檢視器 | 允許使用者在 Google Cloud 控制台中擷取 Migrate to Virtual Machines 相關資訊。適用於執行遷移作業,但未設定系統或新增遷移來源的使用者。 |
舉例來說,如果您想讓機構中的使用者能夠查看遷移作業相關資訊,但無法執行遷移作業,請指派 roles/vmmigration.viewer
角色給他們。