Ripristinare un'istanza Compute Engine da una cassetta di sicurezza di backup
Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Questa pagina ti aiuta a ripristinare un'istanza Compute Engine da un vault di backup nella Google Cloud console.
Prima di iniziare
Concedi il ruolo IAM Backup and DR Compute Engine Operator (roles/backupdr.computeEngineOperator)
all'agente di servizio del vault di backup del vault nel progetto di destinazione in cui viene eseguito il recupero.
Concedi i seguenti ruoli IAM all'utente che esegue il recupero nel progetto del vault di backup.
Backup and DR Restore User (roles/backupdr.restoreUser) sia per il vault di backup sia per il progetto di destinazione.
Visualizzatore Compute (roles/compute.viewer) solo per il target.
Questi ruoli predefiniti contengono le autorizzazioni necessarie per accedere al
vault di backup nel progetto Compute Engine. Per autorizzazioni specifiche, consulta l'elenco seguente.
Tutte le istanze Compute Engine con backup in un archivio sono elencate qui.
Fai clic sull'icona dell'azione per selezionare l'azione Ripristina. Viene visualizzata la pagina Ripristina, in cui puoi selezionare le seguenti opzioni di ripristino:
Seleziona un nome della risorsa.
Seleziona una data/ora di creazione del backup.
Seleziona il nome del progetto in cui vuoi ripristinare la VM.
Fai clic su Procedi.
Viene visualizzata la pagina successiva Crea una nuova istanza VM da un backup, in cui le proprietà della VM sono precompilate in base alle proprietà della VM di origine. Puoi modificare le proprietà per creare una nuova VM, ad esempio cambiare la selezione per Regione o Tipo di macchina.
Fai clic su Crea per creare una nuova VM dal backup selezionato.
gcloud
Se non è già stato concesso, concedi il ruolo IAM Backup and DR Compute Engine Operator (roles/backupdr.computeEngineOperator) all'agente di servizio del vault di backup nel progetto di recupero in cui viene recuperata la VM.
Per ottenere l'account di servizio del vault di backup, utilizza il seguente comando.
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Difficile da capire","hardToUnderstand","thumb-down"],["Informazioni o codice di esempio errati","incorrectInformationOrSampleCode","thumb-down"],["Mancano le informazioni o gli esempi di cui ho bisogno","missingTheInformationSamplesINeed","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 2025-09-04 UTC."],[[["\u003cp\u003eThis guide details the process of restoring a Compute Engine instance from a backup vault within the Google Cloud console, providing step-by-step instructions for both console and gcloud methods.\u003c/p\u003e\n"],["\u003cp\u003eBefore initiating a restore, you must grant specific IAM roles, including Backup and DR Compute Engine Operator, Compute Network User, and Backup and DR Restore User, to the appropriate service agents and users.\u003c/p\u003e\n"],["\u003cp\u003eThe console method involves navigating to the Vaulted backups page, selecting the instance and backup creation time, and then creating a new VM with pre-populated properties that can be customized.\u003c/p\u003e\n"],["\u003cp\u003eThe gcloud method requires using specific commands, including options to restore VMs in the same project or to custom configurations with service accounts and network details.\u003c/p\u003e\n"],["\u003cp\u003eThis documentation also provides information on additional related steps, including creating a backup plan for vaulted backups, checking for cloud credentials, and mounting backup images.\u003c/p\u003e\n"]]],[],null,["# Restore a Compute Engine instance from a backup vault\n\nThis page helps you to restore a Compute Engine instance from a backup vault in the Google Cloud console.\n\nBefore you begin\n----------------\n\n- Grant the Backup and DR Compute Engine Operator (`roles/backupdr.computeEngineOperator`)\n IAM role for the [backup vault service agent](/backup-disaster-recovery/docs/cloud-console/backup-vault-create#service-agent) of the vault in the target project where\n restore is being performed.\n\n- Grant the Compute Network User (`roles/compute.networkUser`) IAM\n role for the [backup vault service agent](/backup-disaster-recovery/docs/cloud-console/backup-vault-create#service-agent)\n of the vault in the VPC host project if you are using Shared VPC.\n\n- Grant the following IAM roles for the user who performs the\n restore in the backup vault project.\n\n - Backup and DR Restore User (`roles/backupdr.restoreUser`) for both backup vault and target project.\n - Compute Viewer (`roles/compute.viewer`) for only the target.\n\n These predefined roles contain the permissions required to access the\n backup vault in the Compute Engine project. For specific permissions,\n see the following list.\n - `backupdr.bvbackups.restore`\n - `backupdr.compute.restoreFromBackupVault`\n - `backupdr.backupVaults.get`\n - `backupdr.backupVaults.list`\n - `backupdr.bvbackups.list`\n - `backupdr.bvdataSources.get`\n - `backupdr.bvdataSources.list`\n - `backupdr.bvbackups.get`\n\n For more information about granting roles, see [Manage access to projects, folders, and organizations](/iam/docs/granting-changing-revoking-access).\n\nRestore a Compute Engine instance\n---------------------------------\n\nUse the following instructions to restore a VM instance. \n\n### Console\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 All Compute Engine instances with vaulted backups are listed here.\n2. Click the action icon to select the **Restore** action. The **Restore page** displays where you select the following restore options:\n\n - Select a **Resource name**.\n - Select a **Backup creation time**.\n - Select the **Project name** into which you want to restore the VM.\n3. Click **Proceed**.\n\n - The next page **Create a new VM instance from a backup** appears, where the VM properties are pre-populated based on the source VM properties. You can modify the properties to create a new VM, for example, change the selection for **Region** or **Machine Type**.\n4. Click **Create** to create a new VM from the selected backup.\n\n | **Note:** You can view and monitor the restore jobs in the **Backup and DR** \\\u003e **Jobs** page.\n\n### gcloud\n\n1. If not already granted, grant the Backup and DR Compute Engine Operator (`roles/backupdr.computeEngineOperator`) IAM role to the backup vault service agent in the recovery project where the VM is being recovered.\n\n2. To get the backup vault service account, use the following command.\n\n gcloud backup-dr backup-vaults describe \u003cvar translate=\"no\"\u003eBACKUPVAULT_NAME\u003c/var\u003e\n --location=\u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003eBACKUPVAULT_NAME\u003c/var\u003e: the backup vault name you want to restore data from.\n - \u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e: the location of the backup vault.\n3. To restore a VM instance, use the following commands.\n\n - Restore a VM in the same project as the workload project with backup ID.\n\n gcloud backup-dr backups restore compute test-backup-id \\\n --project=\u003cvar translate=\"no\"\u003ePROJECT\u003c/var\u003e --location=\u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e \\\n --backup-vault=\u003cvar translate=\"no\"\u003eBACKUPVAULT_NAME\u003c/var\u003e --data-source=\u003cvar translate=\"no\"\u003eDATA_SOURCE\u003c/var\u003e\\\n --name=\u003cvar translate=\"no\"\u003eNAME\u003c/var\u003e --target-zone=\u003cvar translate=\"no\"\u003eTARGET_ZONE\u003c/var\u003e \\\n --target-project=\u003cvar translate=\"no\"\u003eTARGET_PROJECT\u003c/var\u003e\n\n - Restore a VM in the same project as the workload project with backup full resource URL.\n\n gcloud backup-dr backups restore compute projects/test-project-id/locations/us-central1/backupVaults/test-vault/dataSources/test-ds/backups/test-backup-id \\\n --name=\u003cvar translate=\"no\"\u003eNAME\u003c/var\u003e --target-zone=\u003cvar translate=\"no\"\u003eTARGET_ZONE\u003c/var\u003e \\\n --target-project=\u003cvar translate=\"no\"\u003eTARGET_PROJECT\u003c/var\u003e\n\n - Restore a VM instance with custom service-account and network configuration.\n\n gcloud backup-dr backups restore compute test-backup-id \\\n --project=\u003cvar translate=\"no\"\u003ePROJECT\u003c/var\u003e --location=\u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e \\\n --backup-vault=\u003cvar translate=\"no\"\u003eBACKUPVAULT_NAME\u003c/var\u003e --data-source=\u003cvar translate=\"no\"\u003eDATA_SOURCE\u003c/var\u003e\\\n --name=\u003cvar translate=\"no\"\u003eNAME\u003c/var\u003e --target-zone=\u003cvar translate=\"no\"\u003eTARGET_ZONE\u003c/var\u003e \\\n --target-project=\u003cvar translate=\"no\"\u003eTARGET_PROJECT\u003c/var\u003e \\\n --network-interface=network=\u003cvar translate=\"no\"\u003eNETWORK\u003c/var\u003e,subnet=\u003cvar translate=\"no\"\u003eSUBNET\u003c/var\u003e \\\n --service-account=\u003cvar translate=\"no\"\u003eSERVICE_ACCOUNT\u003c/var\u003e \\\n --scopes=\u003cvar translate=\"no\"\u003eSCOPE\u003c/var\u003e\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003ePROJECT\u003c/var\u003e: the name of the backup vault project.\n - \u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e: the location of the backup vault.\n - \u003cvar translate=\"no\"\u003eBACKUPVAULT_NAME\u003c/var\u003e: the backup vault name you want to restore data from.\n - \u003cvar translate=\"no\"\u003eDATA_SOURCE\u003c/var\u003e: the data source name you want to restore data from.\n - \u003cvar translate=\"no\"\u003eNAME\u003c/var\u003e: the name of the restored VM.\n - \u003cvar translate=\"no\"\u003eTARGET_ZONE\u003c/var\u003e: the region the VM is restored in.\n - \u003cvar translate=\"no\"\u003eTARGET_PROJECT\u003c/var\u003e: the project the VM is restored in.\n - \u003cvar translate=\"no\"\u003eNETWORK\u003c/var\u003e: the network URI of the VM.\n - \u003cvar translate=\"no\"\u003eSUBNET\u003c/var\u003e: the subnet URI of the VM.\n - \u003cvar translate=\"no\"\u003eSERVICE_ACCOUNT\u003c/var\u003e: the service account of the restored VM.\n - \u003cvar translate=\"no\"\u003eSCOPE\u003c/var\u003e: the authorization scope of the service account.\n\nTo override other VM properties, see [Overview of Backup and DR Service Google Cloud CLI commands](https://cloud.google.com/sdk/gcloud/reference/alpha/backup-dr/backups/restore).\n\nThe Backup and DR Compute Engine guide\n--------------------------------------\n\n- [Create and manage a backup plan for vaulted backups](/backup-disaster-recovery/docs/cloud-console/backup-plan-create)\n- [Check for the cloud credentials](/backup-disaster-recovery/docs/configuration/create-cloud-credentials)\n- [Discover and protect Compute Engine instances](/backup-disaster-recovery/docs/configuration/discover-and-protect-ce-inst)\n- [Mount backup images of Compute Engine Persistent Disk](/backup-disaster-recovery/docs/access-data/mount-snapshot-images-of-cloud-instances)\n- [Restore a Compute Engine instance](/backup-disaster-recovery/docs/restore-data/restore-instance)\n- [Import Persistent Disk snapshot images](/backup-disaster-recovery/docs/configuration/import-pdsnapshot-images)"]]