Yandex.Cloud
  • Services
  • Why Yandex.Cloud
  • Solutions
  • Pricing
  • Documentation
  • Contact us
Get started
Yandex Compute Cloud
  • Getting started
    • Overview
    • Creating a Linux VM
    • Creating a Windows VM
    • Creating instance groups
  • Step-by-step instructions
    • All instructions
    • Creating VMs
      • Creating a Linux VM
      • Creating a Windows VM
      • Creating a VM from a set of disks
      • Creating a VM with disks restored from snapshots
      • Creating a VM from a custom image
      • Creating a preemptible VM
      • Creating a VM with a GPU
    • DSVM
      • Overview
      • Creating a VM from a public DSVM image
    • Placement groups
      • Creating a placement group
      • Deleting a placement group
      • Creating a VM in a placement group
      • Adding a VM to a placement group
      • Removing a VM instance from a placement group
    • Images with pre-installed software
      • Creating a VM from a public image
      • Configuring software
      • Working with a VM based on a public image
      • Getting a list of public images
    • Getting information about a VM
      • Getting information about a VM
      • Viewing serial port output
    • Managing VMs
      • Stopping and starting a VM
      • Attaching a disk to a VM
      • Detaching a disk from a VM
      • Moving a VM to a different availability zone
      • Making a VM's public IP address static
      • Updating a VM
      • Changing VM computing resources
      • Deleting a VM
    • Working on VMs
      • Connecting to a VM via SSH
      • Connecting to a VM via RDP
      • Working with Yandex.Cloud from inside a VM
      • Installing NVIDIA drivers
    • Creating new disks
      • Creating an empty disk
      • Create an empty disk with a large block
    • Disk management
      • Creating a disk snapshot
      • Updating a disk
      • Deleting a disk
      • Deleting a disk snapshot
    • Creating new images
      • Uploading your image
    • Managing images
      • Deleting a disk image
    • Managing the serial console
      • Getting started
      • Connecting to a serial console via SSH
      • Connecting to a serial console via CLI
      • Start your terminal in the Windows SAC
      • Disabling access to the serial console
    • Creating instance groups
      • Creating a fixed-size instance group
      • Creating a fixed-size instance group with a network load balancer
      • Creating an automatically scaled instance group
      • Creating an instance group from Container Optimized Image
    • Getting information about instance groups
      • Getting a list of instance groups
      • Getting information about an instance group
      • Getting a list of instances in a group
    • Managing instance groups
      • Editing an instance group
      • Configuring application health check on the VM
      • Updating a instance group
        • Incremental updates
        • Uninterrupted updates
      • Stopping an instance group
      • Starting an instance group
      • Deleting an instance group
    • Dedicated hosts
      • Creating a VM in a group of dedicated hosts
      • Creating a VM on a dedicated host
  • Yandex Container Optimized Solutions
  • Scenarios
    • Configuring NTP time synchronization
    • Running instance groups with auto scaling
  • Concepts
    • Relationship between resources
    • Virtual machines
      • Overview
      • Platforms
      • vCPU performance levels
      • Graphics accelerators (GPUs)
      • Preemptible VMs
      • Network on a VM
      • Live migration
      • Placement groups
      • Statuses
      • Metadata
    • Disks
      • Overview
      • Disk snapshots
    • Images
    • Instance groups
      • Overview
      • Access
      • Instance template
      • Variables in an instance template
      • Policies
        • Overview
        • Allocation policy
        • Deployment policy
        • Scaling policy
      • Scaling types
      • Auto-healing
      • Updating
        • Overview
        • Allocating instances across zones
        • Deployment algorithm
        • Rules for updating instance groups
      • Statuses
    • Dedicated host
    • Backups
    • Quotas and limits
  • Access management
  • Pricing policy
    • Current pricing policy
    • Archive
      • Before January 1, 2019
      • From January 1 to March 1, 2019
      • From March 1 to May 1, 2019
  • Compute API reference
    • Authentication in the API
    • gRPC
      • Overview
      • DiskPlacementGroupService
      • DiskService
      • DiskTypeService
      • HostGroupService
      • HostTypeService
      • ImageService
      • InstanceService
      • PlacementGroupService
      • SnapshotService
      • ZoneService
      • InstanceGroupService
      • OperationService
    • REST
      • Overview
      • Disk
        • Overview
        • create
        • delete
        • get
        • list
        • listOperations
        • update
      • DiskPlacementGroup
        • Overview
        • create
        • delete
        • get
        • list
        • listDisks
        • listOperations
        • update
      • DiskType
        • Overview
        • get
        • list
      • HostGroup
        • Overview
        • create
        • delete
        • get
        • list
        • listHosts
        • listInstances
        • listOperations
        • update
      • HostType
        • Overview
        • get
        • list
      • Image
        • Overview
        • create
        • delete
        • get
        • getLatestByFamily
        • list
        • listOperations
        • update
      • Instance
        • Overview
        • addOneToOneNat
        • attachDisk
        • create
        • delete
        • detachDisk
        • get
        • getSerialPortOutput
        • list
        • listOperations
        • removeOneToOneNat
        • restart
        • start
        • stop
        • update
        • updateMetadata
        • updateNetworkInterface
      • PlacementGroup
        • Overview
        • create
        • delete
        • get
        • list
        • listInstances
        • listOperations
        • update
      • Snapshot
        • Overview
        • create
        • delete
        • get
        • list
        • listOperations
        • update
      • Zone
        • Overview
        • get
        • list
      • Operation
        • Overview
        • get
      • InstanceGroup
        • Overview
        • createFromYaml
        • update
        • list
        • get
        • delete
        • start
        • stop
        • create
        • listAccessBindings
        • setAccessBindings
        • updateFromYaml
        • listLogRecords
        • listInstances
        • updateAccessBindings
        • listOperations
  • Questions and answers
    • General questions
    • Virtual machines
    • Disks and snapshots
    • Licensing
    • All questions on the same page
  1. Compute API reference
  2. REST
  3. Instance
  4. create

Method create

  • HTTP request
  • Body parameters
  • Response

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",
    "gpus": "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",
      "blockSize": "string",
      "diskPlacementPolicy": {
        "placementGroupId": "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",
        "blockSize": "string",
        "diskPlacementPolicy": {
          "placementGroupId": "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",
          "address": "string"
        }
      },
      "primaryV6AddressSpec": {
        "address": "string",
        "oneToOneNatSpec": {
          "ipVersion": "string",
          "address": "string"
        }
      },
      "securityGroupIds": [
        "string"
      ]
    }
  ],
  "hostname": "string",
  "schedulingPolicy": {
    "preemptible": true
  },
  "serviceAccountId": "string",
  "networkSettings": {
    "type": "string"
  },
  "placementPolicy": {
    "placementGroupId": "string",
    "hostAffinityRules": [
      {
        "key": "string",
        "op": "string",
        "values": [
          "string"
        ]
      }
    ]
  }
}
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 href="%5B-a-z0-9%5D%7B0,61%7D%5Ba-z0-9%5D">a-z</a>?.

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][-<em>./@0-9a-z]*. The maximum string length in characters for each value is 63. Each value must match the regular expression [-</em>./@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.

Platforms allows you to create various types of instances: with a large amount of memory, with a large number of cores, with a burstable performance. For more information, see Platforms.

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 Levels of core performance.

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 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 40, 44, 48, 52, 56, 60, 64, 68, 72, 76 or 80.

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 Levels of core performance.

Value must be one of 0, 5, 20, 50 or 100.

resourcesSpec.
gpus
string (int64)

The number of GPUs available to the instance.

Value must be one of 0, 1, 2 or 4.

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 values 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
The mode in which to attach this disk.
  • 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
Disk specification.
bootDiskSpec includes only one of the fields diskSpec, diskId

bootDiskSpec.
diskSpec.
name
string

Name of the disk.

Value must match the regular expression |<a href="%5B-a-z0-9%5D%7B0,61%7D%5Ba-z0-9%5D">a-z</a>?.

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.
blockSize
string (int64)

Block size of the disk, specified in bytes. The default is 4096.

bootDiskSpec.
diskSpec.
diskPlacementPolicy
object
Placement policy configuration.
bootDiskSpec.
diskSpec.
diskPlacementPolicy.
placementGroupId
string

Placement group ID.

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
The mode in which to attach this disk.
  • 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
Disk specification.
secondaryDiskSpecs[] includes only one of the fields diskSpec, diskId

secondaryDiskSpecs[].
diskSpec.
name
string

Name of the disk.

Value must match the regular expression |<a href="%5B-a-z0-9%5D%7B0,61%7D%5Ba-z0-9%5D">a-z</a>?.

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.
blockSize
string (int64)

Block size of the disk, specified in bytes. The default is 4096.

secondaryDiskSpecs[].
diskSpec.
diskPlacementPolicy
object
Placement policy configuration.
secondaryDiskSpecs[].
diskSpec.
diskPlacementPolicy.
placementGroupId
string

Placement group ID.

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

External IP address version.

  • IPV4: IPv4 address, for example 192.0.2.235.
  • IPV6: IPv6 address. Not available yet.
networkInterfaceSpecs[].
primaryV4AddressSpec.
oneToOneNatSpec.
address
string
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

External IP address version.

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

ID's of security groups attached to the interface

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>.&lt;region_id&gt;.internal.

Value must match the regular expression |<a href="%5B-a-z0-9%5D%7B0,61%7D%5Ba-z0-9%5D">a-z</a>?.

schedulingPolicy object

Scheduling policy configuration.

schedulingPolicy.
preemptible
boolean (boolean)

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

serviceAccountId string

ID of the service account to use for authentication inside the instance. To get the service account ID, use a list request.

networkSettings object

Network settings.

networkSettings.
type
string

Network Type

  • STANDARD: Standard network.
  • SOFTWARE_ACCELERATED: Software accelerated network.
  • HARDWARE_ACCELERATED: Hardware accelerated network (not available yet, reserved for future use).
placementPolicy object

Placement policy configuration.

placementPolicy.
placementGroupId
string

Placement group ID.

placementPolicy.
hostAffinityRules[]
object

Affinitity definition

placementPolicy.
hostAffinityRules[].
key
string

Affinity label or one of reserved values - 'yc.hostId', 'yc.hostGroupId'

placementPolicy.
hostAffinityRules[].
op
string

Include or exclude action

placementPolicy.
hostAffinityRules[].
values[]
string

Affinity value or host ID or host group ID

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.

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.

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
The error result of the operation in case of failure or cancellation.
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.

In this article:
  • HTTP request
  • Body parameters
  • Response
Language / Region
Careers
Privacy policy
Terms of use
Brandbook
© 2021 Yandex.Cloud LLC