Yandex Cloud
Search
Contact UsTry it for free
  • Customer Stories
  • Documentation
  • Blog
  • All Services
  • System Status
  • Marketplace
    • Featured
    • Infrastructure & Network
    • Data Platform
    • AI for business
    • Security
    • DevOps tools
    • Serverless
    • Monitoring & Resources
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Start testing with double trial credits
    • Cloud credits to scale your IT product
    • Gateway to Russia
    • Cloud for Startups
    • Center for Technologies and Society
    • Yandex Cloud Partner program
    • Price calculator
    • Pricing plans
  • Customer Stories
  • Documentation
  • Blog
© 2026 Direct Cursus Technology L.L.C.
Yandex Cloud Backup
    • All guides
    • Activating the service
      • Creating a policy
      • Updating a policy
      • Linking a VM or BareMetal server to a policy
      • Getting information about a policy
      • Unlinking a VM or BareMetal server from a policy
      • Deleting a policy
    • Viewing service resource operations
    • Limiting RAM usage by the Cloud Backup agent
    • Viewing backup statistics
  • Access management
  • Pricing policy
  • Terraform reference
  • Monitoring metrics
  • Audit Trails events
  • Release notes
  • Troubleshooting
  1. Step-by-step guides
  2. Backup policies
  3. Linking a VM or BareMetal server to a policy

Linking a VM or Yandex BareMetal server to a backup policy

Written by
Yandex Cloud
Updated at January 13, 2026

You can only link a VM or BareMetal server to a backup policy if they are connected to Yandex Cloud Backup. For more information, see Managing VMs in Cloud Backup and Managing BareMetal servers in Cloud Backup.

Management console
CLI
Terraform
API
  1. In the management console, select a folder where you want to link a VM or BareMetal server to a backup policy.

  2. Go to Cloud Backup.

  3. Navigate to the Backup policies tab.

  4. Select the policy to link the VM or BareMetal server to.

  5. Under Attached resources, click Attach a VM, and in the window that opens:

    1. Depending on the resource you want to link to the backup policy, select the Virtual machines or BareMetal servers tab and select the VM or server from the list.

      If the VM or BareMetal server you want to link to the backup policy is not listed, make sure it is connected to Cloud Backup.

    2. Click Attach.

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.

  1. View the description of the CLI command to link a VM or BareMetal server to a backup policy:

    yc backup policy apply --help
    
  2. Get the ID of the policy to link the VM or BareMetal server to:

    yc backup policy list
    

    Result:

    +----------------------+----------------------+---------+---------+---------------------+---------------------+
    |          ID          |      FOLDER ID       |  NAME   | ENABLED |     CREATED AT      |     UPDATED AT      |
    +----------------------+----------------------+---------+---------+---------------------+---------------------+
    | abc7n3wln123******** | ghi681qpe789******** | policy1 | true    | 2023-07-03 09:12:02 | 2023-07-03 09:12:43 |
    | deflqbiwc456******** | ghi681qpe789******** | policy2 | true    | 2023-07-07 14:58:23 | 2023-07-07 14:58:23 |
    +----------------------+----------------------+---------+---------+---------------------+---------------------+
    
  3. Get the ID of the VM to link:

    yc compute instance list
    

    Result:

    +----------------------+---------+---------------+---------+--------------+-------------+
    |          ID          |  NAME   |    ZONE ID    | STATUS  | EXTERNAL IP  | INTERNAL IP |
    +----------------------+---------+---------------+---------+--------------+-------------+
    | jklp0o9i8012******** | my-vm-1 | ru-central1-b | RUNNING | 51.250.**.** | 192.168.*.* |
    | mnoa5s6d8345******** | my-vm-2 | ru-central1-b | RUNNING | 84.201.**.** | 192.168.*.* |
    +----------------------+---------+---------------+---------+--------------+-------------+
    

    To get the BareMetal server IDs, select BareMetal from the list of services of the relevant folder in the management console. The IDs are specified in the server list in the ID field.

  4. Link the VM or BareMetal server by the policy ID:

    yc backup policy apply <policy_ID> \
      --instance-ids <VM_or_BareMetal_server_IDs>
    

    Where --instance-ids are the IDs of the VMs or BareMetal servers connected to Cloud Backup you need to link to the backup policy. Multiple IDs should be comma-separated.

For more information about this command, see the CLI reference.

With Terraform, you can quickly create a cloud infrastructure in Yandex Cloud and manage it using configuration files. These files store the infrastructure description written in HashiCorp Configuration Language (HCL). If you change the configuration files, Terraform automatically detects which part of your configuration is already deployed, and what should be added or removed.

Terraform is distributed under the Business Source License. The Yandex Cloud provider for Terraform is distributed under the MPL-2.0 license.

For more information about the provider resources, see the relevant documentation on the Terraform website or its mirror.

If you do not have Terraform yet, install it and configure the Yandex Cloud provider.

Note

Currently, you can only associate a Compute Cloud VM instance with a backup policy using Terraform. To associate a BareMetal server, use the management console, Yandex Cloud CLI, or API.

To associate a VM with a backup policy:

  1. In the Terraform configuration file, describe the parameters for associating the VM with the policy:

    resource "yandex_backup_policy_bindings" "test_backup_binding" {
      instance_id = "<VM_ID>"
      policy_id   = "<policy_ID>"
    }
    

    Where:

    • instance_id: ID of the VM you want to associate with the policy.
    • policy_id: ID of the policy to associate the VM with.

    For more information about yandex_backup_policy_bindings properties, see the relevant provider documentation.

  2. Create the resources:

    1. In the terminal, go to the directory where you edited the configuration file.

    2. Make sure the configuration file is correct using this command:

      terraform validate
      

      If the configuration is correct, you will get this message:

      Success! The configuration is valid.
      
    3. Run this command:

      terraform plan
      

      You will see a detailed list of resources. No changes will be made at this step. If the configuration contains any errors, Terraform will show them.

    4. Apply the changes:

      terraform apply
      
    5. Type yes and press Enter to confirm the changes.

    Terraform will create all the required resources. You can check the new resources using the management console or this CLI command:

     yc backup policy list-applications
    

Use the apply REST API method for the Policy resource or the PolicyService/Apply gRPC API call.

See alsoSee also

  • Creating a Linux VM with a connection to Cloud Backup
  • Creating a Windows Server VM with a connection to Cloud Backup
  • Creating a backup policy
  • Unlinking a VM or Yandex BareMetal server from a backup policy
  • Connecting Compute Cloud VMs and Yandex BareMetal servers to Cloud Backup
  • Backup policies

Was the article helpful?

Previous
Updating a policy
Next
Getting information about a policy
© 2026 Direct Cursus Technology L.L.C.