Manage enhanced backups

You can enable and manage enhanced backups for your AlloyDB for PostgreSQL clusters and projects. Enhanced backups let you use Backup and DR Service with your AlloyDB clusters to manage your backups.

For information about how backups work in AlloyDB and the available options for your clusters, see Data backup and recovery overview.

Before you begin

Before you can manage enhanced backups for your AlloyDB clusters, follow these steps:

Enable the Backup and DR API

To use enhanced backups with your AlloyDB clusters, you must first enable the Backup and DR API:

Enable the Backup and DR API

Required permissions

To configure enhanced backups for your AlloyDB clusters, you need the alloydb.backupDrAdmin role or the following permissions:

  • backupdr.backupPlans.list
  • backupdr.backupPlanAssociations.createForAlloydbCluster
  • backupdr.backupPlanAssociations.fetchForAlloydbCluster
  • backupdr.backupPlanAssociations.list
  • backupdr.backupPlanAssociations.getForAlloydbCluster
  • backupdr.backupPlanAssociations.triggerBackupForAlloydbCluster
  • backupdr.backupPlanAssociations.deleteForAlloydbCluster
  • backupdr.backupPlans.useForAlloydbCluster
  • backupdr.bvdataSources.get
  • backupdr.bvdataSources.list

For more information about these permissions, see Backup and DR roles and permissions.

Enable enhanced backups

To enable enhanced backups for your cluster, follow these high-level steps:

  1. Identify the backup vault and backup plan that you want to use.
  2. Associate your AlloyDB cluster to a backup plan.

For more information about enhanced backups, see Data backup and recovery overview.

Identify the backup plan you want to use

The backup plan is used by enhanced backups to define your cluster's backup schedule and retention settings. To associate your AlloyDB cluster with a backup plan, identify the backup plan that you want to use. For more information, see Create and manage a backup plan.

After you identify the backup plan you want to associate, use the backup plan name to associate it with your AlloyDB cluster.

Associate a backup plan with an AlloyDB cluster

To associate a backup plan with an AlloyDB cluster, you need the name of the backup plan that you want to use. For more information about how to find the backup plan name, see Create and manage a backup plan.

Console

To associate a backup plan with your AlloyDB cluster, do the following:

  1. In the Google Cloud console, go to the Clusters page.

    Go to Clusters

  2. Find the cluster you want to associate the backup plan with. To open the Overview page of the cluster, click the cluster name.

  3. Click Data Protection.

  4. In Settings, click Edit.

  5. In Configure Backup Tier, click Enhanced backup tier (managed by Backup and DR service).

  6. Select a backup plan.

  7. Click Update. Your cluster is enabled for enhanced backups using the associated backup plan's backup and retention settings.

gcloud

To associate a backup plan with your AlloyDB cluster, run the following command:

gcloud backup-dr backup-plan-associations create BPA_ID \
  --project=WORKLOAD_PROJECT_ID \
  --location=REGION \
  --resource-type=alloydb.googleapis.com/Cluster \
  --resource=projects/WORKLOAD_PROJECT_ID/locations/REGION/clusters/CLUSTER_ID \
  --backup-plan=projects/VAULT_PROJECT_ID/locations/REGION/backupPlans/BP_ID

Replace the following:

  • BPA_ID: the backup plan association ID.
  • WORKLOAD_PROJECT_ID: the project ID where the AlloyDB cluster resides.
  • REGION: the Google Cloud region, for example, us-central1.
  • CLUSTER_ID: the AlloyDB cluster ID.
  • VAULT_PROJECT_ID: the project ID where the backup vault resides.
  • BP_ID: the backup plan ID.

Manage enhanced backups

After your cluster is enabled for enhanced backups and a backup plan is associated with the cluster, you can change your cluster's associated backup plan, perform an on-demand backup or view all the backups in the backup vault.

To manage a backup plan, see Create and manage a backup plan. To manage a backup vault, see Create and manage a backup vault.

Change your cluster's associated backup plan

To change the backup plan that's associated with an AlloyDB cluster, you must first remove the current associated backup plan and then associate a new backup plan with that cluster.

The new backup plan must be in the same region as your AlloyDB cluster.

Remove the associated backup plan

To change to a new backup plan, start by removing the existing backup plan association from your AlloyDB cluster.

Console

  1. In the Google Cloud console, go to the Clusters page.

    Go to Clusters

  2. Click the name of the cluster you want to modify.

  3. Click Data Protection.

  4. In Settings, click Edit.

  5. Click Standard backup tier (managed by AlloyDB) and update the standard backup settings for your cluster as necessary.

  6. Click Update. The cluster's associated backup plan is deleted and your cluster is now managed under the standard backups option. You can now associate the new backup plan to your cluster.

gcloud

To change to a new backup plan, you must first remove the existing backup plan association from your AlloyDB cluster. To remove the backup plan, follow these steps:

gcloud backup-dr backup-plan-associations delete BPA_ID --project=WORKLOAD_PROJECT_ID --location=REGION

Replace the following:

  • BPA_ID: the backup plan association ID.
  • WORKLOAD_PROJECT_ID: the project ID where the AlloyDB cluster resides.
  • REGION: the Google Cloud REGION–for example, us-central1.

The cluster's associated backup plan is deleted and your cluster is now managed under the standard backups option. You can now associate the new backup plan to your cluster.

Associate the new backup plan with your cluster

After you remove the existing backup plan, you can associate a new backup plan with your AlloyDB cluster:

Console

To associate the new backup plan with your cluster, follow these steps:

  1. In the Google Cloud console, go to the Clusters page.

    Go to Clusters

  2. Find the cluster you want to associate the backup plan with. To open the Overview page of the cluster, click the cluster name.

  3. Click Data Protection.

  4. Click Edit.

  5. In Settings, click Edit.

  6. In Configure Backup Tier, click Enhanced backup tier (managed by Backup and DR service).

  7. Optional. Select a backup plan.

  8. Click Update. Your cluster is enabled for enhanced backups using the associated backup plan's backup and retention settings.

gcloud

To associate the new backup plan with your cluster, follow these steps:

gcloud backup-dr backup-plan-associations create BPA_ID \
--project=WORKLOAD_PROJECT_ID \
--location=REGION \
--resource-type=alloydb.googleapis.com/Cluster \
--resource=projects/WORKLOAD_PROJECT_ID/locations/REGION/clusters/CLUSTER_ID \
--backup-plan=projects/VAULT_PROJECT_ID/locations/REGION/backupPlans/BP_ID \

Replace the following:

  • BPA_ID: the backup plan association ID.
  • WORKLOAD_PROJECT_ID: the project ID where the AlloyDB cluster resides.
  • REGION: the Google Cloud REGION–for example, us-central1.
  • CLUSTER_ID: the AlloyDB cluster ID.
  • VAULT_PROJECT_ID: the project ID where the backup vault resides.
  • BP_ID: the backup plan ID. ### Perform an on-demand backup

You can perform an on-demand backup for an AlloyDB cluster with an associated backup plan using the Google Cloud console or the gcloud CLI.

Console

To perform an on-demand backup for an AlloyDB cluster with enhanced backups enabled, follow these steps:

  1. In the Google Cloud console, go to the Clusters page.

    Go to Clusters

  2. Click the name of the cluster with an associated backup plan for which you want to create an on-demand backup.

  3. Click Data Protection.

  4. Click Create backup.

  5. In Create an on-demand backup, choose a backup rule with the retention period that you want for the on-demand backup.

  6. Click Create. Your on-demand backup is created.

gcloud

To perform an on-demand backup for a cluster with enhanced backups enabled, run the following command:

gcloud backup-dr backup-plan-associations trigger-backup BPA_ID \
--project=WORKLOAD_PROJECT_ID \
--location=REGION \
--backup-rule-id=RULE_ID

Replace the following:

  • BPA_ID: the backup plan association ID.
  • WORKLOAD_PROJECT_ID: the project ID where the AlloyDB cluster resides.
  • REGION: the Google Cloud REGION–for example, us-central1.
  • RULE_ID: The ID of the backup rule within the backup plan to use for the on-demand backup. ### List all backups in a backup vault for your cluster

You can list all backups in the backup vault for your AlloyDB cluster using the Google Cloud console or the gcloud CLI.

Console

  1. In the Google Cloud console, go to the Backups page.

    Go to Backups

  2. In the Backup tier drop-down, select Enhanced tier, then select the Backup vault that contains the backup that you want to use. All backups available in the backup vault for your selected cluster are displayed.

gcloud

To list all available backups for your AlloyDB cluster in the backup vault, you first need to find the data-source for your AlloyDB cluster, then run the gcloud backup-dr backups list command.

To find your cluster's data-source, run the following command:

gcloud backup-dr data-source-references fetch-for-resource-type alloydb.googleapis.com/Cluster \
    --location=REGION \
    --project=WORKLOAD_PROJECT_ID \
    --filter='dataSourceGcpResourceInfo.gcp_resourcename="projects/WORKLOAD_PROJECT_NUMBER/locations/REGION/clusters/CLUSTER_ID"'

Replace the following:

  • REGION: the Google Cloud REGION–for example, us-central1.
  • WORKLOAD_PROJECT_ID: the project ID where the AlloyDB cluster resides.
  • CLUSTER_ID: the ID of the AlloyDB cluster whose Backup and DR information you want to find.
  • WORKLOAD_PROJECT_NUMBER: a unique, system-generated numeric identifier for your project–for example, 123456789012. Google Cloud automatically assigns this number when you create the project, and it is also immutable.

To list all the backups in a backup vault for your cluster, run the following command:

gcloud backup-dr backups list \
--data-source=DDATA_SOURCE \
--project=WORKLOAD_PROJECT_ID \
--location=REGION \
--backup-vault=BACKUP_VAULT_NAME

Replace the following:

  • DATA_SOURCE: the data-source for your AlloyDB cluster.
  • REGION: the region ID for the backup vault.
  • BACKUP_VAULT_NAME: the name of the backup vault associated with your backup plan. ### Disable enhanced backups

You can disable enhanced backups by switching your AlloyDB cluster back to the standard backups option. This deletes the association between the backup plan and your cluster.

To change your cluster to standard backups, follow these steps:

Console

To disable enhanced backups and switch your cluster back to the standard backups option, follow these steps:

  1. In the Google Cloud console, go to the Clusters page.

    Go to Clusters

  2. Click the name of the cluster for which you want to disable enhanced backups.

  3. Click Data Protection.

  4. In Settings, click Edit.

  5. Click Standard backup tier (managed by AlloyDB) and choose backup settings and update the Standard backups settings for your cluster as necessary.

  6. Click Save. Your cluster's associated backup plan is deleted and your cluster is now managed under the Standard backups option, managed by AlloyDB.

gcloud

To disable enhanced backups and switch your cluster back to the standard backups option, run the following command:

gcloud backup-dr backup-plan-associations delete BACKUP_PLAN_ASSOCIATION_NAME
--LOCATION=BACKUP_VAULT_LOCATION

Replace the following:

  • BACKUP_PLAN_ASSOCIATION_NAME: the name of the backup plan association that you want to delete.
  • BACKUP_VAULT_LOCATION: the LOCATION of the backup vault.

What's next