Stay organized with collections Save and categorize content based on your preferences.
This document describes how to configure Asynchronous Replication. Asynchronous Replication is useful for low-RPO, low-RTO disaster recovery.
To to enable asynchronous disk replication, complete the following steps:
Select the tab for how you plan to use the samples on this page:
ConsoleWhen you use the Google Cloud console to access Google Cloud services and APIs, you don't need to set up authentication.
gcloudInstall the Google Cloud CLI. After installation, initialize the Google Cloud CLI by running the following command:
gcloud init
If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
Note: If you installed the gcloud CLI previously, make sure you have the latest version by runninggcloud components update
.To use the Terraform samples on this page in a local development environment, install and initialize the gcloud CLI, and then set up Application Default Credentials with your user credentials.
Install the Google Cloud CLI.
If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
Note: If you installed the gcloud CLI previously, make sure you have the latest version by runninggcloud components update
.
If you're using a local shell, then create local authentication credentials for your user account:
gcloud auth application-default login
You don't need to do this if you're using Cloud Shell.
If an authentication error is returned, and you are using an external identity provider (IdP), confirm that you have signed in to the gcloud CLI with your federated identity.
For more information, see Set up authentication for a local development environment.
RESTTo use the REST API samples on this page in a local development environment, you use the credentials you provide to the gcloud CLI.
Install the Google Cloud CLI.
If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
For more information, see Authenticate for using REST in the Google Cloud authentication documentation.
Before you can replicate data between disks, you need to configure replication by completing the following tasks:
Disks must meet the following requirements to be used as primary or secondary disks for Asynchronous Replication:
The primary disk is the boot or data disk that is attached to the VM where the workload runs. You can use any pre-existing disk that meets the disk requirements as a primary disk, or you can create a new disk. If you want to use an existing disk as a primary disk, you don't need to perform any additional configuration on the disk. Proceed to create a secondary disk to complete Asynchronous Replication configuration.
Create a primary diskCreate a primary disk using the methods described in one of the following documents.
Create a primary boot disk while creating a VM. Optionally add the disk to a consistency group by creating the VM using the gcloud CLI or REST and specifying one of the following:
If you create the VM using the gcloud CLI, specify the --create-disk
flag:
--create-disk=disk-resource-policy=projects/PROJECT/regions/REGION/resourcePolicies/CONSISTENCY_GROUP_NAME
If you create the VM using REST, specify the resourcePolicies
property:
"disks": { … "resourcePolicies": "projects/PROJECT/regions/REGION/resourcePolicies/CONSISTENCY_GROUP_NAME" }
Create a primary data disk while creating a VM. Optionally add the disk to a consistency group by creating the VM using the gcloud CLI or REST and specifying one of the following:
If you create the VM using the gcloud CLI, specify the --create-disk
flag:
--create-disk=disk-resource-policy=projects/PROJECT/regions/REGION/resourcePolicies/CONSISTENCY_GROUP_NAME
If you create the VM using REST, specify the resourcePolicies
property:
"disks": { … "resourcePolicies": "projects/PROJECT/regions/REGION/resourcePolicies/CONSISTENCY_GROUP_NAME" }
Create a primary data disk without creating a VM. Optionally add the disk to a consistency group by creating the VM using the Google Cloud console, gcloud CLI, or REST and specifying one of the following:
If you create the disk using the Google Cloud console, select the consistency group from the Consistency group dropdown.
If you create the disk using the gcloud CLI, specify the --resource-policies
flag:
--resource-policies=projects/PROJECT/regions/REGION/resourcePolicies/CONSISTENCY_GROUP_NAME
If you create the disk using REST, specify the resourcePolicies
property:
"disks": { … "resourcePolicies": "projects/PROJECT/regions/REGION/resourcePolicies/CONSISTENCY_GROUP_NAME" }
Replace the following:
PROJECT
: the project that contains the consistency groupREGION
: the region that the consistency group is location inCONSISTENCY_GROUP_NAME
: the name of the consistency group to add the disk toThe secondary disk is a data disk in a separate region from the primary disk, that receives and writes replicated data from the primary disk. When configuring Asynchronous Replication, you must create a new, blank secondary disk that references the primary disk.
To create a secondary disk with the same properties as the primary disk, follow the steps in Create a secondary disk identical to the primary disk.
Note: Compute Engine copies the properties from the primary disk to the secondary disk only once, when the secondary disk is created. If you modify the primary disk's label, guest OS features, or other properties after the secondary disk is created, then Compute Engine doesn't replicate those changes to the secondary disk.To create a secondary disk that differs from the primary disk, see Create a custom secondary disk.
Create a secondary disk identical to the primary diskThis section describes how to create a secondary disk identical to the primary disk.
For Hyperdisk Asynchronous Replication, you can use the gcloud CLI, Terraform, or REST.
Create a secondary disk and start replication by doing the following:
In the Google Cloud console, go to the Disks page.
Click the name of the primary disk. The Manage disk page opens.
Click Create secondary disk.
In the Name field, enter a name for the disk.
In the Location section, do one of the following:
To create a regional disk:
To create a zonal disk:
Click Create. Compute Engine creates the disk and starts replication.
Create a secondary disk using the gcloud compute disks create
command:
gcloud compute disks create SECONDARY_DISK_NAME \ --SECONDARY_LOCATION_FLAG=SECONDARY_LOCATION \ --size=SIZE \ --primary-disk=PRIMARY_DISK_NAME \ --PRIMARY_DISK_LOCATION_FLAG=PRIMARY_LOCATION \ --primary-disk-project=PRIMARY_DISK_PROJECT
To create a regional secondary disk, additionally specify the --replica-zones
flag:
--replica-zones=ZONE_1,ZONE_2
Replace the following:
SECONDARY_DISK_NAME
: the name for the secondary disk.SECONDARY_LOCATION_FLAG
: the location flag for the secondary disk. To create a regional secondary disk, use --region
. To create a zonal secondary disk, use --zone
.SECONDARY_LOCATION
: the region or zone for the secondary disk.
SIZE
: the size, in GB, of the new disk. The size must be the same as the size of the primary disk. Acceptable sizes range, in 1 GB increments, from 10 GB to 2000 GB.PRIMARY_DISK_NAME
: the name of the primary disk that the secondary disk receives data from.PRIMARY_LOCATION_FLAG
: the location flag for the primary disk.
--primary-disk-region
.--primary-disk-zone
.PRIMARY_LOCATION
: the primary disk's region or zone.
PRIMARY_PROJECT
: the project that contains the primary disk.ZONE_1
: one of the zones that the regional disk is replicated to. Must be a zone within the specified region and must be different than ZONE_2
.ZONE_2
: one of the zones that the regional disk is replicated to. Must be a zone within the specified region and must be different than ZONE_1
.Create a zonal or regional secondary disk using one of the following code samples:
Create a zonal secondary disk Create a regional secondary disk JavaCreate a zonal or regional secondary disk using one of the following code samples:
Create a zonal secondary disk Create a regional secondary disk Node.jsCreate a zonal or regional secondary disk using one of the following code samples:
Create a zonal secondary disk Create a regional secondary disk PythonCreate a zonal or regional secondary disk using one of the following code samples:
Create a zonal secondary disk Create a regional secondary disk RESTCreate a zonal or regional secondary disk using one of the following methods:
To create a zonal secondary disk, use the disks.insert
method:
POST https://compute.googleapis.com/compute/v1/projects/SECONDARY_DISK_PROJECT/zones/SECONDARY_DISK_LOCATION/disks { "name": "SECONDARY_DISK_NAME", "sizeGb": "DISK_SIZE", "type": "DISK_TYPE" "asyncPrimaryDisk": { "disk": "projects/PRIMARY_DISK_PROJECT/PRIMARY_DISK_LOCATION_PARAMETER/PRIMARY_DISK_LOCATION/disks/PRIMARY_DISK_NAME" } }
To create a regional secondary disk, use the regionDisks.insert
method:
POST https://compute.googleapis.com/compute/v1/projects/SECONDARY_DISK_PROJECT/regions/SECONDARY_DISK_LOCATION/disks { "name": "SECONDARY_DISK_NAME", "sizeGb": "DISK_SIZE", "type": "DISK_TYPE" "asyncPrimaryDisk": { "disk": "projects/PRIMARY_DISK_PROJECT/PRIMARY_DISK_LOCATION_PARAMETER/PRIMARY_DISK_LOCATION/disks/PRIMARY_DISK_NAME" } }
Replace the following:
SECONDARY_DISK_PROJECT
: the project for the secondary disk.SECONDARY_DISK_LOCATION
: the region or zone for the secondary disk.
SECONDARY_DISK_NAME
: the name for the secondary disk.DISK_SIZE
: the size of the secondary disk. Must be the same as the size of the primary disk.PRIMARY_DISK_PROJECT
: the project that contains the primary disk.PRIMARY_DISK_LOCATION_PARAMETER
: the location parameter for the primary disk.
regions
.zones
.PRIMARY_DISK_LOCATION
: the primary disk's region or zone. For regional disks, use the region. For zonal disks, use the zone.PRIMARY_DISK_NAME
: the name of the primary disk that the secondary disk receives data from.sourceSnapshot
, sourceImage
, or sourceDisk
fields to your request. Terraform
To create a secondary disk identical to the primary disk, use the compute_disk
resource.
To learn how to apply or remove a Terraform configuration, see Basic Terraform commands.
Create a custom secondary diskThis section discusses how to create a custom secondary disk, that is, a secondary disk whose properties differ from the primary disk.
If the primary disk is a boot disk, you can't change or remove any of the primary disk's guest OS features. You can only add more guest OS features. For more information, see Secondary disk customization.
You can create a custom secondary disk with the gcloud CLI, REST, or Terraform. You can't customize the secondary disk from the Google Cloud console.
gcloudTo create a custom secondary disk, use the gcloud compute disks create
command as described in Create a secondary disk identical to the primary disk. Use additional flags to customize the secondary disk's properties.
The following are examples of how to customize the secondary disk:
--guest-os-features
parameter.
--guest-os-features=UEFI_COMPATIBLE,GVNIC,MULTI_IP_SUBNET
--labels
parameter.
--labels=secondary-disk-for-replication=yes
To create a custom secondary disk, use the same method described in Create a secondary disk identical to the primary disk. Specify additional fields to customize the secondary disk's properties.
The following are examples of how to customize the secondary disk:
guestOsFeatures
field. You can only specify additional guest OS features; you can't change or remove any of the guest OS features that were copied from the primary disk.
"guestOsFeatures": [ { "type": "NEW_FEATURE_ID_1" }, { "type": "NEW_FEATURE_ID_1" } ]
labels
field.
"labels": [ { "key": "value" }, ]
To create a custom secondary disk, use the same method described in Create a secondary disk identical to the primary disk. You can specify additional fields to customize the secondary disk's properties.
The following are examples of how to customize the secondary disk:
guest_os_features
field. You can only specify additional guest OS features; you can't change or remove any of the guest OS features that were copied from the primary disk.
guest_os_features { type = "SECURE_BOOT" } guest_os_features { type = "MULTI_IP_SUBNET" } guest_os_features { type = "WINDOWS" }
labels
field.
labels = { environment = "dev" }
After you create a primary and secondary disk, you must start replication to begin replicating data from the primary disk to the secondary disk.
What's nextExcept as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-08-07 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["PD Async Replication enables low-RPO, low-RTO disaster recovery by asynchronously replicating data between a primary and a secondary disk."],["To configure PD Async Replication, you must set up a disk replication pair and choose a supported region pair for the primary and secondary disks."],["Secondary disks must be created blank, as they cannot be derived from images, snapshots, or existing disks, and are subject to specific disk requirements."],["Once primary and secondary disks are created, you must manually start replication to initiate data transfer from the primary to the secondary disk."],["Disks can be organized into consistency groups for coordinated replication, and there are options to customize secondary disks with additional features and labels beyond what the primary disk has."]]],[]]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4