Method: instances.insert

Creates an instance resource in the specified project using the data included in the request.

HTTP request

POST https://compute.googleapis.com/compute/v1/projects/{project}/zones/{zone}/instances

The URL uses gRPC Transcoding syntax.

Path parameters

Parameters
project

string

Project ID for this request.

zone

string

The name of the zone for this request.

Query parameters

Parameters
requestId

string

An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed.

For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments.

The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).

sourceInstanceTemplate

string

Specifies instance template to create the instance.

This field is optional. It can be a full or partial URL. For example, the following are all valid URLs to an instance template:

Authorization requires the following IAM permission on the specified resource sourceInstanceTemplate:

  • compute.instanceTemplates.useReadOnly

Request body

The request body contains data with the following structure:

JSON representation
{
  "id": string,
  "creationTimestamp": string,
  "name": string,
  "description": string,
  "tags": {
    "items": [
      string
    ],
    "fingerprint": string
  },
  "machineType": string,
  "status": enum,
  "statusMessage": string,
  "zone": string,
  "canIpForward": boolean,
  "networkInterfaces": [
    {
      "network": string,
      "subnetwork": string,
      "networkIP": string,
      "ipv6Address": string,
      "name": string,
      "accessConfigs": [
        {
          "type": enum,
          "name": string,
          "natIP": string,
          "externalIpv6": string,
          "externalIpv6PrefixLength": integer,
          "setPublicPtr": boolean,
          "publicPtrDomainName": string,
          "networkTier": enum,
          "kind": string
        }
      ],
      "ipv6AccessConfigs": [
        {
          "type": enum,
          "name": string,
          "natIP": string,
          "externalIpv6": string,
          "externalIpv6PrefixLength": integer,
          "setPublicPtr": boolean,
          "publicPtrDomainName": string,
          "networkTier": enum,
          "kind": string
        }
      ],
      "aliasIpRanges": [
        {
          "ipCidrRange": string,
          "subnetworkRangeName": string
        }
      ],
      "fingerprint": string,
      "stackType": enum,
      "ipv6AccessType": enum,
      "queueCount": integer,
      "nicType": enum,
      "kind": string
    }
  ],
  "disks": [
    {
      "type": enum,
      "mode": enum,
      "source": string,
      "deviceName": string,
      "index": integer,
      "boot": boolean,
      "initializeParams": {
        "diskName": string,
        "sourceImage": string,
        "diskSizeGb": string,
        "diskType": string,
        "sourceImageEncryptionKey": {
          "rawKey": string,
          "rsaEncryptedKey": string,
          "kmsKeyName": string,
          "sha256": string,
          "kmsKeyServiceAccount": string
        },
        "labels": {
          string: string,
          ...
        },
        "sourceSnapshot": string,
        "sourceSnapshotEncryptionKey": {
          "rawKey": string,
          "rsaEncryptedKey": string,
          "kmsKeyName": string,
          "sha256": string,
          "kmsKeyServiceAccount": string
        },
        "description": string,
        "resourcePolicies": [
          string
        ],
        "onUpdateAction": enum,
        "provisionedIops": string
      },
      "autoDelete": boolean,
      "licenses": [
        string
      ],
      "interface": enum,
      "guestOsFeatures": [
        {
          "type": enum
        }
      ],
      "diskEncryptionKey": {
        "sha256": string,
        "kmsKeyServiceAccount": string,

        
        "rawKey": string,
        "rsaEncryptedKey": string,
        "kmsKeyName": string
        
      },
      "diskSizeGb": string,
      "shieldedInstanceInitialState": {
        "pk": {
          "content": string,
          "fileType": enum
        },
        "keks": [
          {
            "content": string,
            "fileType": enum
          }
        ],
        "dbs": [
          {
            "content": string,
            "fileType": enum
          }
        ],
        "dbxs": [
          {
            "content": string,
            "fileType": enum
          }
        ]
      },
      "kind": string
    }
  ],
  "metadata": {
    "fingerprint": string,
    "items": [
      {
        "key": string,
        "value": string
      }
    ],
    "kind": string
  },
  "serviceAccounts": [
    {
      "email": string,
      "scopes": [
        string
      ]
    }
  ],
  "selfLink": string,
  "scheduling": {
    "onHostMaintenance": enum,
    "automaticRestart": boolean,
    "preemptible": boolean,
    "nodeAffinities": [
      {
        "key": string,
        "operator": enum,
        "values": [
          string
        ]
      }
    ],
    "minNodeCpus": integer,
    "locationHint": string
  },
  "cpuPlatform": string,
  "labels": {
    string: string,
    ...
  },
  "labelFingerprint": string,
  "minCpuPlatform": string,
  "guestAccelerators": [
    {
      "acceleratorType": string,
      "acceleratorCount": integer
    }
  ],
  "startRestricted": boolean,
  "deletionProtection": boolean,
  "resourcePolicies": [
    string
  ],
  "reservationAffinity": {
    "consumeReservationType": enum,
    "key": string,
    "values": [
      string
    ]
  },
  "hostname": string,
  "displayDevice": {
    "enableDisplay": boolean
  },
  "shieldedInstanceConfig": {
    "enableSecureBoot": boolean,
    "enableVtpm": boolean,
    "enableIntegrityMonitoring": boolean
  },
  "shieldedInstanceIntegrityPolicy": {
    "updateAutoLearnPolicy": boolean
  },
  "confidentialInstanceCo