Create and start a Compute Engine instance

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 .

Before you begin

Required roles

To get the permissions that you need to create instances, ask your administrator to grant you the Compute Instance Admin (v1) ( roles/compute.instanceAdmin.v1 ) IAM role on the project. For more information about granting roles, see Manage access to projects, folders, and organizations .

This predefined role contains the permissions required to create instances. To see the exact permissions that are required, expand the Required permissionssection:

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

You might also be able to get these permissions with custom roles or other predefined roles .

Methods to create and start an instance

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 Equivalent codebutton on the Create an instancepage 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 .

Console

  1. In the Google Cloud console, go to the Create an instancepage.

    Go to Create an instance

    The Create an instancescreen appears and displays the Machine configurationpane.

  2. To configure instance properties, use the options in the navigation menu as follows.

    • To configure instance properties related to name, location, or machine configuration, click Machine configuration. In the Machine configurationpane that appears, specify values for the properties that you want to configure.

    • To configure instance properties related to boot disk, operating system (OS), and additional non-boot storage options, click OS and storage. In the Operating system and storagepane that appears, specify values for the properties that you want to configure.

    • To configure instance properties related to backup and data replication, click Data protection. In the Data protectionpane that appears, specify values for the properties that you want to configure.

    • To configure instance properties related to network interface and firewall settings, click Networking. In the Networkingpane that appears, specify values for the properties that you want to configure.

    • To configure instance properties related to Ops agent and virtual displays, click Observability. In the Observabilitypane that appears, specify values for the properties that you want to configure.

    • To configure instance properties related to security and access, click Security. In the Securitypane that appears, specify values for the properties that you want to configure.

    • To configure instance properties related to metadata, reservations, resource organization, provisioning type, and sole-tenancy, click Advanced. In the Advancedpane that appears, specify values for the properties that you want to configure.

  3. To create and start your instance, click Create.

gcloud

To create an instance with your own configuration, use the gcloud compute instances create command .

You can't use this command to create instances in bulk or instances that run container images . Instead, do the following:

REST

To create an instance with your own configuration, make a POST request to the instances.insert method .

You can't use this method to create instances in bulk . Instead, make a POST request to the instances.bulkInsert method .

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 .

Preconfigured for you
Create a Google-configured, workload-optimized instance
Customized machine configuration
Create an instance with a custom hostname
Create an instance with a custom machine type
Create an instance with attached GPUs
Specify a minimum CPU platform for an instance
Customized OS configuration
Create an instance from a public image
Create an instance from a custom image
Create an instance from a shared image
Create an instance using a RHEL BYOS image
Customized networking configuration
Create an instance in a specific subnet
Create an instance that uses IPv6 addresses
Create instances that use the gVNIC network interface
Configure an instance with higher bandwidth
Customized observability configuration
Create an instance that's configured for Ops Agent monitoring and logging
Enable virtual displays on an instance
Customized security configuration
Create an instance that uses a user-managed service account
Create VMs with managed workload identities enabled
Enable OS Login during VM creation
Configured for disaster recovery
Create an instance with a Backup and DR backup plan
From a backup
Create an instance from a machine image
Create an instance from a disk snapshot
Restore an instance from a backup vault
From existing configurations
Create an instance from an instance template
Create an instance similar to an existing instance
Configured for specific workloads
Create an instance to deploy a container
Create Windows Server instances
Create SQL Server instances
Create an instance with a high performance computing (HPC) image
Customized provisioning type
Create a Spot instance
Create instances that consume reserved instances
Multiple instances at once
Create instances in bulk
Create a managed instance group (MIG)
Sole-tenant nodes
Create instances on sole-tenant nodes
Efficient instances
Create an instance with an attached instance schedule

Troubleshooting

To find methods for resolving common instance creation errors, see Troubleshooting instance creation .

What's next?

Try it for yourself

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.

Try Compute Engine free
Design a Mobile Site
View Site in Mobile | Classic
Share by: