Deleting all backups of a resource
If you need to delete all backups of a Compute Cloud VM, BareMetal server, or external resource, a faster and more effective way is to delete them together as a single archive rather than separately. This way, you can save time and avoid possible errors.
To delete the backup archive for a backed up resource:
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.
-
See the description of the CLI command for deleting a backup archive:
yc backup backup batch-delete --help -
Get a list of all backup archives in the default folder:
yc backup backup list-archivesResult:
+--------------------------------------+-------------+----------------------+--------------------------------------------------------------------------------------+--------+---------------------+---------------------+------------------------+ | ID | RESOURCE ID | INSTANCE ID | NAME | SIZE | CREATED AT | UPDATED AT | LAST BACKUP CREATED AT | +--------------------------------------+-------------+----------------------+--------------------------------------------------------------------------------------+--------+---------------------+---------------------+------------------------+ | d8322308-fc11-833a-6b52-ca63******** | | epd73glhmkr0******** | second-vm-579CFEB6-A557-4922-AACD-697FADED0529-40DC750F-057C-41FD-8AAE-D485A******** | 6.0 GB | 2025-03-02 15:33:44 | 0001-01-01 00:00:00 | 2025-03-02 16:07:13 | | 4508faa1-3372-542e-f73a-cccf******** | | epdolbm6ijmt******** | backup-vm-579CFEB6-A557-4922-AACD-697FADED0529-86A93494-96F7-4168-A44C-0A969******** | 9.3 GB | 2025-03-02 14:13:46 | 0001-01-01 00:00:00 | 2025-03-02 16:07:16 | +--------------------------------------+-------------+----------------------+--------------------------------------------------------------------------------------+--------+---------------------+---------------------+------------------------+Note
You can request a list of backup archives for a specific backed up resource:
yc backup backup list-archives \ --instance-id <resource_ID>However, this command will only provide an output if the resource you specified has not been deleted, i.e., it is still there and connected to Cloud Backup.
-
Delete the backup archive:
-
You can delete the archive by specifying its ID:
yc backup backup batch-delete \ --archive-id <archive_ID>Where
--archive-idis the ID of the backup archive you need to delete. -
You can delete the archive by specifying the IDs of the backed up resource and its backup policy:
yc backup backup batch-delete \ --instance-id <resource_ID> \ --policy-id <policy_ID>Where:
--instance-id: ID of the Compute Cloud VM, BareMetal server, or external resource whose backups you need to delete. When using the--instance-idparameter, you must specify the--policy-idparameter as well.--policy-id: ID of the backup policy on which the backups you need to delete were based. When using the--policy-idparameter, you must specify the--instance-idparameter as well.
-
The archive deletion will remove all resource backups stored in that archive.
Note
If the resource backups were based on a variety of backup policies, you also need to delete other archives associated with that resource and created under such policies.