Method create

Creates an instance in the specified folder. Method starts an asynchronous operation that can be cancelled while it is in progress.

HTTP request

POST https://compute.api.cloud.yandex.net/compute/v1/instances

Body parameters

 {
  "folderId": "string",
  "name": "string",
  "description": "string",
  "labels": "object",
  "zoneId": "string",
  "platformId": "string",
  "resourcesSpec": {
    "memory": "string",
    "cores": "string",
    "coreFraction": "string"
  },
  "metadata": "object",
  "bootDiskSpec": {
    "mode": "string",
    "deviceName": "string",
    "autoDelete": true,

    // `bootDiskSpec`includes only one of the fields `diskSpec`, `diskId`
    "diskSpec": {
      "name": "string",
      "description": "string",
      "typeId": "string",
      "size": "string",

      // `bootDiskSpec.diskSpec`includes only one of the fields `imageId`, `snapshotId`
      "imageId": "string",
      "snapshotId": "string",
      // end of the list of possible fields`bootDiskSpec.diskSpec`

    },
    "diskId": "string",
    // end of the list of possible fields`bootDiskSpec`

  },
  "secondaryDiskSpecs": [
    {
      "mode": "string",
      "deviceName": "string",
      "autoDelete": true,

      // `secondaryDiskSpecs[]`includes only one of the fields `diskSpec`, `diskId`
      "diskSpec": {
        "name": "string",
        "description": "string",
        "typeId": "string",
        "size": "string",

        // `secondaryDiskSpecs[].diskSpec`includes only one of the fields `imageId`, `snapshotId`
        "imageId": "string",
        "snapshotId": "string",
        // end of the list of possible fields`secondaryDiskSpecs[].diskSpec`

      },
      "diskId": "string",
      // end of the list of possible fields`secondaryDiskSpecs[]`

    }
  ],
  "networkInterfaceSpecs": [
    {
      "subnetId": "string",
      "primaryV4AddressSpec": {
        "address": "string",
        "oneToOneNatSpec": {
          "ipVersion": "string"
        }
      },
      "primaryV6AddressSpec": {
        "address": "string",
        "oneToOneNatSpec": {
          "ipVersion": "string"
        }
      }
    }
  ],
  "hostname": "string",
  "schedulingPolicy": {
    "preemptible": true
  }
}
Field Description
folderId string

Required. ID of the folder to create an instance in. To get the folder ID, use a list request.

The maximum string length in characters is 50.

name string

Name of the instance.

Value must match the regular expression |[a-z][-a-z0-9]{1,61}[a-z0-9].

description string

Description of the instance.

The maximum string length in characters is 256.

labels object

Resource labels as key:value pairs.

No more than 64 per resource. The string length in characters for each key must be 1-63. Each key must match the regular expression [a-z][-_0-9a-z]. The maximum string length in characters for each value is 63. Each value must match the regular expression [-_0-9a-z].

zoneId string

Required. ID of the availability zone where the instance resides. To get a list of available zones, use the list request

The maximum string length in characters is 50.

platformId string

Required. ID of the hardware platform configuration for the instance. This field affects the available values in resourcesSpec field.

Currently only one platform is available - standard-v1. This platform is suitable for most tasks. This platform allows you to create various types of instances: with a large amount of memory, with a large number of cores, with a burstable performance.

Value must match the regular expression standard-v1.

resourcesSpec object

Required. Computing resources of the instance, such as the amount of memory and number of cores. To get a list of available values, see Computing resources.

resourcesSpec.
memory
string (int64)

Required. The amount of memory available to the instance, specified in bytes.

The maximum value is 274877906944.

resourcesSpec.
cores
string (int64)

Required. The number of cores available to the instance.

Value must be one of 1, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30 or 32.

resourcesSpec.
coreFraction
string (int64)

Baseline level of CPU performance with the ability to burst performance above that baseline level. This field sets baseline performance for each core.

For example, if you need only 5% of the CPU performance, you can set core_fraction=5. For more information, see documentation.

Value must be one of 0, 5 or 100.

metadata object

The metadata key:value pairs that will be assigned to this instance. This includes custom metadata and predefined keys. The total size of all keys and values must be less than 512 KB.

Values are free-form strings, and only have meaning as interpreted by the programs which configure the instance. The only restriction placed on values is that their size must be 256 KB or less.

For example, you may use the metadata in order to provide your public SSH key to the instance. For more information, see Metadata.

bootDiskSpec object

Required. Boot disk to attach to the instance.

bootDiskSpec.
mode
string
  • READ_ONLY: Read-only access.
  • READ_WRITE: Read/Write access. Default value.
bootDiskSpec.
deviceName
string

Specifies a unique serial number of your choice that is reflected into the /dev/disk/by-id/ tree of a Linux operating system running within the instance.

This value can be used to reference the device for mounting, resizing, and so on, from within the instance. If not specified, a random value will be generated.

Value must match the regular expression [a-z][a-z0-9-_]{,19}.

bootDiskSpec.
autoDelete
boolean (boolean)

Specifies whether the disk will be auto-deleted when the instance is deleted.

bootDiskSpec.
diskSpec
object
bootDiskSpec includes only one of the fields diskSpec, diskId

bootDiskSpec.
diskSpec.
name
string

Name of the disk.

Value must match the regular expression |[a-z][-a-z0-9]{1,61}[a-z0-9].

bootDiskSpec.
diskSpec.
description
string

Description of the disk.

The maximum string length in characters is 256.

bootDiskSpec.
diskSpec.
typeId
string

ID of the disk type. To get a list of available disk types, use the list request.

The maximum string length in characters is 50.

bootDiskSpec.
diskSpec.
size
string (int64)

Required. Size of the disk, specified in bytes.

Acceptable values are 4194304 to 4398046511104, inclusive.

bootDiskSpec.
diskSpec.
imageId
string
bootDiskSpec.diskSpec includes only one of the fields imageId, snapshotId

ID of the image to create the disk from.

The maximum string length in characters is 50.

bootDiskSpec.
diskSpec.
snapshotId
string
bootDiskSpec.diskSpec includes only one of the fields imageId, snapshotId

ID of the snapshot to restore the disk from.

The maximum string length in characters is 50.

bootDiskSpec.
diskId
string
bootDiskSpec includes only one of the fields diskSpec, diskId

ID of the disk that should be attached.

The maximum string length in characters is 50.

secondaryDiskSpecs[] object

Array of secondary disks to attach to the instance.

The maximum number of elements is 3.

secondaryDiskSpecs[].
mode
string
  • READ_ONLY: Read-only access.
  • READ_WRITE: Read/Write access. Default value.
secondaryDiskSpecs[].
deviceName
string

Specifies a unique serial number of your choice that is reflected into the /dev/disk/by-id/ tree of a Linux operating system running within the instance.

This value can be used to reference the device for mounting, resizing, and so on, from within the instance. If not specified, a random value will be generated.

Value must match the regular expression [a-z][a-z0-9-_]{,19}.

secondaryDiskSpecs[].
autoDelete
boolean (boolean)

Specifies whether the disk will be auto-deleted when the instance is deleted.

secondaryDiskSpecs[].
diskSpec
object
secondaryDiskSpecs[] includes only one of the fields diskSpec, diskId

secondaryDiskSpecs[].
diskSpec.
name
string

Name of the disk.

Value must match the regular expression |[a-z][-a-z0-9]{1,61}[a-z0-9].

secondaryDiskSpecs[].
diskSpec.
description
string

Description of the disk.

The maximum string length in characters is 256.

secondaryDiskSpecs[].
diskSpec.
typeId
string

ID of the disk type. To get a list of available disk types, use the list request.

The maximum string length in characters is 50.

secondaryDiskSpecs[].
diskSpec.
size
string (int64)

Required. Size of the disk, specified in bytes.

Acceptable values are 4194304 to 4398046511104, inclusive.

secondaryDiskSpecs[].
diskSpec.
imageId
string
secondaryDiskSpecs[].diskSpec includes only one of the fields imageId, snapshotId

ID of the image to create the disk from.

The maximum string length in characters is 50.

secondaryDiskSpecs[].
diskSpec.
snapshotId
string
secondaryDiskSpecs[].diskSpec includes only one of the fields imageId, snapshotId

ID of the snapshot to restore the disk from.

The maximum string length in characters is 50.

secondaryDiskSpecs[].
diskId
string
secondaryDiskSpecs[] includes only one of the fields diskSpec, diskId

ID of the disk that should be attached.

The maximum string length in characters is 50.

networkInterfaceSpecs[] object

Required. Network configuration for the instance. Specifies how the network interface is configured to interact with other services on the internal network and on the internet. Currently only one network interface is supported per instance.

Must contain exactly 1 element.

networkInterfaceSpecs[].
subnetId
string

Required. ID of the subnet.

The maximum string length in characters is 50.

networkInterfaceSpecs[].
primaryV4AddressSpec
object

Primary IPv4 address that will be assigned to the instance for this network interface.

networkInterfaceSpecs[].
primaryV4AddressSpec.
address
string

An IPv4 internal network address that is assigned to the instance for this network interface. If not specified by the user, an unused internal IP is assigned by the system.

networkInterfaceSpecs[].
primaryV4AddressSpec.
oneToOneNatSpec
object

An external IP address configuration. If not specified, then this instance will have no external internet access.

networkInterfaceSpecs[].
primaryV4AddressSpec.
oneToOneNatSpec.
ipVersion
string

Required. External IP address version.

  • IPV4: IPv4 address, for example 192.0.2.235.
  • IPV6: IPv6 address. Not available yet.
networkInterfaceSpecs[].
primaryV6AddressSpec
object

Primary IPv6 address that will be assigned to the instance for this network interface. IPv6 not available yet.

networkInterfaceSpecs[].
primaryV6AddressSpec.
address
string

An IPv4 internal network address that is assigned to the instance for this network interface. If not specified by the user, an unused internal IP is assigned by the system.

networkInterfaceSpecs[].
primaryV6AddressSpec.
oneToOneNatSpec
object

An external IP address configuration. If not specified, then this instance will have no external internet access.

networkInterfaceSpecs[].
primaryV6AddressSpec.
oneToOneNatSpec.
ipVersion
string

Required. External IP address version.

  • IPV4: IPv4 address, for example 192.0.2.235.
  • IPV6: IPv6 address. Not available yet.
hostname string

Host name for the instance. This field is used to generate the Instance.fqdn value. The host name must be unique within the network and region. If not specified, the host name will be equal to Instance.id of the instance and FQDN will be <id>.auto.internal. Otherwise FQDN will be <hostname>.<region_id>.internal.

Value must match the regular expression |[a-z][-a-z0-9]{1,61}[a-z0-9].

schedulingPolicy object

Scheduling policy configuration.

schedulingPolicy.
preemptible
boolean (boolean)

True for short-lived compute instances. For more information, see Preemptible VMs.

Response

HTTP Code: 200 - OK

 {
  "id": "string",
  "description": "string",
  "createdAt": "string",
  "createdBy": "string",
  "modifiedAt": "string",
  "done": true,
  "metadata": "object",

  // includes only one of the fields `error`, `response`
  "error": {
    "code": "integer",
    "message": "string",
    "details": [
      "object"
    ]
  },
  "response": "object",
  // end of the list of possible fields

}

An Operation resource. For more information, see Operation.

Field Description
id string

ID of the operation.

description string

Description of the operation. 0-256 characters long.

createdAt string (date-time)

Creation timestamp in RFC3339 text format.

String in RFC3339 text format.

createdBy string

ID of the user or service account who initiated the operation.

modifiedAt string (date-time)

The time when the Operation resource was last modified. This value is in RFC3339 text format.

String in RFC3339 text format.

done boolean (boolean)

If the value is false, it means the operation is still in progress. If true, the operation is completed, and either error or response is available.

metadata object

Service-specific metadata associated with the operation. It typically contains the ID of the target resource that the operation is performed on. Any method that returns a long-running operation should document the metadata type, if any.

error object
includes only one of the fields error, response

The error result of the operation in case of failure or cancellation.

error.
code
integer (int32)

Error code. An enum value of google.rpc.Code.

error.
message
string

An error message.

error.
details[]
object

A list of messages that carry the error details.

response object
includes only one of the fields error, response

The normal response of the operation in case of success. If the original method returns no data on success, such as Delete, the response is google.protobuf.Empty. If the original method is the standard Create/Update, the response should be the target resource of the operation. Any method that returns a long-running operation should document the response type, if any.