Compute Engine 可讓您在 Google 基礎架構上建立及執行執行個體。本文將概略說明在建立 Compute Engine 執行個體時,可用的各種設定參數。如果您是第一次建立執行個體,請參閱本文件,瞭解相關程序。
「Compute Engine 執行個體」、「運算執行個體」或「執行個體」是同義詞。根據您指定的機器類型,執行個體可以是裸機執行個體或虛擬機器 (VM) 執行個體,如下所示:
- 如果機器類型名稱結尾為
-metal
,則執行個體為裸機執行個體,未安裝虛擬機器管理程式。 - 否則,執行個體就是 VM 執行個體。「虛擬機器執行個體」、「VM 執行個體」和「VM」是同義詞。
在說明文件和 Google Cloud 介面 (例如 Google Cloud 主控台、gcloud 指令列工具和 REST API) 中,同義詞會互相替換使用。
事前準備
- 查看 Compute Engine 執行個體的基本資訊。
-
如果尚未設定,請先設定驗證機制。驗證是指驗證身分,以便存取 Google Cloud 服務和 API 的程序。如要在本機開發環境中執行程式碼或範例,您可以選取下列任一選項,向 Compute Engine 進行驗證:
Select the tab for how you plan to use the samples on this page:
Console
When you use the Google Cloud console to access Google Cloud services and APIs, you don't need to set up authentication.
gcloud
-
After installing the Google Cloud CLI, initialize it by running the following command:
gcloud init
If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
- Set a default region and zone.
REST
To use the REST API samples on this page in a local development environment, you use the credentials you provide to the gcloud CLI.
After installing the Google Cloud CLI, initialize it by running the following command:
gcloud init
If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
For more information, see Authenticate for using REST in the Google Cloud authentication documentation.
-
建立及設定執行個體的方式
您可以透過多種方式建立例項,每種方式都有各自的設定方法,如下所示:
手動指定自訂設定,建立執行個體。如果您要從頭建立執行個體,且遇到下列任一情況,請選擇這個選項:
- 您知道工作負載所需的具體設定。
- 您想建立具有複雜設定的執行個體。
- 您想使用 Google Cloud CLI 或 REST 建立執行個體。
如果您選擇這個方法,請一併查看建立執行個體時可用的所有設定選項清單。
建立工作負載最佳化執行個體。使用這種方法時,您可以在建立執行個體時選取工作負載類型,Google 會自動填入適合工作負載的預設設定。如果您是 Compute Engine 新手,且不確定哪種設定最適合您的預期工作負載,請選擇這個選項。這個選項僅適用於 Google Cloud 控制台。
使用執行個體範本建立執行個體。執行個體範本是一種資源,可定義執行個體的設定。如果您已定義設定範本,並想要建立許多具有相同設定的 VM,請選擇這個選項。
建立執行個體,方法是複製機器映像檔。機器映像檔包含複製執行個體所需的大部分資訊和資料。如果您想複製現有的來源執行個體,請選擇這個選項。
建立運算執行個體後,Compute Engine 會自動啟動該執行個體。
建立執行個體時可用的設定選項
建立 Compute Engine 執行個體時,您可以指定要為執行個體設定的設定。Compute Engine 會使用這項設定建立執行個體。下表列出您在建立 Compute Engine 執行個體時設定的各種參數:
參數 | 可設定的項目 |
---|---|
機器設定 |
|
作業系統 (OS) 和儲存空間 |
|
資料保護 |
|
網路 |
|
觀測能力 |
|
安全性 |
|
進階設定 |
|
後續步驟
- 瞭解如何建立及啟動 Compute Engine 執行個體。
如果您是第一次建立執行個體,請嘗試下列其中一個教學課程,瞭解基本設定: