您可以使用 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
-
安裝 Google Cloud CLI。 安裝完成後,執行下列指令初始化 Google Cloud CLI:
gcloud init如果您使用外部識別資訊提供者 (IdP),請先 使用聯合身分登入 gcloud CLI。
- Set a default region and zone.
REST
如要在本機開發環境中使用本頁的 REST API 範例,請使用您提供給 gcloud CLI 的憑證。
安裝 Google Cloud CLI。 安裝完成後,執行下列指令初始化 Google Cloud CLI:
gcloud init如果您使用外部識別資訊提供者 (IdP),請先 使用聯合身分登入 gcloud CLI。
詳情請參閱 Google Cloud 驗證說明文件中的「Authenticate for using REST」。
必要的角色
如要取得建立執行個體所需的權限,請要求管理員授予您專案的 Compute 執行個體管理員 (v1) (
roles/compute.instanceAdmin.v1) IAM 角色。如要進一步瞭解如何授予角色,請參閱「管理專案、資料夾和機構的存取權」。限制
您只能使用 Google Cloud 控制台,建立經過 Google 設定且適合工作負載的執行個體。
建立 Google 設定的執行個體,並針對工作負載進行最佳化
使用 Google Cloud 控制台建立執行個體時,您可以選取工作負載類型,建立經過工作負載最佳化的執行個體。Google 接著會使用針對該工作負載類型最佳化的預設設定。在完成執行個體建立作業前,您可以進一步自訂執行個體設定。您也可以視需要使用所選值覆寫任何預設的執行個體屬性。
如要建立經過 Google 設定且針對工作負載最佳化的執行個體,請按照下列步驟操作:
前往 Google Cloud 控制台的「建立執行個體」頁面。
如果出現提示,請選取專案並按一下「繼續」。「建立執行個體」頁面隨即顯示,並顯示「機器設定」窗格。
按一下 「從...建立 VM」。
在隨即顯示的清單中,選取預設設定,如下所示:
如果「預設集」部分的工作負載類型符合您的用途,請選取該工作負載類型的預設設定。系統會顯示該預設設定的視窗。
如要從可用預設設定的完整清單中選取,請按一下「查看所有預設設定...」。接著,在隨即顯示的「預設 VM」頁面上,選取適合您用途的工作負載類型預設設定。系統會顯示該預設設定的視窗。
(選用步驟) 如要進一步自訂執行個體設定或覆寫任何預設屬性,請執行下列其中一項操作:
如果您位於「建立執行個體」頁面,請按一下「套用預設值」,然後自訂執行個體設定。
如果您位於「預設 VM」頁面,請按一下「自訂」,然後自訂執行個體設定。
詳情請參閱「建立及啟動執行個體」。
如要完成建立執行個體,請按一下「Create」(建立)或「Create now」(立即建立)。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-09-04 (世界標準時間)。
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["難以理解","hardToUnderstand","thumb-down"],["資訊或程式碼範例有誤","incorrectInformationOrSampleCode","thumb-down"],["缺少我需要的資訊/範例","missingTheInformationSamplesINeed","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-09-04 (世界標準時間)。"],[[["\u003cp\u003eGoogle Cloud Console offers pre-configured instances optimized for specific workloads, eliminating the need for manual configuration.\u003c/p\u003e\n"],["\u003cp\u003eWorkload-optimized instance types include options like low cost, web server, application server, in-memory database, OpenShift mode, Windows, and SQL server.\u003c/p\u003e\n"],["\u003cp\u003eTo create a workload-optimized instance, users must select a preset configuration within the Google Cloud Console, which then automatically applies settings suited for that workload.\u003c/p\u003e\n"],["\u003cp\u003eUsers can customize preset configurations further or override them with their preferred settings after selecting a preset for their workload type.\u003c/p\u003e\n"],["\u003cp\u003eTo get the needed permissions to create these instances, users need to ask their administrator to grant them the Compute Instance Admin (v1) role on the project.\u003c/p\u003e\n"]]],[],null,["# Create a Google-configured instance optimized for your workload\n\n*** ** * ** ***\n\nYou can use the Google Cloud console to get a Google-configured instance that is optimized for your specific workload. This method of instance creation removes the need for you to manually configure all of your instance properties. Google provides predefined, workload-optimized instance configurations for the following workloads:\n\n\u003cbr /\u003e\n\nBefore you begin\n----------------\n\n- If you haven't already, set up [authentication](/compute/docs/authentication). Authentication verifies your identity for access to Google Cloud services and APIs. To run code or samples from a local development environment, you can authenticate to Compute Engine by selecting one of the following options:\n\n Select the tab for how you plan to use the samples on this page: \n\n ### Console\n\n\n When you use the Google Cloud console to access Google Cloud services and\n APIs, you don't need to set up authentication.\n\n ### gcloud\n\n 1.\n [Install](/sdk/docs/install) the Google Cloud CLI.\n\n After installation,\n [initialize](/sdk/docs/initializing) the Google Cloud CLI by running the following command:\n\n ```bash\n gcloud init\n ```\n\n\n If you're using an external identity provider (IdP), you must first\n [sign in to the gcloud CLI with your federated identity](/iam/docs/workforce-log-in-gcloud).\n | **Note:** If you installed the gcloud CLI previously, make sure you have the latest version by running `gcloud components update`.\n 2. [Set a default region and zone](/compute/docs/gcloud-compute#set_default_zone_and_region_in_your_local_client).\n\n ### REST\n\n\n To use the REST API samples on this page in a local development environment, you use the\n credentials you provide to the gcloud CLI.\n 1. [Install](/sdk/docs/install) the Google Cloud CLI. After installation, [initialize](/sdk/docs/initializing) the Google Cloud CLI by running the following command: \n\n ```bash\n gcloud init\n ```\n 2. If you're using an external identity provider (IdP), you must first [sign in to the gcloud CLI with your federated identity](/iam/docs/workforce-log-in-gcloud).\n\n\n For more information, see\n [Authenticate for using REST](/docs/authentication/rest)\n in the Google Cloud authentication documentation.\n\n### Required roles\n\n\nTo get the permissions that\nyou need to create instances,\n\nask your administrator to grant you the\n\n\n[Compute Instance Admin (v1)](/iam/docs/roles-permissions/compute#compute.instanceAdmin.v1) (`roles/compute.instanceAdmin.v1`)\nIAM role on the project.\n\n\nFor more information about granting roles, see [Manage access to projects, folders, and organizations](/iam/docs/granting-changing-revoking-access).\n\n\nYou might also be able to get\nthe required permissions through [custom\nroles](/iam/docs/creating-custom-roles) or other [predefined\nroles](/iam/docs/roles-overview#predefined).\n\nLimitations\n-----------\n\nYou can create Google-configured instances that are optimized for your workloads\nonly by using the Google Cloud console.\n\nCreate a Google-configured instance optimized for your workload\n---------------------------------------------------------------\n\nWhen you're creating an instance by using the Google Cloud console, you can choose\nto create a workload-optimized instance by selecting your workload type.\nGoogle then uses a preset configuration that is optimized for that workload\ntype. You can further customize your instance configuration before you finish\ncreating the instance. If you wish to, you can also override any of these\npreset instance properties with values of your choice.\n\nTo create a Google-configured instance that is optimized for your workload,\nfollow these steps:\n\n1. In the Google Cloud console, go to the **Create an instance** page.\n\n [Go to Create an instance](https://console.cloud.google.com/compute/instancesAdd)\n\n If prompted, select your project and click **Continue** . The\n **Create an instance** page appears and displays the\n **Machine configuration** pane.\n2. Click auto_awesome\n **Create VM from...**.\n\n3. In the list that appears, select a preset configuration as follows:\n\n - If one of the workload types in the **Presets** section suits your use\n case, select the preset configuration for that workload type. A window\n appears for that preset configuration.\n\n - Otherwise, to select from the full list of available preset\n configurations, click **See all presets...** . Then, on the **Preset VMs**\n page that appears, select the preset configuration for the workload type\n that suits your use case. A window appears for that preset configuration.\n\n4. Optional. To further customize your instance configuration or override\n any of the preset properties, do one of the following:\n\n - If you are on the **Create an instance** page, click **Apply preset** and\n then customize the instance configuration.\n\n - If you are on the **Preset VMs** page, click **Customize** and then\n customize the instance configuration.\n\n For more information, see\n [Create and start an instance](/compute/docs/instances/create-start-instance).\n\n \u003cbr /\u003e\n\n5. To finish creating your instance, click **Create** or **Create now**."]] -