Detach a backed up resource from a backup policy
To detach a backed up resource from a backup policy:
Note
Currently, you can detach an external protected resource from a backup policy using the Yandex Cloud CLI, API, or Terraform.
- In the management console
, select a folder where you want to unlink a backed up resource from a backup policy. - Navigate
to Cloud Backup. - Navigate to the
Backup policies tab. - Select the policy to unlink the resource from.
- Depending on the resource you want to unlink from the backup policy, under Attached resources, select the Virtual machines or BareMetal servers tab.
- In the row with the VM or server you want to unlink from the backup policy, click
and select Detach VM from policy or Detach server from policy, respectively. - In the window that opens, confirm this action.
If you do not have the Yandex Cloud CLI yet, install and initialize it.
The folder used by default is the one specified when creating the CLI profile. To change the default folder, use the yc config set folder-id <folder_ID> command. You can also specify a different folder for any command using --folder-name or --folder-id. If you access a resource by its name, the search will be limited to the default folder. If you access a resource by its ID, the search will be global, i.e., through all folders based on access permissions.
-
View a description of the CLI command to remove a backed up resource from a backup policy:
yc backup policy revoke --help -
Get the ID of the policy to unlink the resource from:
yc backup policy listResult:
+----------------------+----------------------+---------+---------+---------------------+---------------------+ | 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 | +----------------------+----------------------+---------+---------+---------------------+---------------------+ -
Get the ID of the resource you want to unlink:
yc backup vm listResult:
+----------------------+--------------------------------------+--------+---------+--------+-----------------+----------------+---------------------+---------------------+--------+---------------------+---------------------+-------------+ | INSTANCE ID | RESOURCE ID | ONLINE | ENABLED | STATUS | STATUS PROGRESS | STATUS DETAILS | LAST BACKUP TIME | NEXT BACKUP TIME | ACTIVE | CREATED AT | UPDATED AT | TYPE | +----------------------+--------------------------------------+--------+---------+--------+-----------------+----------------+---------------------+---------------------+--------+---------------------+---------------------+-------------+ | ly5mzirn6xhd******** | 4fc0d855-b76c-****-99a4-bf01******** | true | true | IDLE | 0 | | | | true | 2026-04-29 05:45:34 | 2026-04-29 05:54:21 | BMS | | epd930eo5156******** | 6c58577d-409d-****-bc10-f464******** | true | true | IDLE | 0 | | | | true | 2026-04-29 08:46:47 | 2026-04-29 08:54:00 | COMPUTE | | cdgd246kiae3******** | d1fdd342-0ea8-****-9906-fa6c******** | false | true | IDLE | 0 | | 2026-04-27 13:07:05 | 2026-04-27 13:07:05 | true | 2026-04-24 14:23:06 | 2026-04-29 08:54:33 | EXTERNAL_VM | +----------------------+--------------------------------------+--------+---------+--------+-----------------+----------------+---------------------+---------------------+--------+---------------------+---------------------+-------------+ -
Unlink the resource by specifying its policy ID:
yc backup policy revoke <policy_ID> \ --instance-ids <resource_IDs>Where
--instance-idsare the IDs of the Compute Cloud VMs, BareMetal servers, or external resources which you need to unlink from the backup policy. Multiple IDs should be comma-separated.
For more information about this command, see the CLI reference.
With Terraform
Terraform is distributed under the Business Source License
For more information about the provider resources, see the guides on the Terraform
If you do not have Terraform yet, install it and configure the Yandex Cloud provider.
To manage infrastructure using Terraform under a service account or user accounts (a Yandex account, a federated account, or a local user), authenticate using the appropriate method.
To detach a backed up resource from a backup policy:
-
Delete the section describing the binding of the protected resource to the policy you want to delete from the Terraform configuration file:
resource "yandex_backup_policy_bindings" "test_backup_binding" { instance_id = "<resource_ID>" policy_id = "<policy_ID>" }Where:
instance_id: ID of the protected resource that you want to detach from the policy.policy_id: ID of the backup policy from which you want to detach the protected resource.
For more information about
yandex_backup_policy_bindingsproperties, see this provider guide. -
Create the resources:
-
In the terminal, navigate to the configuration file directory.
-
Make sure the configuration is correct using this command:
terraform validateIf the configuration is valid, you will get this message:
Success! The configuration is valid. -
Run this command:
terraform planYou will see a list of resources and their properties. No changes will be made at this step. Terraform will show any errors in the configuration.
-
Apply the configuration changes:
terraform apply -
Type
yesand 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 revoke REST API method for the Policy resource or the PolicyService/Revoke gRPC API call.