Managing VMs in a reserved instance pool
Warning
Reserved instance pools are billable: you pay for the whole unused volume of reserved computing resources of VMs, GPU clusters, and software accelerated networks according to the Yandex Compute Cloud pricing policy. For more information, see Using reserved VM pools.
The reserved instance pool functionality is currently at the Preview stage.
You can attach both newly created and existing VMs to your reserved instance pools. For more information, see Reserved instance pools.
Creating a new VM attached to a reserved instance pool
To create a new VM in a reserved instance pool:
If you do not have the Yandex Cloud CLI installed yet, install and initialize it.
By default, the CLI uses the folder specified when creating the profile. To change the default folder, use the yc config set folder-id <folder_ID>
command. You can also set a different folder for any specific command using the --folder-name
or --folder-id
parameter.
-
See the description of the Yandex Cloud CLI command for creating a VM:
yc compute instance create --help
-
Get a list of reserved instance pools in the default folder:
yc compute reserved-instance-pool list
Result:
+----------------------+------------+---------------+------+ | ID | NAME | ZONE ID | SIZE | +----------------------+------------+---------------+------+ | fv48qa9iiq19******** | test-pool1 | ru-central1-a | 1 | | fv42fbsrso94******** | test-pool2 | ru-central1-a | 1 | +----------------------+------------+---------------+------+
-
Create a VM in a reserved instance pool:
yc compute instance create \ --name <VM_name> \ --zone <availability_zone_ID> \ --reserved-instance-pool-id <pool_ID> \ --network-interface subnet-name=<subnet_name>,nat-ip-version=ipv4 \ --create-boot-disk image-folder-id=standard-images,image-id=<image_ID> \ --ssh-key <path_to_SSH_key>
Where:
-
--name
: Name of the new VM. Follow these naming requirements:- It must be from 2 to 63 characters long.
- It can only contain lowercase Latin letters, numbers, and hyphens.
- It must start with a letter and cannot end with a hyphen.
-
--zone
: ID of the availability zone for the new VM. The VM availability zone must be the same as the pool availability zone. -
--reserved-instance-pool-id
: ID of the pool you are creating the VM in.Instead of ID, you can provide the pool's name in the
--reserved-instance-pool-name
parameter. -
--network-interface
: VM network interface settings:subnet-name
: Name of the subnet in the same availability zone of the VM and the pool.nat-ip-version=ipv4
: Public IP address. To create a VM without a public IP address, omit this parameter.
-
--create-boot-disk
: VM boot disk settings:image-id
: VM boot disk image ID, e.g., Ubuntu 24.04 LTS image ID.
-
--ssh-key
: Path to the public SSH key file, e.g.,~/.ssh/id_ed25519.pub
. The VM will automatically create a user namedyc-user
for this key.When creating a VM from a Yandex Cloud Marketplace public image, make sure to provide an SSH key, as SSH access with a username and password is disabled by default for such images.
Result:
done (34s) id: fv4fjf9qbt57******** folder_id: b1gt6g8ht345******** created_at: "2025-05-07T07:46:34Z" name: the-first-pool-vm zone_id: ru-central1-a platform_id: standard-v2 resources: memory: "2147483648" cores: "2" core_fraction: "100" status: RUNNING metadata_options: gce_http_endpoint: ENABLED aws_v1_http_endpoint: ENABLED gce_http_token: ENABLED aws_v1_http_token: DISABLED boot_disk: mode: READ_WRITE device_name: fv4v5k7u3g3n******** auto_delete: true disk_id: fv4v5k7u3g3n******** network_interfaces: - index: "0" mac_address: d0:0d:f9:bd:3a:5f subnet_id: fl8dmq91iruu******** primary_v4_address: address: 192.168.7.7 one_to_one_nat: address: 158.160.***.** ip_version: IPV4 serial_port_settings: ssh_authorization: OS_LOGIN gpu_settings: {} fqdn: fv4fjf9qbt57********.auto.internal scheduling_policy: {} network_settings: type: STANDARD placement_policy: {} hardware_generation: legacy_features: pci_topology: PCI_TOPOLOGY_V1 reserved_instance_pool_id: fv4k96kv52t7********
For more information about the
yc compute instance create
command, see the Yandex Cloud CLI reference. -
Use the create REST API method for the Instance resource or the InstanceService/Create gRPC API call, with the pool ID in the reservedInstancePoolId
field (for gRPC API, reserved_instance_pool_id
).
Attaching an existing VM to a reserved instance pool
To attach an existing VM to a reserved instance pool:
If you do not have the Yandex Cloud CLI installed yet, install and initialize it.
By default, the CLI uses the folder specified when creating the profile. To change the default folder, use the yc config set folder-id <folder_ID>
command. You can also set a different folder for any specific command using the --folder-name
or --folder-id
parameter.
-
See the description of the Yandex Cloud CLI command for updating a VM:
yc compute instance update --help
-
Get a list of reserved instance pools in the default folder:
yc compute reserved-instance-pool list
Result:
+----------------------+------------+---------------+------+ | ID | NAME | ZONE ID | SIZE | +----------------------+------------+---------------+------+ | fv48qa9iiq19******** | test-pool1 | ru-central1-a | 1 | | fv42fbsrso94******** | test-pool2 | ru-central1-a | 1 | +----------------------+------------+---------------+------+
-
Get a list of VMs in the default folder:
yc compute instance list
Result:
+----------------------+-----------------+---------------+---------+----------------------+ | ID | NAME | ZONE ID | STATUS | DESCRIPTION | +----------------------+-----------------+---------------+---------+----------------------+ | fhm0b28lgfp4******** | first-instance | ru-central1-a | RUNNING | my first vm via CLI | | fhm9gk85nj7g******** | second-instance | ru-central1-a | RUNNING | my second vm via CLI | +----------------------+-----------------+---------------+---------+----------------------+
-
Attach the VM of your choice to the reserved instance pool:
Note
You cannot attach a VM to a reserved instance pool if its hardware configuration (platform, vCPU, or RAM) is different from that specified in the reserved instance pool settings.
yc compute instance update \ --id <VM_ID> \ --reserved-instance-pool-id <pool_ID>
Where:
-
--id
: VM ID.Instead of the ID, you can specify the VM name in the
--name
parameter. -
--reserved-instance-pool-id
: ID of the pool you are attaching the VM to.Instead of ID, you can provide the pool's name in the
--reserved-instance-pool-name
parameter.
Result:
done (2s) id: fhm0b28lgfp4******** folder_id: b1gt6g8ht345******** created_at: "2025-05-07T09:46:04Z" name: first-instance zone_id: ru-central1-a platform_id: standard-v2 resources: memory: "2147483648" cores: "2" core_fraction: "100" status: RUNNING metadata_options: gce_http_endpoint: ENABLED aws_v1_http_endpoint: ENABLED gce_http_token: ENABLED aws_v1_http_token: DISABLED boot_disk: mode: READ_WRITE device_name: fv45psom2l6o******** auto_delete: true disk_id: fv45psom2l6o******** network_interfaces: - index: "0" mac_address: d0:0d:cb:b5:9e:bf subnet_id: fl8dmq91iruu******** primary_v4_address: address: 192.168.7.5 one_to_one_nat: address: 158.160.***.** ip_version: IPV4 serial_port_settings: ssh_authorization: OS_LOGIN gpu_settings: {} fqdn: fv4cndcunukt********.auto.internal scheduling_policy: {} network_settings: type: STANDARD placement_policy: {} hardware_generation: legacy_features: pci_topology: PCI_TOPOLOGY_V1 reserved_instance_pool_id: fv48qa9iiq19********
For more information about the
yc compute instance update
command, see the Yandex Cloud CLI reference. -
Use the update REST API method for the Instance resource or the InstanceService/Update gRPC API call, with the pool ID in the reservedInstancePoolId
field (for gRPC API, reserved_instance_pool_id
).
Detaching a VM from a reserved instance pool
To detach a VM from a reserved instance pool, proceed as follows:
If you do not have the Yandex Cloud CLI installed yet, install and initialize it.
By default, the CLI uses the folder specified when creating the profile. To change the default folder, use the yc config set folder-id <folder_ID>
command. You can also set a different folder for any specific command using the --folder-name
or --folder-id
parameter.
-
See the description of the Yandex Cloud CLI command for updating a VM:
yc compute instance update --help
-
Get a list of reserved instance pools in the default folder:
yc compute reserved-instance-pool list
Result:
+----------------------+------------+---------------+------+ | ID | NAME | ZONE ID | SIZE | +----------------------+------------+---------------+------+ | fv48qa9iiq19******** | test-pool1 | ru-central1-a | 1 | | fv42fbsrso94******** | test-pool2 | ru-central1-a | 1 | +----------------------+------------+---------------+------+
-
Get a list of VMs in the default folder:
yc compute instance list
Result:
+----------------------+-----------------+---------------+---------+----------------------+ | ID | NAME | ZONE ID | STATUS | DESCRIPTION | +----------------------+-----------------+---------------+---------+----------------------+ | fhm0b28lgfp4******** | first-instance | ru-central1-a | RUNNING | my first vm via CLI | | fhm9gk85nj7g******** | second-instance | ru-central1-a | RUNNING | my second vm via CLI | +----------------------+-----------------+---------------+---------+----------------------+
-
Detach the VM of your choice from the specified reserved instance pool:
yc compute instance update \ --id <VM_ID> \ --reserved-instance-pool-id ""
Where:
-
--id
: VM ID.Instead of the ID, you can specify the VM name in the
--name
parameter.
Result:
done (5s) id: fv4fjf9qbt57******** folder_id: b1gt6g8ht345******** created_at: "2025-05-07T07:46:34Z" name: first-instance zone_id: ru-central1-a platform_id: standard-v2 resources: memory: "2147483648" cores: "2" core_fraction: "100" status: RUNNING metadata_options: gce_http_endpoint: ENABLED aws_v1_http_endpoint: ENABLED gce_http_token: ENABLED aws_v1_http_token: DISABLED boot_disk: mode: READ_WRITE device_name: fv4v5k7u3g3n******** auto_delete: true disk_id: fv4v5k7u3g3n******** network_interfaces: - index: "0" mac_address: d0:0d:f9:bd:3a:5f subnet_id: fl8dmq91iruu******** primary_v4_address: address: 192.168.7.7 one_to_one_nat: address: 158.160.***.** ip_version: IPV4 serial_port_settings: ssh_authorization: OS_LOGIN gpu_settings: {} fqdn: fv4fjf9qbt57********.auto.internal scheduling_policy: {} network_settings: type: STANDARD placement_policy: {} hardware_generation: legacy_features: pci_topology: PCI_TOPOLOGY_V1
For more information about the
yc compute instance update
command, see the Yandex Cloud CLI reference. -
Use the update REST API method for the Instance resource or the InstanceService/Update gRPC API call, with an empty string in the reservedInstancePoolId
field (for gRPC API, reserved_instance_pool_id
).