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
    • 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 Virtual Private Cloud
  • Getting started
    • All guides
      • Creating a subnet
      • Deleting a subnet
      • Updating a subnet
      • Getting information about a subnet
      • Moving a subnet between folders
      • Moving a subnet to a different availability zone
      • Viewing a list of used addresses
    • Enabling a software-accelerated network
    • Chart of network connections
    • Viewing operations with resources
  • DDoS Protection
  • Access management
  • Terraform reference
  • Audit Trails events
  • Release notes
  • FAQ
  1. Step-by-step guides
  2. Subnet
  3. Moving a subnet to a different availability zone

Moving a subnet to a different availability zone

Written by
Yandex Cloud
Updated at May 5, 2025

You can move a subnet to a different availability zone. You can only move an empty subnet containing no VMs or other resources.

Make sure the subnet does not include addresses of target load balancer groups either. They prevent migration. Remove unused target groups or individual addresses.

To move a subnet to a different availability zone:

CLI
API

If you do not have the Yandex Cloud CLI yet, install and initialize it.

The folder specified when creating the CLI profile is used by default. To change the default folder, use the yc config set folder-id <folder_ID> command. You can specify a different folder using the --folder-name or --folder-id parameter.

  1. View the description of the CLI command for moving a subnet:

    yc vpc subnet relocate --help
    
  2. In the default folder, get the ID of the subnet you need to move:

    yc vpc subnet list
    

    Result:

    +----------------------+----------+----------------------+----------------+---------------+------------------+
    |          ID          |   NAME   |      NETWORK ID      | ROUTE TABLE ID |     ZONE      |      RANGE       |
    +----------------------+----------+----------------------+----------------+---------------+------------------+
    | e9bcd5mq43cn******** | subnet-a | encb4ubvmief******** |                | ru-central1-a | [10.1.0.0/16]    |
    | e2llon52hhss******** | subnet-b | enc39op1vq9m******** |                | ru-central1-b | [192.168.1.0/24] |
    +----------------------+----------+----------------------+----------------+---------------+------------------+
    

    Note

    Make sure a subnet you are moving has no VMs. If you need to move a subnet with VMs, first move all the VMs and then the subnet to a new availability zone.

  3. Move the subnet:

    yc vpc subnet relocate \
      --id <subnet_ID> \
      --destination-zone-id <availability_zone_ID>
    

    Where:

    • --id: ID of the subnet you need to move.

    • --destination-zone-id: ID of the availability zone to move the subnet to. The possible values are:

      • ru-central1-a
      • ru-central1-b
      • ru-central1-d

    Example:

    yc vpc subnet relocate \
      --id e9bcd5mq43cn******** \
      --destination-zone-id ru-central1-d
    

    Result:

    id: e9bcd5mq43cn********
    folder_id: b1gt6g8ht345********
    created_at: "2023-10-06T10:30:06Z"
    name: subnet-a
    network_id: encb4ubvmief********
    zone_id: ru-central1-d
    v4_cidr_blocks:
      - 10.1.0.0/16
    dhcp_options: {}
    

    For more information about the yc vpc subnet relocate command, see the CLI reference.

Use the relocate REST API method for the Subnet resource or the SubnetService/Relocate gRPC API call.

Request example

To run the example, install cURL.

  1. Get an IAM token for authentication with the API.

  2. Save the token to a variable:

    export IAM_TOKEN=<obtained_IAM_token>
    
  3. Create the body.json file with the request body, specifying the ID of the availability zone to move the subnet to:

    {
      "destinationZoneId": "<availability_zone_ID>"
    }
    
  4. Run this request:

    curl \
        --request POST \
        --header "Authorization: Bearer ${IAM_TOKEN}" \
        --data "@<request_body_file>" \
        https://vpc.api.cloud.yandex.net/vpc/v1/subnets/<subnet_ID>:relocate
    

    Where:

    • <request_body_file>: Path to the previously created request body file (body.json).
    • <subnet_ID>: ID of the subnet to move to a new availability zone.

    Note

    Make sure a subnet you are moving has no VMs. If you need to move a subnet with VMs, first move all the VMs and then the subnet to a new availability zone.

    Result:

    {
      "done": true,
      "metadata": {
        "@type": "type.googleapis.com/yandex.cloud.vpc.v1.RelocateSubnetMetadata",
        "subnetId": "b0cnd1srghnm********"
      },
      "response": {
        "@type": "type.googleapis.com/yandex.cloud.vpc.v1.Subnet",
        "v4CidrBlocks": [
          "192.168.3.0/24"
        ],
        "dhcpOptions": {},
        "id": "b0cnd1srghnm********",
        "folderId": "b1gt6g8ht345********",
        "createdAt": "2023-10-06T10:30:06Z",
        "name": "subnet-c",
        "networkId": "enpv51f8lple********",
        "zoneId": "ru-central1-d"
      },
      "id": "enpfitqeageu********",
      "description": "Relocate subnet to other zone",
      "createdAt": "2023-11-02T10:40:52.330608134Z",
      "createdBy": "ajeol2afu1js********",
      "modifiedAt": "2023-11-02T10:40:52.782965099Z"
    }
    

Was the article helpful?

Previous
Moving a subnet between folders
Next
Viewing a list of used addresses
© 2025 Direct Cursus Technology L.L.C.