Conceder um papel ao agente de serviço do backup vault
Cada cofre de backup criado tem um agente de serviço exclusivo vinculado a ele.
Para instâncias do Cloud SQL, o agente de serviço realiza ações
em nome do serviço de Backup e DR. Portanto, ele precisa das permissões adequadas nos
projetos que precisa acessar.
Siga as instruções abaixo para conceder um papel ao agente de serviço.
No console Google Cloud , acesse a página Cofres de backup.
No campo Novos membros, insira o endereço de e-mail do agente de serviço.
Na lista Selecionar um papel, selecione o papel Operador do Cloud SQL do BackupDR (roles/backupdr.cloudSqlOperator).
Clique em Adicionar outro papel.
Na lista Selecionar um papel, escolha Usuário da conta de serviço (roles/iam.serviceAccountUser).
Clique em Salvar.
Fazer backup de uma instância do Cloud SQL em um cofre de backup
No console do Google Cloud , é possível fazer backup de instâncias do Cloud SQL em um
backup vault aplicando planos de backup. É possível fazer backup de uma das
duas maneiras: backups programados e backups sob demanda.
Configurar um backup programado
Use as instruções a seguir para configurar um backup programado para
instâncias do Cloud SQL.
No console Google Cloud , acesse a página Backups em cofre.
A página Backups em vault lista apenas os recursos de dados que têm
planos de backup aplicados e os backups armazenados em um backup vault
dentro desse projeto.
Selecione o recurso para fazer backup. No menu more_vert
ou na página de detalhes do recurso, selecione Criar backup sob demanda.
Na janela Criar um backup sob demanda, selecione uma regra de backup para usar
e clique em Criar.
Para conferir o status do job de backup sob demanda, clique em Notificações.
No console Google Cloud , acesse a página Jobs para conferir o status da operação de backup.
A página Backups em vault lista apenas as instâncias com
planos de backup aplicados e os backups armazenados em um vault
dentro de um projeto.
Selecione o backup que você quer restaurar. Na página de detalhes do backup ou no menu
more_vert, selecione
Restaurar.
A página de restauração mostra onde você seleciona as seguintes opções de restauração:
O Tipo de recurso é preenchido automaticamente com Cloud SQL.
Em Nome do recurso, selecione a instância do Cloud SQL a ser restaurada.
Ao clicar em Backup, um painel é aberto mostrando todos os backups disponíveis.
Selecione o backup específico a ser restaurado.
Em Escolher o destino da restauração, selecione o projeto em que você quer restaurar a instância do Cloud SQL.
Clique em Continuar.
A próxima página mostra os detalhes da restauração até o momento e pede que você Escolha o destino da restauração, com estas opções:
Restaurar para uma nova instância: isso cria uma instância com base na
configuração armazenada no backup. É possível personalizar a instância após
a conclusão da restauração. Informe um novo ID da instância usando letras minúsculas, números e hifens. Comece com uma letra.
Substituir uma instância atual: selecione uma instância na lista de instâncias disponíveis para substituir.
Substituir a instância de origem: isso vai substituir sua instância atual. Todos os dados atuais na instância selecionada serão substituídos, incluindo
os registros de recuperação pontual anteriores. Não será possível recuperar
os dados substituídos depois. Isso não é recomendado para uso em produção.
No console Google Cloud , acesse a página Jobs para conferir o status da operação
de restauração.
[[["Fácil de entender","easyToUnderstand","thumb-up"],["Meu problema foi resolvido","solvedMyProblem","thumb-up"],["Outro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Informações incorretas ou exemplo de código","incorrectInformationOrSampleCode","thumb-down"],["Não contém as informações/amostras de que eu preciso","missingTheInformationSamplesINeed","thumb-down"],["Problema na tradução","translationIssue","thumb-down"],["Outro","otherDown","thumb-down"]],["Última atualização 2025-09-04 UTC."],[],[],null,["# Quickstart: Protect and recover a Cloud SQL instance to a backup vault\n\n| **Preview**\n|\n|\n| This product or feature is subject to the \"Pre-GA Offerings Terms\" in the General Service Terms section\n| of the [Service Specific Terms](/terms/service-terms#1).\n|\n| Pre-GA products and features are available \"as is\" and might have limited support.\n|\n| For more information, see the\n| [launch stage descriptions](/products#product-launch-stages).\n\nLearn how to protect and restore a Cloud SQL instance to a backup vault.\n\nIn this quickstart, you perform the following tasks:\n\n- Configure a scheduled backup for a Cloud SQL instance.\n- Back up a Cloud SQL instance into a backup vault.\n- Restore a Cloud SQL instance from a backup.\n\nBefore you begin\n----------------\n\n1. Enable the Backup and DR Service API in your Google Cloud project.\n\n [Enable the API](https://console.cloud.google.com/flows/enableapi?apiid=backupdr.googleapis.com&_ga=2.145630134.30427899.1640890668-1982243420.1634228058)\n2. [Create a backup vault](/backup-disaster-recovery/docs/cloud-console/backup-vault-create).\n Backup vaults provide protection for backups by storing them in\n secure, isolated, and specialized storage. For more information about\n backup vaults, see [Backup vault for immutable and indelible backups](/backup-disaster-recovery/docs/concepts/backup-vault).\n\n3. [Create a backup plan](/backup-disaster-recovery/docs/cloud-console/backup-plan-create).\n\nGrant a role to the backup vault service agent\n----------------------------------------------\n\nEvery backup vault created has a unique service agent linked to it.\nFor Cloud SQL instances, the service agent performs actions\non behalf of the Backup and DR Service, so it needs appropriate permissions on\nthe projects it needs to access.\n\nUse the following instructions to grant a role to the service agent.\n\n1. In the Google Cloud console, go to the **Backup vaults** page.\n\n [Go to Backup vaults](https://console.cloud.google.com/backupdr/backup-vaults/list)\n2. Click the backup vault name and copy the service agent's email address.\n\n3. In the Google Cloud console, go to the **IAM** page.\n\n [Go to IAM](https://console.cloud.google.com/iam-admin/iam)\n4. In the **New principles** field, enter the service agent's email address.\n\n5. From the **Select a role** list, select the **BackupDR Cloud SQL Operator** (`roles/backupdr.cloudSqlOperator`) role.\n\n6. Click **Add another role**.\n\n7. From the **Select a role** list, select the **Service Account User** (`roles/iam.serviceAccountUser`) role.\n\n8. Click **Save**.\n\nBack up a Cloud SQL instance into a backup vault\n------------------------------------------------\n\nIn the Google Cloud console, you can back up Cloud SQL instances to a\nbackup vault by applying backup plans. You can back up in either of\nthese two ways: **Scheduled backups** and **On-demand backups**.\n\n### Configure a scheduled backup\n\nUse the following instructions to configure a scheduled backup for\nCloud SQL instances.\n\n1. In the Google Cloud console, go to the **Vaulted backups** page.\n\n [Go to Vaulted backups](https://console.cloud.google.com/backupdr/vaulted-backups)\n2. Click **Schedule backup**.\n\n3. From the **Resource Type** list, select **Cloud SQL**.\n\n4. From the **Project** list, select the project where the Cloud SQL instance\n is located.\n\n5. From the **Region** list, select the region where your instances are\n located.\n\n6. From the **Resources** list, click **Browse** . Choose the Cloud SQL\n instance that you want to back up and click **Done**.\n\n7. Click **Continue**.\n\n8. From the **Backup plan** list, click **Select**.\n\n9. Choose a backup plan that you want to protect the Cloud SQL instance with.\n\n10. Click **Done**.\n\n11. Review the backup details and click **Schedule**.\n\n As the backup window is set to six hours, you can take an on-demand backup of the Cloud SQL instance.\n | **Note:** The first backup is automatically triggered when the current time is within the backup window.\n\nTake an on-demand backup\n------------------------\n\nInitiate an on-demand backup for a Cloud SQL instance with a backup plan\nby triggering the backup rule to run immediately.\n\nUse the following instructions to create an on-demand backup.\n\n1. In the Google Cloud console, go to the **Vaulted backups** page.\n\n [Go to Vaulted backups](https://console.cloud.google.com/backupdr/vaulted-backups)\n\n The **Vaulted backups** page lists only the data resources that have\n backup plans applied and their backups stored in a backup vault\n within that project.\n2. Select the resource to back up. Either from the more_vert\n menu, or from the details page for the resource, select **Create on-demand backup**.\n\n3. In the **Create an on-demand backup** window, select a backup rule to use\n and click **Create**.\n\n4. To view the status of the on-demand backup job, click **Notifications**.\n\n | **Note:** The on-demand backup is stored in the backup vault that is configured with the associated backup plan.\n 1. In the Google Cloud console, go to the **Jobs** page to view the backup operation status.\n\n [Go to Jobs](https://console.cloud.google.com/backupdr/jobs)\n\nRestore a Cloud SQL instance from a backup\n------------------------------------------\n\nYou can restore a Cloud SQL instance to the same project or to a\ndifferent project.\n\nUse the following instructions to restore a Cloud SQL instance into a\nbackup vault from a backup.\n\n1. In the Google Cloud console, go to the **Vaulted backups** page.\n\n [Go to Vaulted backups](https://console.cloud.google.com/backupdr/vaulted-backups)\n\n The **Vaulted backups** page lists only the instances that have\n backup plans applied and their backups stored in a backup vault\n within a project.\n2. Select the backup that you want to restore. Either from the backup\n details page for the backup, or from the\n more_vert menu, select\n **Restore**.\n\n The **Restore page** displays where you select the following restore options:\n - The **Resource type** is prefilled with `Cloud SQL`.\n - In **Resource name**, select the Cloud SQL instance to restore.\n - When you click **Backup**, a pane opens showing all available backups. Select the specific backup to restore.\n - For **Choose the restore destination**, select the project into which you want to restore the Cloud SQL instance.\n - Click **Continue**.\n - The next page shows the restore details so far, and prompts you to\n **Choose restore destination**, with these options:\n\n - **Restore to a new instance** : This creates a new instance based on the configuration stored in your backup. You can customise the instance after the restore is complete. Provide a new **Instance ID** using lowercase letters, numbers, and hyphens. Start with a letter.\n - **Overwrite an existing instance**: Select an existing instance to overwrite from the list of available instances.\n - **Overwrite the source instance**: This will overwrite your current instance. All the current data on the selected instance will be overwritten, including previous point-in-time recovery logs. The overwritten data cannot be recovered later. This is not recommended for production use.\n3. In the Google Cloud console, go to the **Jobs** page to view the restore\n operation status.\n\n [Go to Jobs](https://console.cloud.google.com/backupdr/jobs)\n\nClean up\n--------\n\nTo avoid incurring charges to your Google Cloud account, remember to delete the\nresources used on this page if you have no further use for them.\n\nUse the following instructions to remove the backup plan from the backed up Cloud SQL instance.\n\n1. In the Google Cloud console, go to the **Vaulted resources** page.\n\n [Go to Vaulted resources](https://console.cloud.google.com/backupdr/vaulted-resources)\n2. Select the backed up instance.\n\n3. Click **Remove backup plan**.\n\n | **Note:** The backup automatically expires and gets deleted after the retention period that you set.\n\nUse the following instructions to delete the backup plan. Deleting the backup plan is an optional step.\n\n1. In the Google Cloud console, go to the **Backup plans** page.\n\n [Go to Backup plans](https://console.cloud.google.com/backupdr/backup-plans/list)\n2. Select the backup plan and click **Delete**.\n\n This deletes the backup plan and related contents.\n\nUse the following instructions to delete the backup vault. Deleting the backup vault is an optional step.\n\n1. In the Google Cloud console, go to the **Backup vaults** page.\n\n [Go to Backup vaults](https://console.cloud.google.com/backupdr/backup-vaults/list)\n2. Click the backup vault and click **Delete**.\n\n This deletes the backup vault and related contents.\n | **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."]]