gcloud alpha backup-dr backups restore compute Stay organized with collections Save and categorize content based on your preferences.
- NAME
- gcloud alpha backup-dr backups restore compute - restores a Compute Engine VM Backup
- SYNOPSIS
gcloud alpha backup-dr backups restore compute(BACKUP:--backup-vault=BACKUP_VAULT--data-source=DATA_SOURCE--location=LOCATION)--name=NAME--target-project=TARGET_PROJECT--target-zone=TARGET_ZONE[--accelerator=[count=COUNT],[type=TYPE]][--async][--[no-]can-ip-forward][--clear-encryption-key][--confidential-compute][--create-disk=[PROPERTY=VALUE,…]][--[no-]deletion-protection][--description=DESCRIPTION][--[no-]enable-display-device][--[no-]enable-uefi-networking][--hostname=HOSTNAME][--instance-kms-key=INSTANCE_KMS_KEY][--instance-termination-action=INSTANCE_TERMINATION_ACTION][--key-revocation-action-type=POLICY][--labels=[KEY=VALUE,…]][--local-ssd-recovery-timeout=LOCAL_SSD_RECOVERY_TIMEOUT][--machine-type=MACHINE_TYPE][--maintenance-policy=MAINTENANCE_POLICY][--metadata=KEY=VALUE,[KEY=VALUE,…]][--min-cpu-platform=PLATFORM][--min-node-cpu=MIN_NODE_CPU][--network-interface=[PROPERTY=VALUE,…]][--network-performance-configs=[PROPERTY=VALUE,…]][--[no-]preemptible][--private-ipv6-google-access-type=PRIVATE_IPV6_GOOGLE_ACCESS_TYPE][--provisioning-model=PROVISIONING_MODEL][--resource-manager-tags=[KEY=VALUE,…]][--resource-policies=RESOURCE_POLICY,[…]][--[no-]restart-on-failure][--service-account=SERVICE_ACCOUNT][--tags=TAG,[TAG,…]][--threads-per-core=THREADS_PER_CORE][--visible-core-count=VISIBLE_CORE_COUNT][--reservation=RESERVATION--reservation-affinity=RESERVATION_AFFINITY][--scopes=[SCOPE,…] |--no-scopes][GCLOUD_WIDE_FLAG …]
- DESCRIPTION
(ALPHA)Restores a Compute Engine VM Backup.- EXAMPLES
- To restore a backup
sample-backupin projectsample-projectand locationus-central1, withsample-data-storeandsample-backup-vault, andadditional target properties, run:gcloudalphabackup-drbackupsrestorecomputesample-backup--project=sample-project--location=us-central1--backup-vault=sample-backup-vault--data-source=sample-data-source--<target-properties> - POSITIONAL ARGUMENTS
- Backup resource - The backup of a resource to be restored. The arguments in thisgroup can be used to specify the attributes of this resource. (NOTE) Someattributes are not given arguments in this group but can be set in other ways.
To set the
projectattribute:- provide the argument
backupon the command line with a fullyspecified name; - provide the argument
--projecton the command line; - set the property
core/project.
This must be specified.
BACKUP- ID of the Backup or fully qualified identifier for the Backup.
To set the
nameattribute:- provide the argument
backupon the command line.
This positional argument must be specified if any of the other arguments in thisgroup are specified.
- provide the argument
--backup-vault=BACKUP_VAULT- The ID of the Backup Vault.
To set the
backup-vaultattribute:- provide the argument
backupon the command line with a fullyspecified name; - provide the argument
--backup-vaulton the command line.
- provide the argument
--data-source=DATA_SOURCE- The ID of the Data Source.
To set the
data-sourceattribute:- provide the argument
backupon the command line with a fullyspecified name; - provide the argument
--data-sourceon the command line.
- provide the argument
--location=LOCATION- The location of the Backup.
To set the
locationattribute:- provide the argument
backupon the command line with a fullyspecified name; - provide the argument
--locationon the command line.
- provide the argument
- provide the argument
- Backup resource - The backup of a resource to be restored. The arguments in thisgroup can be used to specify the attributes of this resource. (NOTE) Someattributes are not given arguments in this group but can be set in other ways.
- REQUIRED FLAGS
--name=NAME- Name of the restored Compute Instance.
--target-project=TARGET_PROJECT- Project where the restore should happen.
--target-zone=TARGET_ZONE- Zone where the target instance is restored.
- OPTIONAL FLAGS
--accelerator=[count=COUNT],[type=TYPE]- Attaches accelerators (e.g. GPUs) to the instances.
type- The specific type (e.g. nvidia-tesla-k80 for nVidia Tesla K80) of accelerator toattach to the instances. Use 'gcloud compute accelerator-types list' to learnabout all available accelerator types.
count- Number of accelerators to attach to each instance. The default value is 1.
--async- Return immediately, without waiting for the operation in progress to complete.The default is
True. Enabled by default, use--no-asyncto disable. --[no-]can-ip-forward- If provided, allows the restored instances to send and receive packets withnon-matching destination or source IP addresses. Use
--can-ip-forwardto enable and--no-can-ip-forwardtodisable. --clear-encryption-key- Clears the CMEK encryption of the restored disks and defaults to GMEK unless thekms-key is specified in the --create-disk flag.
--confidential-compute- The restored instance boots with Confidential Computing enabled. ConfidentialComputing is based on Secure Encrypted Virtualization (SEV), an AMDvirtualization feature for running confidential instances.
--create-disk=[PROPERTY=VALUE,…]- Creates and attaches persistent disks to the instances.
name: Specifies the name of the disk.replica-zones: Required for each regional disk associated with theinstance. Specify the URLs of the zones where the disk should be replicated to.You must provide exactly two replica zones, and one zone must be the same as theinstance zone.device-name: Device name of the disk from the source instance.kms-key: The Cloud KMS key resource name to be used for encryption.If supplied, it will encrypt the disk with the given key, if not supplied, therestored disk will use the encryption of the disk from the source instance. Thedevice-namefield must be provided forkms-keyto takeeffect. Format:'projects/{project}/locations/{location}/keyRings/{ring}/cryptoKeys/{key}' --[no-]deletion-protection- Enables deletion protection for the restored instance. Use
--deletion-protectionto enable and--no-deletion-protectionto disable. --description=DESCRIPTION- Specifies a textual description of the restored instance.
--[no-]enable-display-device- Enable a display device on the restored VM instances. Disabled by default. Use
--enable-display-deviceto enable and--no-enable-display-deviceto disable. --[no-]enable-uefi-networking- If set to true, enables UEFI networking for the instance creation. Use
--enable-uefi-networkingto enable and--no-enable-uefi-networkingto disable. --hostname=HOSTNAME- Specify the hostname of the restore instance to be created. The specifiedhostname must be RFC1035 compliant. If hostname is not specified, the defaulthostname is [INSTANCE_NAME].c.[TARGET_PROJECT_ID].internal when using the globalDNS, and [INSTANCE_NAME].[ZONE].c.[TARGET_PROJECT_ID].internal when using zonalDNS.
--instance-kms-key=INSTANCE_KMS_KEY- The Cloud KMS (Key Management Service) cryptokey that will be used to protectthe restored instance.
Provide the full resource name of the cryptokey in the format:
projects/<project>/locations/<location>/keyRings/<key-ring>/cryptoKeys/<key> --instance-termination-action=INSTANCE_TERMINATION_ACTION- Specifies the termination action that will be taken upon VM preemption(--provisioning-model=SPOT) or automatic instance termination(--max-run-duration or --termination-time).
INSTANCE_TERMINATION_ACTIONmust be one of:DELETE- Permanently delete the VM.
STOP- Default only for Spot VMs. Stop the VM without preserving memory. The VM can berestarted later.
--key-revocation-action-type=POLICY- Specifies the behavior of the instance when the KMS key of one of its attacheddisks is revoked. The default is none. POLICY must be one of:
- none No operation is performed.
- stop The instance is stopped when the KMS key of one of its attached disks isrevoked.
--labels=[KEY=VALUE,…]- List of label KEY=VALUE pairs to add.
Keys must start with a lowercase character and contain only hyphens (-),underscores (
), lowercase characters, and numbers. Values mustcontain only hyphens (-), underscores (), lowercase characters, andnumbers. --local-ssd-recovery-timeout=LOCAL_SSD_RECOVERY_TIMEOUT- Specifies the maximum amount of time a Local SSD VM should wait while recoveryof the Local SSD state is attempted. Its value should be in between 0 and 168hours with hour granularity and the default value being 1 hour.
--machine-type=MACHINE_TYPE- Specifies the machine type used for the restored instance. To get a list ofavailable machine types, run 'gcloud compute machine-types list'. Ifunspecified, the default type will be based on the source instance.
This can either be the fully qualified path or the name. For example:
--machine-type=projects/my-project/zones/us-central1-a/machineTypes/n1-standard-1--machine-type=n1-standard-1
--maintenance-policy=MAINTENANCE_POLICY- Specifies the behavior of the VMs when their host machines undergo maintenance.The default is MIGRATE. For more information, seehttps://cloud.google.com/compute/docs/instances/host-maintenance-options.
MAINTENANCE_POLICYmust be one of:MIGRATE- The instances should be migrated to a new host. This will temporarily impact theperformance of instances during a migration event.
TERMINATE- The instances should be terminated.
--metadata=KEY=VALUE,[KEY=VALUE,…]- Metadata to be made available to the guest operating system running on theinstances. Each metadata entry is a key/value pair separated by an equals sign.Each metadata key must be unique and have a max of 128 bytes in length. Eachvalue must have a max of 256 KB in length. Multiple arguments can be passed tothis flag, e.g.,
. The combinedtotal size for all metadata entries is 512 KB.--metadatakey-1=value-1,key-2=value-2,key-3=value-3In images that have Compute Engine tools installed on them, such as theofficial images, thefollowing metadata keys have special meanings:
startup-script- Specifies a script that will be executed by the instances once they startrunning.
startup-script-url- Same as
except that thescript contents are pulled from a publicly-accessible location on the web.For startup scripts on Windows instances, the following metadata keys havespecial meanings:startup-script,windows-startup-script-url,windows-startup-script-cmd,windows-startup-script-bat,windows-startup-script-ps1,sysprep-specialize-script-url,sysprep-specialize-script-cmd, andsysprep-specialize-script-bat. For moreinformation, seeRunning startupscripts.sysprep-specialize-script-ps1
--min-cpu-platform=PLATFORM- When specified, the VM will be scheduled on host with specified CPU architectureor a newer one. To list available CPU platforms in given zone, run:
gcloudcomputezonesdescribeZONE--format="value(availableCpuPlatforms)"Default setting is "AUTOMATIC".
CPU platform selection is available only in selected zones.
You can find more information on-line:https://cloud.google.com/compute/docs/instances/specify-min-cpu-platform
--min-node-cpu=MIN_NODE_CPU- Minimum number of virtual CPUs this instance will consume when running on asole-tenant node.
--network-interface=[PROPERTY=VALUE,…]- Adds a network interface to the instance. This flag can be repeated to specifymultiple network interfaces. The following keys are allowed: network, subnet,private-network-ip, internal-ipv6-address, internal-ipv6-prefix-length, address,external-ipv6-address, external-ipv6-prefix-length, network-tier, aliases,stack-type, queue-count, nic-type, network-attachment
--network-performance-configs=[PROPERTY=VALUE,…]- Configures network performance settings for the restored instance. If this flagis not specified, the restored instance will be created with its sourceinstance's network performance configuration.
total-egress-bandwidth-tier- Total egress bandwidth is the available outbound bandwidth from a VM, regardlessof whether the traffic is going to internal IP or external IP destinations. Thefollowing tier values are allowed: [DEFAULT, TIER_1]
--[no-]preemptible- If provided, instances will be preemptible and time-limited. Instances might bepreempted to free up resources for standard VM instances, and will only be ableto run for a limited amount of time. Preemptible instances can not be restartedand will not migrate. Use
--preemptibleto enable and--no-preemptibleto disable. --private-ipv6-google-access-type=PRIVATE_IPV6_GOOGLE_ACCESS_TYPE- The private IPv6 Google access type for the restored VM.PRIVATE_IPV6_GOOGLE_ACCESS_TYPE must be one of: inherit-subnetwork,enable-bidirectional-access, enable-outbound-vm-access
--provisioning-model=PROVISIONING_MODEL- Specifies provisioning model, which determines price, obtainability, and runtimefor the restored VM instance.
PROVISIONING_MODELmust beone of:SPOT- Spot VMs are spare capacity; Spot VMs are discounted to have much lower pricesthan standard VMs but have no guaranteed runtime. Spot VMs are the new versionof preemptible VM instances, except Spot VMs do not have a 24-hour maximumruntime.
STANDARD- Default. Standard provisioning model for VM instances, which has user-controlledruntime but no Spot discounts.
--resource-manager-tags=[KEY=VALUE,…]- Specifies a list of resource manager tags to apply to the instance.
--resource-policies=RESOURCE_POLICY,[…]- A list of resource policy names to be added to the instance. The policies mustexist in the same region as the instance.
--[no-]restart-on-failure- The instances will be restarted if they are terminated by Compute Engine. Thisdoes not affect terminations performed by the user. Use
--restart-on-failureto enable and--no-restart-on-failureto disable. --service-account=SERVICE_ACCOUNT- A service account is an identity attached to the instance. Its access tokens canbe accessed through the instance metadata server and are used to authenticateapplications on the instance. The account can be set using an email addresscorresponding to the required service account. If not provided, the instancewill use the project's default service account.
--tags=TAG,[TAG,…]- Specifies a list of tags to apply to the instance. These tags allow networkfirewall rules and routes to be applied to specified VM instances. See
gcloud computefirewall-rules create(1) for more details. --threads-per-core=THREADS_PER_CORE- The number of visible threads per physical core. To disable simultaneousmultithreading (SMT) set this to 1. Valid values are: 1 or 2.
For more information about configuring SMT, see:https://cloud.google.com/compute/docs/instances/configuring-simultaneous-multithreading.
--visible-core-count=VISIBLE_CORE_COUNT- The number of physical cores to expose to the instance's guest operating system.The number of virtual CPUs visible to the instance's guest operating system isthis number of cores multiplied by the instance's count of visible threads perphysical core.
- Specifies the reservation for the instance.
--reservation=RESERVATION- The name of the reservation, required when
--reservation-affinity=specific. --reservation-affinity=RESERVATION_AFFINITY- Specifies the reservation affinity of the instance.
RESERVATION_AFFINITYmust be one of:any- Consume any available, matching reservation.
none- Do not consume from any reserved capacity.
specific- Must consume from a specific reservation.
- At most one of these can be specified:
--scopes=[SCOPE,…]- If not provided, the instance will be assigned the default scopes, describedbelow. However, if neither --scopes nor --no-scopes are specified and theproject has no default service account, then the instance will be created withno scopes. Note that the level of access that a service account has isdetermined by a combination of access scopes and IAM roles so you must configureboth access scopes and IAM roles for the service account to work properly. SCOPEcan be either the full URI of the scope or an alias. Default scopes are assignedto all instances. Available aliases are:https://cloud.google.com/sdk/gcloud/reference/compute/instances/create#--scopes
--no-scopes- Create the instance with no scopes.
- GCLOUD WIDE FLAGS
- These flags are available to all commands:
--access-token-file,--account,--billing-project,--configuration,--flags-file,--flatten,--format,--help,--impersonate-service-account,--log-http,--project,--quiet,--trace-token,--user-output-enabled,--verbosity.Run
$gcloud helpfor details. - BRIEF
- Restores the specified backup
- NOTES
- This command is currently in alpha and might change without notice. If thiscommand fails with API permission errors despite specifying the correct project,you might be trying to access an API with an invitation-only early accessallowlist. This variant is also available:
gcloudbackup-drbackupsrestorecompute
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-10 UTC.