Create and start a Compute Engine instance
Stay organized with collections
Save and categorize content based on your preferences.
Compute Engine lets you create and run
instances on Google infrastructure.
This document shows how to create a Compute Engine instance.
The terms Compute Engine instance, compute instance or
instance are synonymous. Based on the
machine type
that you specify, an instance can be either a bare metal instance
or a virtual machine (VM) instance, as follows:
If the name of its machine type ends in -metal, an
instance is a
bare metal instance,
which does not have a hypervisor installed.
Otherwise, an instance is a VM instance. The terms
virtual machine instance, VM instance, and VM
are synonymous.
Synonymous terms are used interchangeably
across the documentation and Google Cloud interfaces such as the
Google Cloud console, the
gcloud command-line tool,
and the REST API.
The instructions in this document only introduce you to instance creation and
provide a starting point for creating an instance. For detailed steps on how to
create instances with specific or complicated configurations, see instead the
Create and start instances with specific configurations.
If you haven't already, set up 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:
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
Install the Google Cloud CLI.
After installation,
initialize the Google Cloud CLI by running the following command:
To use the Terraform samples on this page in a local development environment, install and
initialize the gcloud CLI, and then set up Application Default Credentials with
your user credentials.
To use the .NET samples on this page in a local development environment, install and
initialize the gcloud CLI, and then set up Application Default Credentials with
your user credentials.
To use the Go samples on this page in a local development environment, install and
initialize the gcloud CLI, and then set up Application Default Credentials with
your user credentials.
To use the Java samples on this page in a local development environment, install and
initialize the gcloud CLI, and then set up Application Default Credentials with
your user credentials.
To use the Node.js samples on this page in a local development environment, install and
initialize the gcloud CLI, and then set up Application Default Credentials with
your user credentials.
To use the PHP samples on this page in a local development environment, install and
initialize the gcloud CLI, and then set up Application Default Credentials with
your user credentials.
To use the Python samples on this page in a local development environment, install and
initialize the gcloud CLI, and then set up Application Default Credentials with
your user credentials.
To use the Ruby samples on this page in a local development environment, install and
initialize the gcloud CLI, and then set up Application Default Credentials with
your user credentials.
This predefined role contains
the permissions required to create instances. To see the exact permissions that are
required, expand the Required permissions section:
Required permissions
The following permissions are required to create instances:
compute.instances.create
on the project
To use a custom image to create the VM:
compute.images.useReadOnly
on the image
To use a snapshot to create the VM:
compute.snapshots.useReadOnly
on the snapshot
To use an instance template to create the VM:
compute.instanceTemplates.useReadOnly
on the instance template
To specify a subnet for your VM:
compute.subnetworks.use
on the project or on the chosen subnet
To specify a static IP address for the VM:
compute.addresses.use
on the project
To assign an external IP address to the VM when using a VPC network:
compute.subnetworks.useExternalIp
on the project or on the chosen subnet
To assign a legacy network to the VM:
compute.networks.use
on the project
To assign an external IP address to the VM when using a legacy network:
compute.networks.useExternalIp
on the project
To set VM instance metadata for the VM:
compute.instances.setMetadata
on the project
To set tags for the VM:
compute.instances.setTags
on the VM
To set labels for the VM:
compute.instances.setLabels
on the VM
To set a service account for the VM to use:
compute.instances.setServiceAccount
on the VM
To create a new disk for the VM:
compute.disks.create
on the project
To attach an existing disk in read-only or read-write mode:
compute.disks.use
on the disk
To attach an existing disk in read-only mode:
compute.disks.useReadOnly
on the disk
This section describes the basic methods that you can use to create and start
a Compute Engine instance. This procedure is intended for introductory
purposes only. For detailed steps on how to configure and create your
instances, see the
Create and start instances with specific configurations
section instead.
For beginners, Google recommends using the Google Cloud console, the
Google Cloud CLI, or the REST API. Review the following instructions to learn
the general process for creating an instance with each method. Optionally, you
can generate the code to create an instance for Google Cloud CLI, REST,
or Terraform by using the codeEquivalent code button on the Create an instance page in the
Google Cloud console. Generating code can help you learn syntax and prevent errors.
Learn more about
Google Cloud console features for Compute Engine.
Create and start instances with specific configurations
Each of the following documents provides instructions for how to create and
start an instance that uses one or more specific configuration options. Based
on your use case, you can create an instance that uses configuration options
from multiple documents by combining the instructions. To learn about the
various parameters that you can configure while creating your instance, review
Configuration options available during instance creation.
If you're new to Google Cloud, create an account to evaluate how
Compute Engine performs in real-world
scenarios. New customers also get $300 in free credits to run, test, and
deploy workloads.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2026-07-17 UTC."],[],[]]