Create a Linux VM instance in Compute Engine
Learn how to create a Linux virtual machine (VM) instance in Compute Engineusing the Google Cloud console.
To follow step-by-step guidance for this task directly in the Google Cloud console, clickGuide me:
Before you begin
- 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.
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.Make sure that billing is enabled for your Google Cloud project.
Make sure that you have the following role or roles on the project: Compute Instance Admin (v1), Compute SecurityAdmin, OSPolicyAssignment Admin, Service Account User, Service Usage Admin
Check for the roles
In the Google Cloud console, go to theIAM page.
Go to IAM- Select the project.
In thePrincipal 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 theRole column to see whether the list of roles includes the required roles.
Grant the roles
In the Google Cloud console, go to theIAM page.
Go to IAM- Select the project.
- Click Grant access.
In theNew principals field, enter your user identifier. This is typically the email address for a Google Account.
- In theSelect a role list, select a role.
- To grant additional roles, click Add another role and add each additional role.
- ClickSave.
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
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.Make sure that billing is enabled for your Google Cloud project.
Make sure that you have the following role or roles on the project: Compute Instance Admin (v1), Compute SecurityAdmin, OSPolicyAssignment Admin, Service Account User, Service Usage Admin
Check for the roles
In the Google Cloud console, go to theIAM page.
Go to IAM- Select the project.
In thePrincipal 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 theRole column to see whether the list of roles includes the required roles.
Grant the roles
In the Google Cloud console, go to theIAM page.
Go to IAM- Select the project.
- Click Grant access.
In theNew principals field, enter your user identifier. This is typically the email address for a Google Account.
- In theSelect a role list, select a role.
- To grant additional roles, click Add another role and add each additional role.
- ClickSave.
- Enable the Compute Engine API.
Create a Linux VM instance
- In the Google Cloud console, go to theCreate an instance page.
- In theBoot disk section, clickChange to begin configuring your boot disk.
- On thePublic images tab, chooseUbuntu from theOperating system list.
- ChooseUbuntu 24.04 LTS from theVersion list.
- ClickSelect.
- In theFirewall section, selectAllow HTTP traffic.
- To create the VM, clickCreate.
Allow a short period of time for the VM instance to start. After the VM instanceis ready, it's listed on theVM instances page with a green status icon.
Compute Engine grants the user who creates the VM instance with theroles/compute.instanceAdmin
role. Compute Engine also adds thatuser to thesudo
group.
Connect to the VM instance
Connect to a VM instance by using the Google Cloud console and completing thefollowing steps. You're connected to the VM instance as the user you used toaccess the VM instances page.
- In the Google Cloud console, go to theVM instances page.
- In the list of virtual machine instances, clickSSH in the row of the instance that you want to connect to.
Clean up
To avoid incurring charges to your Google Cloud account for the resources used on this page, follow these steps.
In the Google Cloud console, go to theVM instances page.
Select the row containing the VM instance that you've created in thistutorial.
Click
Delete, and then clickDelete to confirm.
What's next
- Work through a tutorial toset up a basic web server on your new instance.
- Work through agetting started tutorial in the Google Cloud console.
- Learn how tocreate and manage virtual machine instances using the gcloud CLI command-line tool and API.
- Learn more about theLinux images available on Compute Engine.
- Learn how totransfer your files to your instance.
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-07-09 UTC.