Yandex Cloud
Search
Contact UsGet started
  • Blog
  • Pricing
  • Documentation
  • All Services
  • System Status
    • Featured
    • Infrastructure & Network
    • Data Platform
    • Containers
    • Developer tools
    • Serverless
    • Security
    • Monitoring & Resources
    • ML & AI
    • Business tools
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Customer Stories
    • Start testing with double trial credits
    • Cloud credits to scale your IT product
    • Gateway to Russia
    • Cloud for Startups
    • Education and Science
    • Yandex Cloud Partner program
  • Blog
  • Pricing
  • Documentation
© 2025 Direct Cursus Technology L.L.C.
Yandex Compute Cloud
  • Yandex Container Solution
    • Resource relationships
    • Graphics processing units (GPUs)
    • Images
      • Overview
      • Access
      • YAML specification
      • Instance template
      • Variables in an instance template
        • Overview
        • Allocation policy
        • Deployment policy
        • Scaling policy
        • Recovery policy
      • Scaling types
      • Instance health checks and automatic recovery
      • Integrating with network and L7 load balancers
      • Handling a stateful workload
      • Stopping and pausing an instance group
      • Sequentially restarting and recreating instances in a group
      • Statuses
    • Dedicated host
    • Encryption
    • Backups
    • Quotas and limits
  • Access management
  • Terraform reference
  • Monitoring metrics
  • Audit Trails events
  • Release notes

In this article:

  • Tags
  • Specification
  • Example
  • Use cases
  • See also
  1. Concepts
  2. Instance groups
  3. Policies
  4. Allocation policy

Allocation policy

Written by
Yandex Cloud
Updated at April 18, 2025
  • Tags
  • Specification
    • Example
  • Use cases
    • See also

When creating an instance group, you can choose the Yandex Cloud availability zones to host your VM instances and list tags for VM instances within each availability zone.

You cannot directly migrate VM instances to other availability zones; however, you can update a group with new zone values.

TagsTags

Tags are used for logical labeling of VM instances within an availability zone. You can provide a list of tags to an instance group using a YAML specification. After you do that, each VM instance in the availability zone will get a unique tag from the list.

Using tags, you can ensure more granular declarative management of instances in the group. You can use tags as system variables, such as in a VM name. If you remove a tag from the list in the YAML specification, applying the configuration will also remove the instance labeled with this tag from the group. This will not change the group size, as a new instance will be created with the next available tag from the list. Tags also help keep the configuration defined when resizing the group: each VM instance will be assigned sequential tags from the list based on the number of VM instances in the availability zone.

You can also use tags in variables to create instance groups with fixed IP addresses.

SpecificationSpecification

The allocation policy is set in the allocation-policy key in the YAML specification. Availability zones are listed in the zones key, and tags, in the instance_tags_pool key. You can specify any available zones: instances in the group will be evenly distributed across them.

Here is an example of a YAML specification entry:

...
allocation_policy:
  zones:
    - zone_id: ru-central1-a
      instance_tags_pool:
      - first-tag
      - second-tag
    - zone_id: ru-central1-b
      instance_tags_pool:
      - third-tag
      - fourth-tag
    - zone_id: ru-central1-d
      instance_tags_pool:
      - fifth-tag
      - sixth-tag
...

Where:

Key Value
zones List of zones. Each zone is represented in the zone_id key by a key:value pair.
zone_id Zone ID
instance_tags_pool (Optional) List of group instance tags.
Restrictions:
  • The number of tags cannot be less than the size key value in the scale_policy section for fixed-size instance groups and the max_size key value in the scale_policy section for automatically scaled instance groups.
  • Tags must be unique for the entire group and not just within a single zone.
  • A tag must be from 3 to 50 characters long.
  • It may contain lowercase Latin letters, numbers, hyphens, and underscores.

ExampleExample

In the example, a YAML specification describes a fixed-size instance group. The instances are hosted in the same availability zone and their names include tags from the instance_tags_pool list.

name: first-fixed-group
service_account_id: ajeujptarqa4********
description: "This instance group was created from YAML config."
instance_template:
  name: production-{instance.tag}
  platform_id: standard-v3
  resources_spec:
    memory: 2g
    cores: 2
  boot_disk_spec:
    mode: READ_WRITE
    disk_spec:
      image_id: fd8v80pep5m9********
      type_id: network-hdd
      size: 5g
  network_interface_specs:
    - network_id: enpgf5vu9dd7********
      primary_v4_address_spec: {}
  scheduling_policy:
    preemptible: false
deploy_policy:
  max_unavailable: 1
  max_expansion: 0
scale_policy:
  fixed_scale:
    size: 3
allocation_policy:
  zones:
    - zone_id: ru-central1-a
      instance_tags_pool:
      - first
      - second
      - third

Use casesUse cases

  • Running an autoscaling instance group
  • Autoscaling an instance group to process messages in Yandex Message Queue

See alsoSee also

  • Recovery policy
  • Scaling policy
  • Deployment policy
  • Creating a group of instances with fixed IP addresses

Was the article helpful?

Previous
Overview
Next
Deployment policy
© 2025 Direct Cursus Technology L.L.C.