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 Compute Cloud
    • All guides
      • Stopping and starting a VM
      • Resetting a Windows Server VM user password
      • Attaching a disk to a VM
      • Detaching a disk from a VM
      • Moving a VM to a different availability zone
      • Moving a VM to a different folder
      • Moving a VM to a different cloud
      • Adding another network interface to a VM
      • Deleting a network interface from a VM
      • Assigning a public IP address to a VM
      • Unassigning a public IP address from a VM
      • Making a VM public IP address static
      • Reassigning a public IP address from one VM to another
      • Updating the VM internal IP address
      • Updating a VM
      • Changing VM computing resources
      • Changing VM security groups
      • VM maintenance policy management
      • Configuring VM access permissions
      • Linking a service account to a VM
      • Deleting a VM
    • Viewing operations with resources
  • Yandex Container Solution
  • Access management
  • Terraform reference
  • Monitoring metrics
  • Audit Trails events
  • Release notes

In this article:

  • Limitations
  • Moving a VM
  • Updating a VM folder
  • Updating a VM subnet
  1. Step-by-step guides
  2. Managing a VM
  3. Moving a VM to a different folder

Moving a VM to a different folder

Written by
Yandex Cloud
Updated at May 5, 2025
  • Limitations
  • Moving a VM
    • Updating a VM folder
    • Updating a VM subnet

When you create a VM, it is placed in the current folder.

In Yandex Cloud, you can move a VM to a different folder within a single cloud. You do not have to stop the VM to move it.

Learn more about the Yandex Cloud resource hierarchy here.

LimitationsLimitations

When moving a VM, keep in mind the following limitations:

  • Yandex Monitoring does not support metric relocation: existing metrics remain in the source folder, and new ones will be created in the destination folder.
  • You can only move VMs within a single cloud.

Moving a VMMoving a VM

Updating a VM folderUpdating a VM folder

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. Get a list of all 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 |
    +----------------------+-----------------+---------------+---------+----------------------+
    
  2. Get a list of all folders in the default cloud:

    yc resource-manager folder list
    

    Result:

    +----------------------+--------------------+------------------+--------+
    |          ID          |        NAME        |      LABELS      | STATUS |
    +----------------------+--------------------+------------------+--------+
    | b1gd129pp9ha******** | my-folder          |                  | ACTIVE |
    | b1g66mft1vop******** | default            |                  | ACTIVE |
    +----------------------+--------------------+------------------+--------+
    
  3. See the description of the CLI command for moving a VM:

    yc compute instance move --help
    
  4. Move the VM to a different folder with the following parameters:

    • In id, enter the VM ID, e.g., fhm0b28lgfp4********.
    • In destination-folder-id, specify the destination folder ID, e.g., b1gd129pp9ha********.
    yc compute instance move \
      --id fhm0b28lgfp4******** \
      --destination-folder-id b1gd129pp9ha********
    

    For more information about the yc compute instance move command, see the CLI reference.

Use the move REST API method for the Instance resource or the InstanceService/Move gRPC API call.

Example

Below is an example of a Bash script for Linux.

To use it, get authenticated with the API and install cURL.

You can move a VM without stopping it.

  1. Create a script file:

    sudo touch <file_name>
    
  2. Open the file to write the script to:

    sudo nano <file_name>
    
  3. Place the script in the file:

    #!/bin/bash
    
    # Creating variables
    
    export IAM_TOKEN=`yc iam create-token`
    
    instanceId='<VM_ID>'
    bootDiskId='<VM_boot_disk_ID>'
    destinationFolderId='<folder_ID>'
    
    # Moving a VM
    
    curl \
      --request POST \
      --header "Authorization: Bearer ${IAM_TOKEN}" \
      --data '{ "destinationFolderId": "'"${destinationFolderId}"'" }' \
      "https://compute.api.cloud.yandex.net/compute/v1/instances/{${instanceId}}:move"
    
    # Moving a boot disk
    
    curl \
      --request POST \
      --header "Authorization: Bearer ${IAM_TOKEN}" \
      --data '{ "destinationFolderId": "'"${destinationFolderId}"'" }' \
      "https://compute.api.cloud.yandex.net/compute/v1/disks/{${bootDiskId}}:move"
    

    Where:

    • IAM_TOKEN: IAM token for API authentication.
    • instanceId: ID of the VM to move.
    • bootDiskId: ID of the boot disk of the VM to move.
    • destinationFolderId: ID of the folder to move the VM to.
  4. Make the file executable:

    chmod +x <file_name>
    
  5. Run the script:

    ./<file_name>
    

Updating a VM subnetUpdating a VM subnet

After moving a VM, its network interfaces remain connected to the subnets in the source folder. To connect your VM to subnets in the destination folder, follow these steps:

Management console
CLI
API
  1. In the management console, select the folder you moved the VM to.
  2. Select Compute Cloud.
  3. Click the VM name.
  4. Click Stop.
  5. In the window that opens, click Stop.
  6. Under Network, click in the top-right corner of the relevant network interface section and select Edit.
  7. In the Subnet field, select a new subnet and click Save.
    If a VM has multiple network interfaces, update the subnet for each one.
  8. Click Start.

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. See the description of the CLI command for updating a subnet:

    yc compute instance update-network-interface --help
    
  2. Stop the VM:

    yc compute instance stop fhm0b28lgfp4********
    
  3. Get a list of VM network interfaces by specifying the VM ID:

    yc compute instance get fhm0b28lgfp4********
    

    Result:

    ...
    network_interfaces:
      - index: "0"
        mac_address: d0:0d:24:**:**:**
        subnet_id: e2lpp96bvvgp********
        primary_v4_address:
          address: 192.168.2.23
      - index: "1"
        mac_address: d0:1d:24:**:**:**
        subnet_id: e2lrucutusnd********
        primary_v4_address:
          address: 192.168.1.32
      - index: "2"
        mac_address: d0:2d:24:**:**:**
        subnet_id: e2lv9c6aek1d********
        primary_v4_address:
          address: 192.168.4.26
    ...
    

    Save the index field value, i.e., the number of the network interface you want to connect to a different subnet.

  4. Run this command:

    yc compute instance update-network-interface fhm0b28lgfp4******** \
      --subnet-id e2lfibapq818******** \
      --ipv4-address auto \
      --network-interface-index 0 \
      --security-group-id enpi8m85mj14********
    

    Where:

    • --subnet-id: Subnet in the destination folder.
    • --ipv4-address: Internal IP address of the VM network interface in the subnet in the destination folder. Set to auto to enable automatic internal address assignment.
    • --network-interface-index: VM network interface number you saved earlier.
    • --security-group-id: ID of the security group to assign to the VM network interface.

    Result:

    done (9s)
    id: fhm0b28lgfp4********
    folder_id: b1gd73mbrli7********
    created_at: "2023-11-16T06:09:46Z"
    name: oslogigor1
    zone_id: ru-central1-a
    platform_id: standard-v3
    resources:
      memory: "2147483648"
      cores: "2"
      core_fraction: "100"
    status: STOPPED
    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: epdophaf2gh9********
      auto_delete: true
      disk_id: epdophaf2gh9********
    network_interfaces:
      - index: "0"
        mac_address: d0:0d:24:**:**:**
        subnet_id: e2lfibapq818********
        primary_v4_address:
          address: 10.129.0.22
        security_group_ids:
          - enpi8m85mj14********
      - index: "1"
        mac_address: d0:1d:24:**:**:**
        subnet_id: e2lrucutusnd********
        primary_v4_address:
          address: 192.168.1.32
      - index: "2"
        mac_address: d0:2d:24:**:**:**
        subnet_id: e2lv9c6aek1d********
        primary_v4_address:
          address: 192.168.4.26
    gpu_settings: {}
    fqdn: relocated-vm.ru-central1.internal
    scheduling_policy: {}
    network_settings:
    type: STANDARD
    placement_policy: {}
    

    If a VM has multiple network interfaces, update the subnet for each one.

  5. Run the VM:

    yc compute instance start fhm0b28lgfp4********
    

Use the updateNetworkInterface REST API method for the Instance resource or the InstanceService/UpdateNetworkInterface gRPC API call.

Was the article helpful?

Previous
Moving a VM to a different availability zone
Next
Moving a VM to a different cloud
© 2025 Direct Cursus Technology L.L.C.