Restaurer une instance Compute Engine à partir d'un coffre de sauvegarde
Restez organisé à l'aide des collections
Enregistrez et classez les contenus selon vos préférences.
Cette page vous aide à restaurer une instance Compute Engine à partir d'un coffre de sauvegarde dans la console Google Cloud .
Avant de commencer
Attribuez le rôle IAM Opérateur Compute Engine Backup and DR (roles/backupdr.computeEngineOperator) à l'agent de service du coffre de sauvegarde du coffre dans le projet cible où la restauration est effectuée.
Accordez le rôle IAM Utilisateur de réseau Compute (roles/compute.networkUser) à l'agent de service de la banque de données de sauvegarde de la banque de données dans le projet hôte VPC si vous utilisez un VPC partagé.
Attribuez les rôles IAM suivants à l'utilisateur qui effectue la restauration dans le projet de coffre-fort de sauvegarde.
Utilisateur de sauvegarde et de reprise après sinistre (roles/backupdr.restoreUser) pour le coffre de sauvegarde et le projet cible.
Lecteur de Compute (roles/compute.viewer) pour la cible uniquement.
Ces rôles prédéfinis contiennent les autorisations requises pour accéder au dépôt de sauvegarde dans le projet Compute Engine. Pour connaître les autorisations spécifiques, consultez la liste suivante.
Toutes les instances Compute Engine avec des sauvegardes dans un coffre-fort sont listées ici.
Cliquez sur l'icône d'action pour sélectionner l'action Restaurer. La page Restore (Restaurer) s'affiche, sur laquelle vous pouvez sélectionner les options de restauration suivantes:
Sélectionnez un nom de ressource.
Sélectionnez une date et heure de création de la sauvegarde.
Sélectionnez le nom du projet dans lequel vous souhaitez restaurer la VM.
Cliquez sur Continuer.
La page suivante, Créer une instance de VM à partir d'une sauvegarde, s'affiche. Les propriétés de la VM sont préremplies en fonction des propriétés de la VM source. Vous pouvez modifier les propriétés pour créer une VM. Par exemple, vous pouvez modifier la sélection pour Région ou Type de machine.
Cliquez sur Create (Créer) pour créer une VM à partir de la sauvegarde sélectionnée.
gcloud
Si ce n'est pas déjà fait, attribuez le rôle IAM "Opérateur Compute Engine de sauvegarde et de reprise après sinistre" (roles/backupdr.computeEngineOperator) à l'agent de service du coffre de sauvegarde dans le projet de récupération où la VM est en cours de récupération.
Pour obtenir le compte de service du coffre-fort de sauvegarde, utilisez la commande suivante.
Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2025/09/04 (UTC).
[[["Facile à comprendre","easyToUnderstand","thumb-up"],["J'ai pu résoudre mon problème","solvedMyProblem","thumb-up"],["Autre","otherUp","thumb-up"]],[["Difficile à comprendre","hardToUnderstand","thumb-down"],["Informations ou exemple de code incorrects","incorrectInformationOrSampleCode","thumb-down"],["Il n'y a pas l'information/les exemples dont j'ai besoin","missingTheInformationSamplesINeed","thumb-down"],["Problème de traduction","translationIssue","thumb-down"],["Autre","otherDown","thumb-down"]],["Dernière mise à jour le 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)"]]