Instance template

When creating a group, you need to describe an instance template, which is the basic instance configuration used for deploying all the instances in the group.

The template description and policy description are passed to the CLI in a YAML file when creating or updating an instance group with the --file flag. This is convenient for passing values that consist of multiple strings. For more information, see Create a fixed-size instance group.

Computing resources

When describing a template, you specify the computing resources to allocate to each instance: the number and guaranteed performance of processor cores (vCPUs) and the amount of RAM. You can choose the computing resources that are appropriate for the expected load. For more information, see Levels of core performance.

Disks

At least one disk must be attached to each instance: the boot disk. Each boot disk is created automatically and attached to only one instance when creating an instance group.

You can also attach additional disks to each instance. You can create an additional disk along with an instance group. The new disk can be empty, or you can restore it from a snapshot or image. You can only attach or detach additional disks when creating or updating a group. For more information, see Disks.

Warning

When you delete a VM, its disks are deleted from the group. VMs can be deleted during the scaling and automatic recovery process.

Network

When creating a group, you can:

  • Set the network for the group itself.
  • Set subnets for each instance in the group.

You can create a group without specifying any subnets for its instances if the availability zone selected for each instance contains exactly one subnet for the specified network.

You can also configure a public IP address for each instance. This allows the instance to interact with other services over the internet. For more information, see Network on a VM.

Template description in a YAML file

A template describes the configuration of the base instance. It is defined in the instance_template key in a YAML file.

Example of a YAML file entry:

...
instance_template:
    platform_id: standard-v1
    resources_spec:
        memory: 4g
        cores: 1
        core_fraction: 5
    boot_disk_spec:
        mode: READ_WRITE
        disk_spec:
            image_id: fdvk34al8k5nltb58shr
            type_id: network-hdd
            size: 32g
    secondary_disk_specs:
        mode: READ_WRITE
        disk_spec:
            image_id: fdvk34al8k5nltb58shr
            type_id: network-hdd
            size: 32g
    network_interface_specs:
        - network_id: c64mknqgnd8avp6edhbt
          subnet_ids:
              - blt022m2diah5j3rcj8v
          primary_v4_address_spec: {
              one_to_one_nat_spec: {
                  ip_version: IPV4
              }
          }
...

The disk size is specified in bytes by default. You can specify a different unit of measurement using the applicable suffix.

Name Example of a YAML file entry:
Kilobyte 1073741824k
Megabyte 1048576m
Gigabyte 1024g
Terabyte 1t

Keys (the table lists keys that directly define the base instance's configuration):

Key Value
platform_id ID of the instance's hardware platform.
memory The amount of RAM available to the instance, specified in bytes. The maximum value is 274877906944 (275 GB).
cores The number of cores available to the instance. The value must be equal to 1, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, or 32.
core_fraction Base CPU performance. The value must be 0, 5, or 100.
mode Disk access mode.
- READ_ONLY: read-only access.
- READ_WRITE: read/write access.
image_id ID of the image that will be used for disk creation.
type_id ID of the disk type. To get a list of available disk types, use the yandex.cloud.compute.v1.diskTypes request.
size Size of the disk, specified in bytes. Acceptable values are in the range from 4194304 (4 MB) to 4398046511104 (4 TB).
network_id ID of the network.
subnet_ids IDs of cloud subnets.
ip_version IP version for the public IP address.

For information about the technical restrictions of Instance Groups, see Quotas and limits.