您可以使用 Google Cloud 主控台取得 Google 設定的執行個體,以便針對您的特定工作負載進行最佳化。使用這個建立執行個體的方法,您就不必手動設定所有執行個體屬性。Google 針對下列工作負載提供預先定義的最佳化工作負載執行個體設定:
工作負載類型 | 最適合用於 |
---|---|
成本低廉 | 將這個執行個體用於非正式工作負載 |
網路伺服器 | 使用這個例項來代管基本網站 |
應用程式伺服器 | 使用這個例項執行應用程式 |
記憶體內資料庫 | 使用這個執行個體做為資料庫或執行分析 |
OpenShift 模式 | 使用這個執行個體執行 OpenShift 叢集節點 |
Windows | 將這個執行個體用作 Windows 伺服器執行個體 |
SQL Server | 將這個執行個體用作 SQL Server 執行個體 |
事前準備
-
如果尚未設定,請先設定驗證機制。驗證是指驗證身分,以便存取 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.
-
必要的角色
如要取得建立執行個體所需的權限,請要求管理員為您授予專案的 Compute Instance Admin (v1) (roles/compute.instanceAdmin.v1
) IAM 角色。如要進一步瞭解如何授予角色,請參閱「管理專案、資料夾和機構的存取權」。
限制
您只能使用 Google Cloud 控制台,建立 Google 設定的執行個體,以便針對工作負載進行最佳化。
建立由 Google 設定的最佳化工作負載執行個體
使用 Google Cloud 主控台建立執行個體時,您可以選取工作負載類型,建立工作負載最佳化執行個體。接著,Google 會使用針對該工作負載類型最佳化的預設設定。您可以在完成建立執行個體前進一步自訂執行個體設定。如有需要,您也可以使用自選值覆寫任何預設例項屬性。
如要建立 Google 設定的執行個體,以便針對工作負載進行最佳化,請按照下列步驟操作:
前往 Google Cloud 控制台的「Create an instance」(建立執行個體) 頁面。
前往「Create an instance」(建立執行個體)
如果出現系統提示,請選取您的專案,然後按一下「Continue」。系統隨即會顯示「Create an instance」(建立執行個體) 頁面,並顯示「Machine configuration」(機器設定) 窗格。
按一下
「VM 建立位置...」。在隨即顯示的清單中,選取預設設定,如下所示:
如果「預設值」部分的工作負載類型符合您的用途,請為該工作負載類型選取預設設定。系統會顯示該預設設定的視窗。
如要從可用預設設定的完整清單中選取,請按一下「查看所有預設設定...」。接著,在隨即顯示的「預設 VM」頁面中,為工作負載類型選取合適用途的預設設定。系統會顯示該預設設定的視窗。
選用設定。如要進一步自訂執行個體設定或覆寫任何預設屬性,請執行下列任一操作:
如果您位於「Create an instance」頁面,請按一下「Apply preset」,然後自訂執行個體設定。
如果您目前位於「Preset VMs」(預設 VM) 頁面,請按一下「Customize」(自訂),然後自訂執行個體設定。
詳情請參閱「建立及啟動執行個體」。
如要完成建立執行個體,請按一下「Create」或「Create now」。