This page describes how to back up virtual machines (VMs) while adhering to GDC backup and restore principles. It also contains instructions on how to view a list of VM backups, and delete existing VM backups.
Before you begin
Before backing up VMs, you must already have a backup repository and backup plan.
Manually back up VMs
A manual backup must reference an existing backup plan for the backup configuration.
To get the permissions you need to create a manual backup, ask your Project IAM Admin to grant you the following roles:
- Project VM Admin (
project-vm-admin
) - Backup Creator (
backup-creator
) - Project Viewer (
project-viewer
)
Back up VMs using either the GDC console or the API.
Console
- Sign into the GDC console.
- In the navigation menu, click Backup for Virtual Machines.
- Select a project.
- Click the Backups tab.
- Click Create a backup.
- In the Source VM instance field, select the VM that you want to back up.
- Enter a Name for the backup.
- In the Backup plan field, select the backup plan for which you want to to create a backup.
- Click Create.
API
Issue a virtual machine backup request to initiate a backup:
apiVersion: virtualmachine.gdc.goog/v1
kind: VirtualMachineBackupRequest
metadata:
name: BACKUP_REQUEST_NAME
spec:
virtualMachineBackupPlanTemplate: VM_BACKUP_PLAN
virtualMachine: VM_NAME
virtualMachineBackupName: VM_BACKUP_NAME
Replace the following:
BACKUP_REQUEST_NAME
: name to give the backup request that is being initiated.VM_BACKUP_PLAN
: the name of theVirtualMachineBackupPlanTemplate
resource to use for configuration of the backup.VM_NAME
: the name of the VM to back up.VM_BACKUP_NAME
: the name of the backup to create.
View VM backups
View a list of VM backups using the GDC console or kubectl
.
Console
- Sign into the GDC console.
- In the navigation menu, click Backup for Virtual Machines.
- Select a project.
- Click the Backups tab.
- Click a backup in the list to view its details.
kubectl
View a VM backup by listing the backups and viewing their details.
List the existing backups:
kubectl get virtualmachinebackups.virtualmachine.gdc.goog -n PROJECT_NAME
Replace
PROJECT_NAME
with the name of the project.In the list, find the backup that you want to view.
View the backup details:
kubectl describe virtualmachinebackup.virtualmachine.gdc.goog VM_BACKUP_NAME -n PROJECT_NAME
Replace the following:
VM_BACKUP_NAME
: the name of the backup.PROJECT_NAME
: the name of the project.
Delete a VM backup
Delete VM backups by using the GDC console or kubectl
.
Console
- Sign in to the GDC console.
- In the navigation menu, click Backup for Virtual Machines.
- Select a project.
- Click the Backups tab.
- In the list of backups, find the backup to delete and click Delete Backup.
- In the Backup name field, enter the name of the backup to delete.
- Click Delete Backup.
kubectl
Delete a VM backup using kubectl
.
List the existing VM backups:
kubectl get virtualmachinebackups.virtualmachine.gdc.goog -n PROJECT_NAME
Replace
PROJECT_NAME
with the name of the project.In the list, find the backup that you want to delete.
Issue a
VirtualMachineDeleteBackupRequest
to delete the backup:apiVersion: virtualmachine.gdc.goog/v1 kind: VirtualMachineDeleteBackupRequest metadata: name: DELETE_BACKUP_REQUEST_NAME namespace: PROJECT_NAME spec: virtualMachineBackupRef: name: VM_BACKUP_NAME
Replace the following:
DELETE_BACKUP_REQUEST_NAME
: the name to give theVirtualMachineDeleteBackupRequest
that is being initiated.VM_BACKUP_NAME
: the name of the backup to delete.PROJECT_NAME
: the name of the project.