Quickstart: Protect and recover a Cloud SQL instance to a backup vault Stay organized with collections Save and categorize content based on your preferences.
Learn how to protect and restore a Cloud SQL instance to a backup vault.
In this quickstart, you perform the following tasks:
- Configure a scheduled backup for a Cloud SQL instance.
- Back up a Cloud SQL instance into a backup vault.
- Restore a Cloud SQL instance from a vaulted backup.
Before you begin
Enable the Backup and DR Service API in your Google Cloud project.
Create a backup vault.Backup vaults provide protection for backups by storing them insecure, isolated, and specialized storage. For more information aboutbackup vaults, seeBackup vault for immutable and indelible backups.
Grant a role to the backup vault service agent
Every backup vault created has a unique service agent linked to it.For Cloud SQL instances, the service agent performs actionson behalf of the Backup and DR Service, so it needs appropriate permissions onthe projects it needs to access.
Use the following instructions to grant a role to the service agent.
In the Google Cloud console, go to theBackup vaults page.
Click the backup vault name and copy the service agent's email address.
In the Google Cloud console, go to theIAM page.
In theNew principles field, enter the service agent's email address.
From theSelect a role list, select theBackupDR Cloud SQL Operator (
roles/backupdr.cloudSqlOperator) role.ClickAdd another role.
From theSelect a role list, select theService Account User (
roles/iam.serviceAccountUser) role.ClickSave.
Back up a Cloud SQL instance into a backup vault
In the Google Cloud console, you can back up Cloud SQL instances to abackup vault by applying backup plans. You can back up in either ofthese two ways:Scheduled backups andOn-demand backups.
Configure a scheduled backup
Use the following instructions to configure a scheduled backup forCloud SQL instances.
In the Google Cloud console, go to theVaulted backups page.
ClickSchedule backup.
From theResource Type list, selectCloud SQL.
From theProject list, select the project where the Cloud SQL instanceis located.
From theRegion list, select the region where your instances arelocated.
From theResources list, clickBrowse. Choose the Cloud SQLinstance that you want to back up and clickDone.
ClickContinue.
From theBackup plan list, clickSelect.
Choose a backup plan that you want to protect the Cloud SQL instance with.
ClickDone.
Review the backup details and clickSchedule.
As the backup window is set to six hours, you can take an on-demand backup of the Cloud SQL instance.
Note: The first backup is automatically triggered when the current time is within the backup window.
Take an on-demand backup
Initiate an on-demand backup for a Cloud SQL instance with a backup planby triggering the backup rule to run immediately.
Use the following instructions to create an on-demand backup.
In the Google Cloud console, go to theVaulted backups page.
TheVaulted backups page lists only the data resources that havebackup plans applied and their backups stored in a backup vaultwithin that project.
Select the resource to back up. Either from themenu, or from the details page for the resource, selectCreate on-demand backup.
In theCreate an on-demand backup window, select a backup rule to useand clickCreate.
To view the status of the on-demand backup job, clickNotifications.
Note: The on-demand backup is stored in the backup vault that isconfigured with the associated backup plan.In the Google Cloud console, go to theJobs page to view the backup operation status.
Restore a Cloud SQL instance from a backup
You can restore a Cloud SQL instance to the same project or to adifferent project.
Use the following instructions to restore a Cloud SQL instance into abackup vault from a backup.
In the Google Cloud console, go to theVaulted backups page.
TheVaulted backups page lists only the instances that havebackup plans applied and their backups stored in a backup vaultwithin a project.
Select the backup that you want to restore. Either from the backupdetails page for the backup, or from the menu, selectRestore.
TheRestore page displays where you select the following restore options:
- TheResource type is prefilled with
Cloud SQL. - InResource name, select the Cloud SQL instance to restore.
- When you clickBackup, a pane opens showing all available backups.Select the specific backup to restore.
- ForChoose the restore destination, select the project into whichyou want to restore the Cloud SQL instance.
- ClickContinue.
The next page shows the restore details so far, and prompts you toChoose restore destination, with these options:
- Restore to a new instance: This creates a new instance based on theconfiguration stored in your backup. You can customise the instance afterthe restore is complete. Provide a newInstance ID using lowercaseletters, numbers, and hyphens. Start with a letter.
- Overwrite an existing instance: Select an existing instance tooverwrite from the list of available instances.
- Overwrite the source instance: This will overwrite your currentinstance. All the current data on the selected instance will be overwritten,including previous point-in-time recovery logs. The overwritten data cannotbe recovered later. This is not recommended for production use.
- TheResource type is prefilled with
In the Google Cloud console, go to theJobs page to view the restoreoperation status.
Clean up
To avoid incurring charges to your Google Cloud account, remember to delete theresources used on this page if you have no further use for them.
Use the following instructions to remove the backup plan from the backed up Cloud SQL instance.
In the Google Cloud console, go to theVaulted backups page.
Select the backed up instance.
ClickRemove backup plan.
Note: The backup automatically expires and gets deleted after the retention period that you set.
Use the following instructions to delete the backup plan. Deleting the backup plan is an optional step.
In the Google Cloud console, go to theBackup plans page.
Select the backup plan and clickDelete.
This deletes the backup plan and related contents.
Use the following instructions to delete the backup vault. Deleting the backup vault is an optional step.
In the Google Cloud console, go to theBackup vaults page.
Click the backup vault and clickDelete.
This deletes the backup vault and related contents.
Note: The backup vault incurs a cost only when the backup vault stores data. The existence of a backup plan doesn't incur any cost.
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2026-02-19 UTC.