Compute Cloud API, REST: Instance.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",
"gpus": "string"
},
"metadata": "object",
"metadataOptions": {
"gceHttpEndpoint": "string",
"awsV1HttpEndpoint": "string",
"gceHttpToken": "string",
"awsV1HttpToken": "string"
},
"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",
"placementGroupPartition": "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",
"placementGroupPartition": "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[]`
}
],
"localDiskSpecs": [
{
"size": "string"
}
],
"filesystemSpecs": [
{
"mode": "string",
"deviceName": "string",
"filesystemId": "string"
}
],
"networkInterfaceSpecs": [
{
"subnetId": "string",
"primaryV4AddressSpec": {
"address": "string",
"oneToOneNatSpec": {
"ipVersion": "string",
"address": "string",
"dnsRecordSpecs": [
{
"fqdn": "string",
"dnsZoneId": "string",
"ttl": "string",
"ptr": true
}
]
},
"dnsRecordSpecs": [
{
"fqdn": "string",
"dnsZoneId": "string",
"ttl": "string",
"ptr": true
}
]
},
"primaryV6AddressSpec": {
"address": "string",
"oneToOneNatSpec": {
"ipVersion": "string",
"address": "string",
"dnsRecordSpecs": [
{
"fqdn": "string",
"dnsZoneId": "string",
"ttl": "string",
"ptr": true
}
]
},
"dnsRecordSpecs": [
{
"fqdn": "string",
"dnsZoneId": "string",
"ttl": "string",
"ptr": true
}
]
},
"securityGroupIds": [
"string"
],
"index": "string"
}
],
"hostname": "string",
"schedulingPolicy": {
"preemptible": true
},
"serviceAccountId": "string",
"networkSettings": {
"type": "string"
},
"placementPolicy": {
"placementGroupId": "string",
"hostAffinityRules": [
{
"key": "string",
"op": "string",
"values": [
"string"
]
}
],
"placementGroupPartition": "string"
},
"gpuSettings": {
"gpuClusterId": "string"
},
"maintenancePolicy": "string",
"maintenanceGracePeriod": "string",
"serialPortSettings": {
"sshAuthorization": "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 |
description | string Description of the instance. The maximum string length in characters is 256. |
labels | object Resource labels as 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 |
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 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. |
metadataOptions | object Options allow user to configure access to instance's metadata |
metadataOptions. gceHttpEndpoint |
string Enabled access to GCE flavored metadata
|
metadataOptions. awsV1HttpEndpoint |
string Enabled access to AWS flavored metadata (IMDSv1)
|
metadataOptions. gceHttpToken |
string Enabled access to IAM credentials with GCE flavored metadata
|
metadataOptions. awsV1HttpToken |
string Enabled access to IAM credentials with AWS flavored metadata (IMDSv1)
|
bootDiskSpec | object Required. Boot disk to attach to the instance. |
bootDiskSpec. mode |
string The mode in which to attach this disk.
|
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 |
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 |
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. diskPlacementPolicy. placementGroupPartition |
string (int64) |
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.
|
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 |
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 |
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. diskPlacementPolicy. placementGroupPartition |
string (int64) |
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. |
localDiskSpecs[] | object Array of local disks to attach to the instance. |
localDiskSpecs[]. size |
string (int64) Required. Size of the disk, specified in bytes. |
filesystemSpecs[] | object Array of filesystems to attach to the instance. The filesystems must reside in the same availability zone as the instance. To use the instance with an attached filesystem, the latter must be mounted. For details, see documentation. |
filesystemSpecs[]. mode |
string Mode of access to the filesystem that should be attached.
|
filesystemSpecs[]. deviceName |
string Name of the device representing the filesystem on the instance. The name should be used for referencing the filesystem from within the instance when it's being mounted, resized etc. If not specified, a random value will be generated. Value must match the regular expression |
filesystemSpecs[]. filesystemId |
string ID of the filesystem 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. |
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.
|
networkInterfaceSpecs[]. primaryV4AddressSpec. oneToOneNatSpec. address |
string |
networkInterfaceSpecs[]. primaryV4AddressSpec. oneToOneNatSpec. dnsRecordSpecs[] |
object External DNS configuration |
networkInterfaceSpecs[]. primaryV4AddressSpec. oneToOneNatSpec. dnsRecordSpecs[]. fqdn |
string Required. FQDN (required) |
networkInterfaceSpecs[]. primaryV4AddressSpec. oneToOneNatSpec. dnsRecordSpecs[]. dnsZoneId |
string DNS zone id (optional, if not set, private zone used) |
networkInterfaceSpecs[]. primaryV4AddressSpec. oneToOneNatSpec. dnsRecordSpecs[]. ttl |
string (int64) DNS record ttl, values in 0-86400 (optional) Acceptable values are 0 to 86400, inclusive. |
networkInterfaceSpecs[]. primaryV4AddressSpec. oneToOneNatSpec. dnsRecordSpecs[]. ptr |
boolean (boolean) When set to true, also create PTR DNS record (optional) |
networkInterfaceSpecs[]. primaryV4AddressSpec. dnsRecordSpecs[] |
object Internal DNS configuration |
networkInterfaceSpecs[]. primaryV4AddressSpec. dnsRecordSpecs[]. fqdn |
string Required. FQDN (required) |
networkInterfaceSpecs[]. primaryV4AddressSpec. dnsRecordSpecs[]. dnsZoneId |
string DNS zone id (optional, if not set, private zone used) |
networkInterfaceSpecs[]. primaryV4AddressSpec. dnsRecordSpecs[]. ttl |
string (int64) DNS record ttl, values in 0-86400 (optional) Acceptable values are 0 to 86400, inclusive. |
networkInterfaceSpecs[]. primaryV4AddressSpec. dnsRecordSpecs[]. ptr |
boolean (boolean) When set to true, also create PTR DNS record (optional) |
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.
|
networkInterfaceSpecs[]. primaryV6AddressSpec. oneToOneNatSpec. address |
string |
networkInterfaceSpecs[]. primaryV6AddressSpec. oneToOneNatSpec. dnsRecordSpecs[] |
object External DNS configuration |
networkInterfaceSpecs[]. primaryV6AddressSpec. oneToOneNatSpec. dnsRecordSpecs[]. fqdn |
string Required. FQDN (required) |
networkInterfaceSpecs[]. primaryV6AddressSpec. oneToOneNatSpec. dnsRecordSpecs[]. dnsZoneId |
string DNS zone id (optional, if not set, private zone used) |
networkInterfaceSpecs[]. primaryV6AddressSpec. oneToOneNatSpec. dnsRecordSpecs[]. ttl |
string (int64) DNS record ttl, values in 0-86400 (optional) Acceptable values are 0 to 86400, inclusive. |
networkInterfaceSpecs[]. primaryV6AddressSpec. oneToOneNatSpec. dnsRecordSpecs[]. ptr |
boolean (boolean) When set to true, also create PTR DNS record (optional) |
networkInterfaceSpecs[]. primaryV6AddressSpec. dnsRecordSpecs[] |
object Internal DNS configuration |
networkInterfaceSpecs[]. primaryV6AddressSpec. dnsRecordSpecs[]. fqdn |
string Required. FQDN (required) |
networkInterfaceSpecs[]. primaryV6AddressSpec. dnsRecordSpecs[]. dnsZoneId |
string DNS zone id (optional, if not set, private zone used) |
networkInterfaceSpecs[]. primaryV6AddressSpec. dnsRecordSpecs[]. ttl |
string (int64) DNS record ttl, values in 0-86400 (optional) Acceptable values are 0 to 86400, inclusive. |
networkInterfaceSpecs[]. primaryV6AddressSpec. dnsRecordSpecs[]. ptr |
boolean (boolean) When set to true, also create PTR DNS record (optional) |
networkInterfaceSpecs[]. securityGroupIds[] |
string ID's of security groups attached to the interface |
networkInterfaceSpecs[]. index |
string The index of the network interface, will be generated by the server, 0,1,2... etc if not specified. |
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 Value must match the regular expression |
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
|
placementPolicy | object Placement policy configuration. |
placementPolicy. placementGroupId |
string Placement group ID. |
placementPolicy. hostAffinityRules[] |
object List of affinity rules. Scheduler will attempt to allocate instances according to order of rules. |
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 |
placementPolicy. placementGroupPartition |
string (int64) Placement group partition |
gpuSettings | object GPU settings. |
gpuSettings. gpuClusterId |
string Attach instance to specified GPU cluster. |
maintenancePolicy | string Behaviour on maintenance events
|
maintenanceGracePeriod | string Time between notification via metadata service and maintenance Acceptable values are 1 seconds to 86400 seconds, inclusive. |
serialPortSettings | object Serial port settings |
serialPortSettings. sshAuthorization |
string Authentication and authorization in serial console when using SSH protocol
|
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. The range of possible values is from To work with values in this field, use the APIs described in the Protocol Buffers reference. In some languages, built-in datetime utilities do not support nanosecond precision (9 digits). |
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. The range of possible values is from To work with values in this field, use the APIs described in the Protocol Buffers reference. In some languages, built-in datetime utilities do not support nanosecond precision (9 digits). |
done | boolean (boolean) If the value is |
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 |
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. |