Compute Cloud API, REST: Instance.Relocate
- HTTP request
- Path parameters
- Body parameters
- NetworkInterfaceSpec
- PrimaryAddressSpec
- OneToOneNatSpec
- DnsRecordSpec
- DiskPlacementPolicy
- DiskPlacementPolicyChange
- Response
- RelocateInstanceMetadata
- Status
- Instance
- Resources
- MetadataOptions
- AttachedDisk
- AttachedLocalDisk
- AttachedFilesystem
- NetworkInterface
- PrimaryAddress
- OneToOneNat
- DnsRecord
- SerialPortSettings
- GpuSettings
- SchedulingPolicy
- NetworkSettings
- PlacementPolicy
- HostAffinityRule
- HardwareGeneration
- LegacyHardwareFeatures
Moves the specified instance to another availability zone
Running instance will be restarted during this operation.
HTTP request
POST https://compute.api.cloud.yandex.net/compute/v1/instances/{instanceId}:relocate
Path parameters
Field |
Description |
instanceId |
string Required field. ID of the instance to move. To get the instance ID, make a InstanceService.List request. |
Body parameters
{
"destinationZoneId": "string",
"networkInterfaceSpecs": [
{
"subnetId": "string",
"primaryV4AddressSpec": {
"address": "string",
"oneToOneNatSpec": {
"ipVersion": "string",
"address": "string",
"dnsRecordSpecs": [
{
"fqdn": "string",
"dnsZoneId": "string",
"ttl": "string",
"ptr": "boolean"
}
]
},
"dnsRecordSpecs": [
{
"fqdn": "string",
"dnsZoneId": "string",
"ttl": "string",
"ptr": "boolean"
}
]
},
"primaryV6AddressSpec": {
"address": "string",
"oneToOneNatSpec": {
"ipVersion": "string",
"address": "string",
"dnsRecordSpecs": [
{
"fqdn": "string",
"dnsZoneId": "string",
"ttl": "string",
"ptr": "boolean"
}
]
},
"dnsRecordSpecs": [
{
"fqdn": "string",
"dnsZoneId": "string",
"ttl": "string",
"ptr": "boolean"
}
]
},
"securityGroupIds": [
"string"
],
"index": "string"
}
],
"bootDiskPlacement": {
"placementGroupId": "string",
"placementGroupPartition": "string"
},
"secondaryDiskPlacements": [
{
"diskId": "string",
"diskPlacementPolicy": {
"placementGroupId": "string",
"placementGroupPartition": "string"
}
}
]
}
Field |
Description |
destinationZoneId |
string Required field. ID of the availability zone to move the instance to. To get the zone ID, make a ZoneService.List request. |
networkInterfaceSpecs[] |
Required field. Network configuration for the instance. Specifies how the network interface is configured |
bootDiskPlacement |
Boot disk placement policy configuration in target zone. Must be specified if disk has placement policy. |
secondaryDiskPlacements[] |
Secondary disk placement policy configurations in target zone. Must be specified for each disk that has placement policy. |
NetworkInterfaceSpec
Field |
Description |
subnetId |
string Required field. ID of the subnet. |
primaryV4AddressSpec |
Primary IPv4 address that will be assigned to the instance for this network interface. |
primaryV6AddressSpec |
Primary IPv6 address that will be assigned to the instance for this network interface. IPv6 not available yet. |
securityGroupIds[] |
string ID's of security groups attached to the interface |
index |
string The index of the network interface, will be generated by the server, 0,1,2... etc if not specified. |
PrimaryAddressSpec
Field |
Description |
address |
string An IPv4 internal network address that is assigned to the instance for this network interface. |
oneToOneNatSpec |
An external IP address configuration. |
dnsRecordSpecs[] |
Internal DNS configuration |
OneToOneNatSpec
Field |
Description |
ipVersion |
enum (IpVersion) External IP address version.
|
address |
string set static IP by value |
dnsRecordSpecs[] |
External DNS configuration |
DnsRecordSpec
Field |
Description |
fqdn |
string Required field. FQDN (required) |
dnsZoneId |
string DNS zone id (optional, if not set, private zone used) |
ttl |
string (int64) DNS record ttl, values in 0-86400 (optional) |
ptr |
boolean When set to true, also create PTR DNS record (optional) |
DiskPlacementPolicy
Field |
Description |
placementGroupId |
string Placement group ID. |
placementGroupPartition |
string (int64) |
DiskPlacementPolicyChange
Field |
Description |
diskId |
string Disk ID. |
diskPlacementPolicy |
Placement policy configuration for given disk. |
Response
HTTP Code: 200 - OK
{
"id": "string",
"description": "string",
"createdAt": "string",
"createdBy": "string",
"modifiedAt": "string",
"done": "boolean",
"metadata": {
"instanceId": "string",
"sourceZoneId": "string",
"destinationZoneId": "string"
},
// Includes only one of the fields `error`, `response`
"error": {
"code": "integer",
"message": "string",
"details": [
"object"
]
},
"response": {
"id": "string",
"folderId": "string",
"createdAt": "string",
"name": "string",
"description": "string",
"labels": "string",
"zoneId": "string",
"platformId": "string",
"resources": {
"memory": "string",
"cores": "string",
"coreFraction": "string",
"gpus": "string"
},
"status": "string",
"metadata": "string",
"metadataOptions": {
"gceHttpEndpoint": "string",
"awsV1HttpEndpoint": "string",
"gceHttpToken": "string",
"awsV1HttpToken": "string"
},
"bootDisk": {
"mode": "string",
"deviceName": "string",
"autoDelete": "boolean",
"diskId": "string"
},
"secondaryDisks": [
{
"mode": "string",
"deviceName": "string",
"autoDelete": "boolean",
"diskId": "string"
}
],
"localDisks": [
{
"size": "string",
"deviceName": "string"
}
],
"filesystems": [
{
"mode": "string",
"deviceName": "string",
"filesystemId": "string"
}
],
"networkInterfaces": [
{
"index": "string",
"macAddress": "string",
"subnetId": "string",
"primaryV4Address": {
"address": "string",
"oneToOneNat": {
"address": "string",
"ipVersion": "string",
"dnsRecords": [
{
"fqdn": "string",
"dnsZoneId": "string",
"ttl": "string",
"ptr": "boolean"
}
]
},
"dnsRecords": [
{
"fqdn": "string",
"dnsZoneId": "string",
"ttl": "string",
"ptr": "boolean"
}
]
},
"primaryV6Address": {
"address": "string",
"oneToOneNat": {
"address": "string",
"ipVersion": "string",
"dnsRecords": [
{
"fqdn": "string",
"dnsZoneId": "string",
"ttl": "string",
"ptr": "boolean"
}
]
},
"dnsRecords": [
{
"fqdn": "string",
"dnsZoneId": "string",
"ttl": "string",
"ptr": "boolean"
}
]
},
"securityGroupIds": [
"string"
]
}
],
"serialPortSettings": {
"sshAuthorization": "string"
},
"gpuSettings": {
"gpuClusterId": "string"
},
"fqdn": "string",
"schedulingPolicy": {
"preemptible": "boolean"
},
"serviceAccountId": "string",
"networkSettings": {
"type": "string"
},
"placementPolicy": {
"placementGroupId": "string",
"hostAffinityRules": [
{
"key": "string",
"op": "string",
"values": [
"string"
]
}
],
"placementGroupPartition": "string"
},
"hostGroupId": "string",
"hostId": "string",
"maintenancePolicy": "string",
"maintenanceGracePeriod": "string",
"hardwareGeneration": {
// Includes only one of the fields `legacyFeatures`, `generation2Features`
"legacyFeatures": {
"pciTopology": "string"
},
"generation2Features": "object"
// end of the list of possible fields
}
}
// 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 To work with values in this field, use the APIs described in the |
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 To work with values in this field, use the APIs described in the |
done |
boolean If the value is |
metadata |
Service-specific metadata associated with the operation. |
error |
The error result of the operation in case of failure or cancellation. Includes only one of the fields The operation result. |
response |
The normal response of the operation in case of success. Includes only one of the fields The operation result. |
RelocateInstanceMetadata
Field |
Description |
instanceId |
string ID of the instance that is being moved. |
sourceZoneId |
string ID of the availability zone that the instance is being moved from. |
destinationZoneId |
string ID of the availability zone that the instance is being moved to. |
Status
The error result of the operation in case of failure or cancellation.
Field |
Description |
code |
integer (int32) Error code. An enum value of google.rpc.Code |
message |
string An error message. |
details[] |
object A list of messages that carry the error details. |
Instance
An Instance resource. For more information, see Instances.
Field |
Description |
id |
string ID of the instance. |
folderId |
string ID of the folder that the instance belongs to. |
createdAt |
string (date-time) String in RFC3339 To work with values in this field, use the APIs described in the |
name |
string Name of the instance. 1-63 characters long. |
description |
string Description of the instance. 0-256 characters long. |
labels |
string Resource labels as |
zoneId |
string ID of the availability zone where the instance resides. |
platformId |
string ID of the hardware platform configuration for the instance. |
resources |
Computing resources of the instance such as the amount of memory and number of cores. |
status |
enum (Status) Status of the instance.
|
metadata |
string The metadata For example, you may use the metadata in order to provide your public SSH key to the instance. |
metadataOptions |
Options allow user to configure access to instance's metadata |
bootDisk |
Boot disk that is attached to the instance. |
secondaryDisks[] |
Array of secondary disks that are attached to the instance. |
localDisks[] |
Array of local disks that are attached to the instance. |
filesystems[] |
Array of filesystems that are attached to the instance. |
networkInterfaces[] |
Array of network interfaces that are attached to the instance. |
serialPortSettings |
Serial port settings |
gpuSettings |
GPU settings |
fqdn |
string A domain name of the instance. FQDN is defined by the server |
schedulingPolicy |
Scheduling policy configuration. |
serviceAccountId |
string ID of the service account to use for authentication inside the instance. |
networkSettings |
Network Settings |
placementPolicy |
Placement policy configuration. |
hostGroupId |
string ID of the dedicated host group that the instance belongs to. |
hostId |
string ID of the dedicated host that the instance belongs to. |
maintenancePolicy |
enum (MaintenancePolicy) Behaviour on maintenance events
|
maintenanceGracePeriod |
string (duration) Time between notification via metadata service and maintenance |
hardwareGeneration |
This feature set is inherited from the image/disk used as a boot one at the creation of the instance. |
Resources
Field |
Description |
memory |
string (int64) The amount of memory available to the instance, specified in bytes. |
cores |
string (int64) The number of cores available to the instance. |
coreFraction |
string (int64) Baseline level of CPU performance with the ability to burst performance above that baseline level. |
gpus |
string (int64) The number of GPUs available to the instance. |
MetadataOptions
Field |
Description |
gceHttpEndpoint |
enum (MetadataOption) Enabled access to GCE flavored metadata
|
awsV1HttpEndpoint |
enum (MetadataOption) Enabled access to AWS flavored metadata (IMDSv1)
|
gceHttpToken |
enum (MetadataOption) Enabled access to IAM credentials with GCE flavored metadata
|
awsV1HttpToken |
enum (MetadataOption) Enabled access to IAM credentials with AWS flavored metadata (IMDSv1)
|
AttachedDisk
Field |
Description |
mode |
enum (Mode) Access mode to the Disk resource.
|
deviceName |
string Serial number that is reflected into the /dev/disk/by-id/ tree This value can be used to reference the device for mounting, resizing, and so on, from within the instance. |
autoDelete |
boolean Specifies whether the disk will be auto-deleted when the instance is deleted. |
diskId |
string ID of the disk that is attached to the instance. |
AttachedLocalDisk
Field |
Description |
size |
string (int64) Size of the disk, specified in bytes. |
deviceName |
string Serial number that is reflected into the /dev/disk/by-id/ tree This value can be used to reference the device for mounting, resizing, and so on, from within the instance. |
AttachedFilesystem
Field |
Description |
mode |
enum (Mode) Access mode to the filesystem.
|
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 |
filesystemId |
string ID of the filesystem that is attached to the instance. |
NetworkInterface
Field |
Description |
index |
string The index of the network interface, will be generated by the server, 0,1,2... etc if not specified. |
macAddress |
string MAC address that is assigned to the network interface. |
subnetId |
string ID of the subnet. |
primaryV4Address |
Primary IPv4 address that is assigned to the instance for this network interface. |
primaryV6Address |
Primary IPv6 address that is assigned to the instance for this network interface. IPv6 not available yet. |
securityGroupIds[] |
string ID's of security groups attached to the interface |
PrimaryAddress
Field |
Description |
address |
string An IPv4 internal network address that is assigned to the instance for this network interface. |
oneToOneNat |
One-to-one NAT configuration. If missing, NAT has not been set up. |
dnsRecords[] |
Internal DNS configuration |
OneToOneNat
Field |
Description |
address |
string An external IP address associated with this instance. |
ipVersion |
enum (IpVersion) IP version for the external IP address.
|
dnsRecords[] |
External DNS configuration |
DnsRecord
Field |
Description |
fqdn |
string Name of the A/AAAA record as specified when creating the instance. |
dnsZoneId |
string DNS zone id for the record (optional, if not set, some private zone is used). |
ttl |
string (int64) DNS record ttl (optional, if not set, a reasonable default is used.) |
ptr |
boolean When true, indicates there is a corresponding auto-created PTR DNS record. |
SerialPortSettings
Field |
Description |
sshAuthorization |
enum (SSHAuthorization) Authentication and authorization in serial console when using SSH protocol
|
GpuSettings
Field |
Description |
gpuClusterId |
string Attach instance to specified GPU cluster. |
SchedulingPolicy
Field |
Description |
preemptible |
boolean True for short-lived compute instances. For more information, see Preemptible VMs. |
NetworkSettings
Field |
Description |
type |
enum (Type) Network Type
|
PlacementPolicy
Field |
Description |
placementGroupId |
string Placement group ID. |
hostAffinityRules[] |
List of affinity rules. Scheduler will attempt to allocate instances according to order of rules. |
placementGroupPartition |
string (int64) Placement group partition |
HostAffinityRule
Affinity definition
Field |
Description |
key |
string Affinity label or one of reserved values - 'yc.hostId', 'yc.hostGroupId' |
op |
enum (Operator) Include or exclude action
|
values[] |
string Affinity value or host ID or host group ID |
HardwareGeneration
A set of features, specific to a particular Compute hardware generation.
They are not necessary supported by every host OS or distro, thus they are fixed to an image
and are applied to all instances created with it as their boot disk image.
These features significantly determine how the instance is created, thus cannot be changed after the fact.
Field |
Description |
legacyFeatures |
Includes only one of the fields |
generation2Features |
object Includes only one of the fields |
LegacyHardwareFeatures
A first hardware generation, by default compatible with all legacy images.
Allows switching to PCI_TOPOLOGY_V2 and back.
Field |
Description |
pciTopology |
enum (PCITopology)
|