Sign in to your Google Cloud account. If you're new to Google Cloud, create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
Make sure that you have the following role or roles on the project: Compute Instance Admin (v1), Compute Security Admin, OSPolicyAssignment Admin, Service Account User, Service Usage Admin
In the Principal column, find all rows that identify you or a group that you're included in. To learn which groups you're included in, contact your administrator.
For all rows that specify or include you, check the Role column to see whether the list of roles includes the required roles.
Make sure that you have the following role or roles on the project: Compute Instance Admin (v1), Compute Security Admin, OSPolicyAssignment Admin, Service Account User, Service Usage Admin
In the Principal column, find all rows that identify you or a group that you're included in. To learn which groups you're included in, contact your administrator.
For all rows that specify or include you, check the Role column to see whether the list of roles includes the required roles.
[[["容易理解","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-08-19 (世界標準時間)。"],[[["\u003cp\u003eThis guide demonstrates how to create a Linux virtual machine (VM) instance in Google Compute Engine using the Google Cloud console.\u003c/p\u003e\n"],["\u003cp\u003eUsers can configure the VM's boot disk, select an operating system (e.g., Ubuntu 20.04 LTS), and enable HTTP traffic for the instance.\u003c/p\u003e\n"],["\u003cp\u003eAfter creating the VM, you can connect to it via SSH directly from the Google Cloud console and begin using it.\u003c/p\u003e\n"],["\u003cp\u003eThe tutorial outlines steps for cleaning up resources by deleting the VM instance to avoid incurring charges.\u003c/p\u003e\n"],["\u003cp\u003eThe documentation offers tutorials on setting up a web server, or utilizing the gcloud command line, as well as ways to transfer files to your instance.\u003c/p\u003e\n"]]],[],null,["# Create a Linux VM instance in Compute Engine\n============================================\n\nLearn how to create a Linux virtual machine (VM) instance in Compute Engine\nusing the Google Cloud console.\n\n*** ** * ** ***\n\nTo follow step-by-step guidance for this task directly in the\nGoogle Cloud console, click **Guide me**:\n\n[Guide me](https://console.cloud.google.com/freetrial?redirectPath=/?walkthrough_id=compute--compute_short_quickstart)\n\n*** ** * ** ***\n\nBefore you begin\n----------------\n\n- Sign in to your Google Cloud account. If you're new to Google Cloud, [create an account](https://console.cloud.google.com/freetrial) to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.\n- In the Google Cloud console, on the project selector page,\n select or create a Google Cloud project.\n\n | **Note**: If you don't plan to keep the resources that you create in this procedure, create a project instead of selecting an existing project. After you finish these steps, you can delete the project, removing all resources associated with the project.\n\n [Go to project selector](https://console.cloud.google.com/projectselector2/home/dashboard)\n-\n [Verify that billing is enabled for your Google Cloud project](/billing/docs/how-to/verify-billing-enabled#confirm_billing_is_enabled_on_a_project).\n\n-\n\n Make sure that you have the following role or roles on the project:\n\n Compute Instance Admin (v1), Compute Security\n Admin, OSPolicyAssignment Admin, Service Account User, Service Usage Admin\n\n #### Check for the roles\n\n 1.\n In the Google Cloud console, go to the **IAM** page.\n\n [Go to IAM](https://console.cloud.google.com/projectselector/iam-admin/iam?supportedpurview=project)\n 2. Select the project.\n 3.\n In the **Principal** column, find all rows that identify you or a group that\n you're included in. To learn which groups you're included in, contact your\n administrator.\n\n 4. For all rows that specify or include you, check the **Role** column to see whether the list of roles includes the required roles.\n\n #### Grant the roles\n\n 1.\n In the Google Cloud console, go to the **IAM** page.\n\n [Go to IAM](https://console.cloud.google.com/projectselector/iam-admin/iam?supportedpurview=project)\n 2. Select the project.\n 3. Click person_add **Grant access**.\n 4.\n In the **New principals** field, enter your user identifier.\n\n This is typically the email address for a Google Account.\n\n 5. In the **Select a role** list, select a role.\n 6. To grant additional roles, click add **Add\n another role** and add each additional role.\n 7. Click **Save**.\n\n- In the Google Cloud console, on the project selector page,\n select or create a Google Cloud project.\n\n | **Note**: If you don't plan to keep the resources that you create in this procedure, create a project instead of selecting an existing project. After you finish these steps, you can delete the project, removing all resources associated with the project.\n\n [Go to project selector](https://console.cloud.google.com/projectselector2/home/dashboard)\n-\n [Verify that billing is enabled for your Google Cloud project](/billing/docs/how-to/verify-billing-enabled#confirm_billing_is_enabled_on_a_project).\n\n-\n\n Make sure that you have the following role or roles on the project:\n\n Compute Instance Admin (v1), Compute Security\n Admin, OSPolicyAssignment Admin, Service Account User, Service Usage Admin\n\n #### Check for the roles\n\n 1.\n In the Google Cloud console, go to the **IAM** page.\n\n [Go to IAM](https://console.cloud.google.com/projectselector/iam-admin/iam?supportedpurview=project)\n 2. Select the project.\n 3.\n In the **Principal** column, find all rows that identify you or a group that\n you're included in. To learn which groups you're included in, contact your\n administrator.\n\n 4. For all rows that specify or include you, check the **Role** column to see whether the list of roles includes the required roles.\n\n #### Grant the roles\n\n 1.\n In the Google Cloud console, go to the **IAM** page.\n\n [Go to IAM](https://console.cloud.google.com/projectselector/iam-admin/iam?supportedpurview=project)\n 2. Select the project.\n 3. Click person_add **Grant access**.\n 4.\n In the **New principals** field, enter your user identifier.\n\n This is typically the email address for a Google Account.\n\n 5. In the **Select a role** list, select a role.\n 6. To grant additional roles, click add **Add\n another role** and add each additional role.\n 7. Click **Save**.\n\n1. Enable the Compute Engine API.\n [Enable the Compute Engine API](https://console.cloud.google.com/apis/api/compute.googleapis.com/overview)\n\nCreate a Linux VM instance\n--------------------------\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)\n2. In the **Boot disk** section, click **Change** to begin configuring your boot disk.\n3. On the **Public images** tab, choose **Ubuntu** from the **Operating system** list.\n4. Choose **Ubuntu 24.04 LTS** from the **Version** list.\n5. Click **Select**.\n6. In the **Firewall** section, select **Allow HTTP traffic**.\n7. To create the VM, click **Create**.\n\nAllow a short period of time for the VM instance to start. After the VM instance\nis ready, it's listed on the **VM instances** page with a green status icon.\n\nCompute Engine grants the user who creates the VM instance with the\n`roles/compute.instanceAdmin` role. Compute Engine also adds that\nuser to the `sudo` group.\n\nConnect to the VM instance\n--------------------------\n\nConnect to a VM instance by using the Google Cloud console and completing the\nfollowing steps. You're connected to the VM instance as the user you used to\naccess the VM instances page.\n\n1. In the Google Cloud console, go to the **VM instances** page.\n\n [Go to VM instances](https://console.cloud.google.com/compute/instances)\n2. In the list of virtual machine instances, click **SSH** in the row of the instance that you want to connect to.\n\nClean up\n--------\n\n\nTo avoid incurring charges to your Google Cloud account for\nthe resources used on this page, follow these steps.\n\n1. In the Google Cloud console, go to the **VM instances** page.\n\n [Go to VM instances](https://console.cloud.google.com/compute/instances)\n2. Select the row containing the VM instance that you've created in this\n tutorial.\n\n3. Click delete **Delete** , and then click\n **Delete** to confirm.\n\nWhat's next\n-----------\n\n- Work through a tutorial to [set up a basic web server](/compute/docs/tutorials/basic-webserver-apache) on your new instance.\n- Work through a [getting started tutorial](https://console.cloud.google.com/start?tutorial=compute_quickstart) in the Google Cloud console.\n- Learn how to [create and manage virtual machine instances](/compute/docs/instances/create-start-instance) using the gcloud CLI command-line tool and API.\n- Learn more about the [Linux images available on Compute Engine](/compute/docs/images#os-compute-support).\n- Learn how to [transfer your files to your instance](/compute/docs/instances/transfer-files)."]]