This document provides an overview of virtual machine (VM) backup and restore
operations in Google Distributed Cloud (GDC) air-gapped environments. It outlines the
different methodologies and the distinction between GDC console and API
capabilities.

This document is for developers in platform administrator or application operator
groups that manage VM backup operations. For more information, see
[Audiences for GDC air-gapped documentation](https://docs.cloud.google.com/distributed-cloud/hosted/docs/latest/gdcag/resources/audiences.md.txt).

GDC supports the ability to back up and restore
VM-based and container-based workloads. GDC VM backup
supports the backup and restoration of multiple VM or VM disk snapshots.
Backups are managed through backup plans, which let you schedule regular
backups or create backups manually. You can restore entire VMs, creating a new
instance with the same configuration and disk state as the backup, or restore
disk snapshots.

GDC backup for VMs offer the following features:

- Support for different VM instance configurations and sizes.
- Customer data stored in primary storage in the form of Kubernetes persistent volumes and VM disk images.
- Local snapshots for VM disks.

## Backup and restoration process

You can back up and restore your Distributed Cloud data in the GDC console or
the API.

To back up and restore VM and container workloads, follow these general steps:

1. [Create a backup repository](https://docs.cloud.google.com/distributed-cloud/hosted/docs/latest/gdcag/platform-application/pa-ao-operations/vm-backup/backup-repository/create-backup-repository.md.txt).
2. Create a backup plan that references the backup repository:
   - Either let the backup plan automatically [create scheduled backups](https://docs.cloud.google.com/distributed-cloud/hosted/docs/latest/gdcag/platform-application/pa-ao-operations/vm-backup/backup-plans/create-scheduled-backup-plan.md.txt) or [manually create a backup](https://docs.cloud.google.com/distributed-cloud/hosted/docs/latest/gdcag/platform-application/pa-ao-operations/vm-backup/backup-plans/create-manual-backup.md.txt).
3. [Back up VMs](https://docs.cloud.google.com/distributed-cloud/hosted/docs/latest/gdcag/platform-application/pa-ao-operations/vm-backup/backup-plans/manage-backups.md.txt) or [back up disks](https://docs.cloud.google.com/distributed-cloud/hosted/docs/latest/gdcag/platform-application/pa-ao-operations/vm-backup/backup-plans/manage-backups.md.txt) in the form of snapshots.
4. [Restore VMs or snapshots](https://docs.cloud.google.com/distributed-cloud/hosted/docs/latest/gdcag/platform-application/pa-ao-operations/vm-backup/restore-backup/restore-from-a-snapshot.md.txt) based on the backups.

## Backup repository overview

Before you create backups or snapshots, you must create a backup
repository. A backup repository contains configuration information, for example,
the bucket name, region, and storage endpoint. The backup repository name is
provided as an input parameter when you create a VM backup plan.

For more information, see
[Create a backup repository](https://docs.cloud.google.com/distributed-cloud/hosted/docs/latest/gdcag/platform-application/pa-ao-operations/vm-backup/backup-repository/create-backup-repository.md.txt).

## VM backup resources

The VM backup system in GDC consists of
these key custom resources (CRs):

- `BackupRepository`: The location where the backup data is stored. This resource is manageable through the API and the GDC console.
- `VirtualMachineBackupPlanTemplate`: Defines the backup repository used. This resource is manageable through the API and the GDC console
- `VirtualMachineBackupPlan`: Defines a scheduled, recurring backup strategy. This resource specifies the backup schedule, the scope of VMs to be backed up, and the retention policy for the backups. This resource is only manageable through the API.
- `VirtualMachineBackupRequest`: Triggers an immediate backup. This resource can be used for both one-off manual backups and to manually initiate a backup defined in a `VirtualMachineBackupPlan`. This resource is manageable through the API and the GDC console, but you can only trigger a backup plan using the API.
- `VirtualMachineRestoreRequest`: Restores a VM from a backup. This resource is manageable through the API and the GDC console.

## Plan backups

You can create a backup plan and perform backup and restore functions using either
the API or the GDC console. All backup methods are supported through
the API, while on-demand, manual backups are the only backup types the GDC console
supports.

### Scheduled backups (API only)

This method involves the creation of a `VirtualMachineBackupPlan` resource,
which references a `VirtualMachineBackupPlanTemplate`. You can define a
recurring backup schedule, the scope of VMs to include, and a retention policy.

For more details, see [Create a scheduled backup plan to back up and restore VMs](https://docs.cloud.google.com/distributed-cloud/hosted/docs/latest/gdcag/platform-application/pa-ao-operations/vm-backup/backup-plans/create-scheduled-backup-plan.md.txt).

### On-demand backups (GDC console and API)

This method uses a `VirtualMachineBackupRequest` resource that directly references
a `VirtualMachineBackupPlanTemplate`. You can perform a one-time backup of a
specific VM or VM disk. For more details, see [Create a manual backup](https://docs.cloud.google.com/distributed-cloud/hosted/docs/latest/gdcag/platform-application/pa-ao-operations/vm-backup/backup-plans/create-manual-backup.md.txt).

> [!NOTE]
> **Note:** On-demand backups are the only backup method supported through the GDC console.

### Manual trigger of a defined backup plan (GDC console and API)

This method uses a `VirtualMachineBackupRequest` resource that references an existing
`VirtualMachineBackupPlan`. It immediately triggers a backup of all VMs defined
in the scope of the referenced plan. This backup method is useful for taking an
ad hoc backup of a group of VMs that are part of a scheduled plan.

For more information, see [Create a manual backup](https://docs.cloud.google.com/distributed-cloud/hosted/docs/latest/gdcag/platform-application/pa-ao-operations/vm-backup/backup-plans/create-manual-backup.md.txt).

## Restore backups

You can restore VM workloads or disk snapshots for backups you create manually
or as part of the scheduled backup plans:

- For scheduled backup plan restoration, see
  [Create a backup restore](https://docs.cloud.google.com/distributed-cloud/hosted/docs/latest/gdcag/platform-application/pa-ao-operations/vm-backup/restore-backup/create-restore-scoped.md.txt)
  or [Create a fine-grained restore](https://docs.cloud.google.com/distributed-cloud/hosted/docs/latest/gdcag/platform-application/pa-ao-operations/vm-backup/restore-backup/create-fine-grained-restore.md.txt)

- For VM workloads, the restoration process creates a new VM with the same
  configuration and disk state as the backup. For more information, see
  [Create a VM from a backup](https://docs.cloud.google.com/distributed-cloud/hosted/docs/latest/gdcag/platform-application/pa-ao-operations/vm-backup/restore-backup/create-vm-from-backup.md.txt).

- For disk snapshots, the restore creates a new disk with the same
  configuration and disk state as the snapshot. For more information, see
  [Restore from a snapshot](https://docs.cloud.google.com/distributed-cloud/hosted/docs/latest/gdcag/platform-application/pa-ao-operations/vm-backup/restore-backup/restore-from-a-snapshot.md.txt).