> [!WARNING]
>
> **Preview**
>
>
> This feature is
>
> subject to the "Pre-GA Offerings Terms" in the General Service Terms section of the
> [Service Specific
> Terms](https://docs.cloud.google.com/terms/service-terms#1).
>
> Pre-GA features are available "as is" and might have limited support.
>
> For more information, see the
> [launch stage descriptions](https://cloud.google.com/products/#product-launch-stages).

You can create a high availability controller for a virtual machine (VM)
instance in a primary zone to automate failovers to a secondary zone within the
same region. If a zonal outage or prolonged host maintenance occurs in the
primary zone, then a high availability controller helps minimize downtime and
prevent data loss on your Hyperdisk and Persistent Disk volumes.

This document explains how to create a high availability controller. For more
information about the requirements and limitations that apply when you create a
high availability controller, see
[About high availability controllers](https://docs.cloud.google.com/compute/docs/instances/about-ha-controllers.md.txt).

## Before you begin

- If your project uses global DNS, then [migrate your project
  to zonal DNS](https://docs.cloud.google.com/compute/docs/networking/migrate-to-zonal-dns).
- If you want to use [reservations](https://docs.cloud.google.com/compute/docs/instances/reservations-overview.md.txt) or [sole-tenant nodes](https://docs.cloud.google.com/compute/docs/nodes/sole-tenant-nodes.md.txt) in both the primary and secondary zones, then create them. For the primary zone, configure your VM to consume the reservation or use the sole-tenant node group that you specify for the high availability controller.
- If you haven't already, then create and start a VM in the primary zone with the following configuration:
  - **Supported machine series** : verify that your VM uses a machine series that supports regional Persistent Disk or Hyperdisk Balanced High Availability volumes. To check supported machine series, see [Machine
    series comparison](https://docs.cloud.google.com/compute/docs/machine-resource#machine_type_comparison).
  - **Regional disks** : all disks attached to the VM---including the boot disk and any non-boot disks---must be regional disks. You can fulfill this requirement in one of the following ways:
    - If you create a new VM, then [create the VM with a regional boot disk](https://docs.cloud.google.com/compute/docs/disks/regional-persistent-disk.md.txt#use_repd_boot_disks) and attach regional data disks.
    - If you have an existing VM that uses zonal disks, then you can [convert the zonal disks to regional disks](https://docs.cloud.google.com/compute/docs/instances/about-ha-controllers.md.txt#disk-conversion) when you create the high availability controller from scratch.
  - **Automatic file system mounting** : if the VM uses non-boot disks, then format and mount the disks on [Linux](https://docs.cloud.google.com/compute/docs/disks/format-mount-disk-linux.md.txt) or [Windows](https://docs.cloud.google.com/compute/docs/disks/format-mount-disk-windows.md.txt), including configuring automatic mounting on system startup.
  - **Automatic application startup** : configure your workload or database to start on system boot; for example, by using a [startup script](https://docs.cloud.google.com/compute/docs/instances/startup-scripts.md.txt) or a system service.
- To manage your own networking resources instead of using automatic network configuration, create a regional backend service for an [internal passthrough
  Network Load Balancer](https://docs.cloud.google.com/load-balancing/docs/internal) in the VM's region and VPC network. The backend service must have [`haPolicy`](https://docs.cloud.google.com/compute/docs/reference/rest/2026-10-01-preview/regionBackendServices.md.txt#BackendService.FIELDS.ha_policy) enabled, have no backends attached, and receive traffic from an internal forwarding rule.
- If you want to assign reserved internal IP addresses to the VM's network interfaces in the secondary zone, then do the following:
  - In the secondary zone, [reserve static internal IPv4 or IPv6 addresses](https://docs.cloud.google.com/compute/docs/ip-addresses/configure-static-internal-ip-address.md.txt) in the VM's subnetworks.
  - In the primary zone, also reserve the internal IP address that the VM uses. If the VM uses an ephemeral internal IP address, then [promote that ephemeral internal IP address to a static internal IP
    address](https://docs.cloud.google.com/vpc/docs/reserve-static-internal-ip-address#promote-in-use-internal-address).
- If you haven't already, set up [authentication](https://docs.cloud.google.com/compute/docs/authentication.md.txt). Authentication verifies your identity for access to Google Cloud services and APIs. To run code or samples from a local development environment, you can authenticate to Compute Engine by selecting one of the following options:

  Select the tab for how you plan to use the samples on this page:

  ### Console


  When you use the Google Cloud console to access Google Cloud services and
  APIs, you don't need to set up authentication.

  ### gcloud

  1.
     [Install](https://docs.cloud.google.com/sdk/docs/install) the Google Cloud CLI.

     After installation,
     [initialize](https://docs.cloud.google.com/sdk/docs/initializing) the Google Cloud CLI by running the following command:

     ```bash
     gcloud init
     ```


     If you're using an external identity provider (IdP), you must first
     [sign in to the gcloud CLI with your federated identity](https://docs.cloud.google.com/iam/docs/workforce-log-in-gcloud.md.txt).

     > [!NOTE]
     > **Note:** If you installed the gcloud CLI previously, make sure you have the latest version by running `gcloud components update`.

  2. [Set a default region and zone](https://docs.cloud.google.com/compute/docs/gcloud-compute.md.txt#set_default_zone_and_region_in_your_local_client).

  ### Terraform


  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.
  1.
     [Install](https://docs.cloud.google.com/sdk/docs/install) the Google Cloud CLI.

  2. If you're using an external identity provider (IdP), you must first
     [sign in to the gcloud CLI with your federated identity](https://docs.cloud.google.com/iam/docs/workforce-log-in-gcloud.md.txt).

  3.

     If you're using a local shell, then create local authentication credentials for your user
     account:

     ```bash
     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](https://docs.cloud.google.com/iam/docs/workforce-log-in-gcloud.md.txt).


  For more information, see
  [Set up authentication for a local development environment](https://docs.cloud.google.com/compute/docs/authentication.md.txt#local-development).

  ### REST


  To use the REST API samples on this page in a local development environment, you use the
  credentials you provide to the gcloud CLI.
  1. [Install](https://docs.cloud.google.com/sdk/docs/install) the Google Cloud CLI.
  2. If you're using an external identity provider (IdP), you must first [sign in to the gcloud CLI with your federated identity](https://docs.cloud.google.com/iam/docs/workforce-log-in-gcloud.md.txt).


  For more information, see
  [Authenticate for using REST](https://docs.cloud.google.com/docs/authentication/rest.md.txt)
  in the Google Cloud authentication documentation.

### Required roles


To get the permissions that
you need to create a high availability controller,

ask your administrator to grant you the
following IAM roles on the project:

- [Compute Instance Admin (v1)](https://docs.cloud.google.com/iam/docs/roles-permissions/compute.md.txt#compute.instanceAdmin.v1) (`roles/compute.instanceAdmin.v1`)
- If your VM uses a Shared VPC network in a host project: [Compute Network User](https://docs.cloud.google.com/iam/docs/roles-permissions/compute.md.txt#compute.networkUser) (`roles/compute.networkUser`)


For more information about granting roles, see [Manage access to projects, folders, and organizations](https://docs.cloud.google.com/iam/docs/granting-changing-revoking-access.md.txt).


These predefined roles contain

the permissions required to create a high availability controller. To see the exact permissions that are
required, expand the **Required permissions** section:


#### Required permissions

The following permissions are required to create a high availability controller:

- To create a high availability controller: `compute.haControllers.create`
- To view the VM and its attached disks:
  - `compute.instances.get`
  - `compute.disks.get`
- To convert attached zonal disks to regional disks:
  - `compute.disks.create`
  - `compute.disks.useReadOnly`
  - `compute.disks.use`
  - `compute.instances.stop`
  - `compute.instances.detachDisk`
  - `compute.instances.attachDisk`
  - `compute.instances.start`
- To export the configuration of an existing high availability controller: `compute.haControllers.get`
- To use a Shared VPC network and subnetwork in a host project for the VM in the secondary zone and the internal forwarding rule:
  - `compute.networks.use`
  - `compute.subnetworks.use`


You might also be able to get
these permissions
with [custom roles](https://docs.cloud.google.com/iam/docs/creating-custom-roles.md.txt) or
other [predefined roles](https://docs.cloud.google.com/iam/docs/roles-overview.md.txt#predefined).

## Create a high availability controller

To create a high availability controller, use one of the following methods:

- [Create a high availability controller from scratch](https://docs.cloud.google.com/compute/docs/instances/create-ha-controller.md.txt#create-scratch)

- [Create a high availability controller based on an existing controller](https://docs.cloud.google.com/compute/docs/instances/create-ha-controller.md.txt#create-from-yaml)

After you create the high availability controller, configure your clients or DNS
records to send traffic to the forwarding rule's internal IP address instead of
the VM's `nic0` IP address. For instructions, see
[Configure network traffic after creation](https://docs.cloud.google.com/compute/docs/instances/create-ha-controller.md.txt#configure-network-traffic).

### Create a high availability controller from scratch

To create a high availability controller from scratch, select one of the
following options. To assign specific internal IP addresses to the controller's
forwarding rule or to the VM's network interfaces in the secondary zone, use the
gcloud CLI or REST API.

### Console

1. In the Google Cloud console, go to the **VM instances** page.

   [Go to VM instances](https://console.cloud.google.com/compute/instances)
2. In the row that contains the running VM that you want to manage with a
   high availability controller, click
   **More actions** , and then
   select **Make highly available** . The
   **Make <var translate="no">INSTANCE_NAME</var> highly available** page opens.

3. In the **High availability controller** section, complete the following
   steps:

   1. In the **Name** field, enter a name for the high availability
      controller.

   2. If your VM uses zonal disks, then, in the **Secondary zone** list,
      select the secondary zone where you want Compute Engine to
      replicate the converted regional disks and maintain a capacity
      guarantee. When you create the high availability controller,
      Compute Engine automatically
      [converts the VM's zonal disks to regional disks](https://docs.cloud.google.com/compute/docs/instances/about-ha-controllers.md.txt#disk-conversion).

   3. In the **Failover initiation** section, select one of the following
      options:

      - To trigger failovers when a zonal outage occurs, the VM remains
        in the `REPAIRING` state for over 10 minutes, or you request a
        failover, select **Automatic**.

      - To trigger failovers only when you request them, select
        **Manual**.

   4. To configure the capacity guarantee in the secondary zone, select
      one of the following options. For the primary zone, the high
      availability controller uses the reservation or sole-tenant
      configuration of your VM:

      - To help guarantee capacity by consuming a specifically targeted
        reservation, in the **Reservations** section, click
        **Edit reservation**
        next to the secondary zone, and then select the reservation.

      - To help guarantee capacity by using a sole-tenant node group, in
        the **Sole tenancy** section, click
        **Edit sole tenancy
        node** next to the secondary zone. Then, select the sole-tenant
        node group, node, or affinity labels.

      - To help guarantee capacity by using on-demand capacity or an
        automatically consumed reservation, in the **Reservations**
        section, click **Edit
        reservation** next to the secondary zone, and then select **Use
        on-demand capacity**.

   5. Optional: To use an existing regional backend service instead of
      automatic network configuration, do the following:

      1. Expand the **Show networking configuration** section.

      2. In the **Backend service** list, select the backend service.

4. To create the high availability controller, click
   **Make highly available**.

### gcloud

To create a high availability controller from scratch, use the
[`gcloud preview compute ha-controllers create` command](https://docs.cloud.google.com/sdk/gcloud/reference/preview/compute/ha-controllers/create).

Based on the method that you want to use to create the high availability
controller, run one of the following commands:

- Create a high availability controller by using reservations:

      gcloud preview compute ha-controllers create HA_CONTROLLER_NAME \
          --region=REGION \
          --instance-name=INSTANCE_NAME \
          --failover-initiation=FAILOVER_INITIATION \
          --zone-configuration=zone=PRIMARY_ZONE,reservation-affinity=RESERVATION_AFFINITY_1 \
          --zone-configuration=zone=SECONDARY_ZONE,reservation-affinity=RESERVATION_AFFINITY_2 \
          --network-auto-configuration=stack-type=STACK_TYPE

- Create a high availability controller by using a sole-tenant node group:

      gcloud preview compute ha-controllers create HA_CONTROLLER_NAME \
          --region=REGION \
          --instance-name=INSTANCE_NAME \
          --failover-initiation=FAILOVER_INITIATION \
          --zone-configuration=zone=PRIMARY_ZONE,node-group=PRIMARY_NODE_GROUP \
          --zone-configuration=zone=SECONDARY_ZONE,node-group=SECONDARY_NODE_GROUP \
          --network-auto-configuration=stack-type=STACK_TYPE

- Create a high availability controller by using on-demand capacity:

      gcloud preview compute ha-controllers create HA_CONTROLLER_NAME \
          --region=REGION \
          --instance-name=INSTANCE_NAME \
          --failover-initiation=FAILOVER_INITIATION \
          --zone-configuration=zone=PRIMARY_ZONE \
          --zone-configuration=zone=SECONDARY_ZONE \
          --network-auto-configuration=stack-type=STACK_TYPE

Replace the following:

- `HA_CONTROLLER_NAME`: the name for the high
  availability controller.

- `REGION`: the region where your VM exists.

- `INSTANCE_NAME`: the name of the running VM that you
  want the high availability controller to manage. To
  [convert attached zonal disks to regional disks](https://docs.cloud.google.com/compute/docs/instances/about-ha-controllers.md.txt#disk-conversion),
  which stops and restarts the VM when you create the high availability
  controller, include the `--migrate-disks-to-regional` flag:

      --migrate-disks-to-regional

- `FAILOVER_INITIATION`: how the high availability
  controller triggers a failover. Specify one of the following values:

  - To trigger failovers when a zonal outage occurs, the VM remains in
    the `REPAIRING` state for over 10 minutes, or you request a
    failover: `automatic`

  - To trigger failovers only when you request them: `manual-only`

- `PRIMARY_ZONE` and `SECONDARY_ZONE`:
  the primary zone where your VM runs and the secondary zone where the
  high availability controller maintains a capacity guarantee for
  failovers. Both zones must reside in the same region as the VM.

- `RESERVATION_AFFINITY_1` and
  `RESERVATION_AFFINITY_2`: the reservation affinity
  for the primary and secondary zones. For the primary zone, the
  reservation affinity must match the reservation configuration on your
  VM. Specify one of the following values:

  - To automatically consume any matching reservation: `any-reservation`

  - To consume a specific reservation: `specific-reservation`

  - To not consume any reservation: `no-reservation`

  If you specify `specific-reservation`, then you must also specify the
  name of the specifically targeted reservation that you want to consume.
  For the primary zone, the target reservation must match the reservation
  that your VM consumes. To specify the reservation, add the `reservation`
  attribute to the `--zone-configuration` flag as in the following
  example:

      --zone-configuration=zone=us-central1-a,reservation-affinity=specific-reservation,reservation=RESERVATION_URL

  Replace `RESERVATION_URL` with the URL of the
  reservation. Specify one of the following values:
  - If the reservation resides in your project:
    `RESERVATION_NAME`

  - If the reservation resides in a different project and your project
    can consume it:
    `projects/OWNER_PROJECT_NUMBER/reservations/RESERVATION_NAME`

- `PRIMARY_NODE_GROUP` and
  `SECONDARY_NODE_GROUP`: the names of the sole-tenant
  node groups that you want to use in the primary and secondary zones.

- `STACK_TYPE`: the IP address versions that the high
  availability controller uses for automatic network configuration. This
  value must match the IP stack type of the VM's network interface.
  Specify one of the following values:

  - To use only IPv4 addresses: `ipv4-only`

  - To use only IPv6 addresses: `ipv6-only`

  - To use both IPv4 and IPv6 addresses: `ipv4-ipv6`

  By default, Compute Engine assigns an ephemeral internal IP
  address to the forwarding rule that the high availability controller
  creates. To assign a specific internal IP address instead, include the
  following attributes in the flag:
  - To assign a specific IPv4 address, add the `address` attribute to
    the `--network-auto-configuration` flag as follows:

        --network-auto-configuration=stack-type=ipv4-only,address=IPV4_ADDRESS

    Replace `IPV4_ADDRESS` with the specific IPv4
    address.
  - To assign a specific IPv6 address, add the `internal-ipv6-address`
    attribute to the `--network-auto-configuration` flag as follows:

        --network-auto-configuration=stack-type=ipv6-only,internal-ipv6-address=IPV6_ADDRESS

    Replace `IPV6_ADDRESS` with the specific IPv6
    address.

Optionally, you can do one or both of the following:

- To use an existing regional backend service instead of automatic network
  configuration, replace the `--network-auto-configuration` flag with the
  `--backend-service` flag:

      --backend-service=BACKEND_SERVICE

  Replace `BACKEND_SERVICE` with the name or URL of the
  backend service.
- To assign specific internal IP addresses to the VM's network interfaces
  in the secondary zone instead of ephemeral internal IP addresses,
  include the `--instance-network-interface` flag for both the primary and
  secondary zones:

  - To assign internal IPv4 addresses to a network interface, include
    the following flags:

        --instance-network-interface=zone=PRIMARY_ZONE,name=NIC_NAME,address=PRIMARY_IPV4_ADDRESS \
        --instance-network-interface=zone=SECONDARY_ZONE,name=NIC_NAME,address=SECONDARY_IPV4_ADDRESS

  - To assign internal IPv6 addresses to a network interface, include
    the following flags:

        --instance-network-interface=zone=PRIMARY_ZONE,name=NIC_NAME,internal-ipv6-address=PRIMARY_IPV6_ADDRESS \
        --instance-network-interface=zone=SECONDARY_ZONE,name=NIC_NAME,internal-ipv6-address=SECONDARY_IPV6_ADDRESS

  Replace the following:
  - `NIC_NAME`: the name of an existing network
    interface on the VM, from `nic0` to `nic7`. Repeat the
    `--instance-network-interface` flag for each network interface that
    you want to configure. To assign both IPv4 and IPv6 addresses to a
    dual-stack interface, include both `address` and
    `internal-ipv6-address` in the same flag. Any network interface that
    you omit gets an ephemeral internal IP address in the secondary
    zone. In the primary zone, the controller records the interface's
    current IP address.

  - `PRIMARY_IPV4_ADDRESS` and
    `PRIMARY_IPV6_ADDRESS`: the current internal IPv4
    or IPv6 address assigned to `NIC_NAME` on the VM
    in the primary zone.

  - `SECONDARY_IPV4_ADDRESS` and
    `SECONDARY_IPV6_ADDRESS`: the internal IPv4 or
    IPv6 address to assign to `NIC_NAME` on the VM in
    the secondary zone. Because the controller doesn't reserve IP
    addresses or promote ephemeral IP addresses, Google recommends that
    you
    [reserve a static internal IP address](https://docs.cloud.google.com/compute/docs/ip-addresses/configure-static-internal-ip-address.md.txt).
    This reservation prevents other resources from using the address
    while your VM runs in the primary zone. Both zones must configure
    the same network interfaces and the same IP address versions.

### Terraform

To create a high availability controller, use the
[`google_compute_ha_controller` resource](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/compute_ha_controller).

Based on the method that you want to use to create the high availability
controller, use one of the following examples. If you use reservations, then
the reservation configuration for the primary zone must match the
reservation configuration on your VM:

- Create a high availability controller by using reservations:

  ```terraform
  resource "google_compute_ha_controller" "ha_controller" {
    provider            = google-nightly
    name                = "hac-rv"
    description         = "HA Controller Reservations Example"
    region              = "us-central1"
    instance_name       = google_compute_instance.vm.name
    failover_initiation = "MANUAL_ONLY"

    networking_auto_configuration {
      internal {
        stack_type = "IPV4_ONLY"
      }
    }

    # Reservations in both zones must have the same name; otherwise, you encounter
    # errors after a failover because the Terraform state no longer matches your
    # configuration.
    zone_configuration {
      zone = "us-central1-a"
      reservation_affinity {
        type = "SPECIFIC_RESERVATION"
        specific_reservation {
          key    = "compute.googleapis.com/reservation-name"
          values = [google_compute_reservation.reservation_zone1.name]
        }
      }
    }

    zone_configuration {
      zone = "us-central1-b"
      reservation_affinity {
        type = "SPECIFIC_RESERVATION"
        specific_reservation {
          key    = "compute.googleapis.com/reservation-name"
          values = [google_compute_reservation.reservation_zone2.name]
        }
      }
    }

    # To recreate the VMs, Compute Engine must delete the HA Controller first.
    lifecycle {
      replace_triggered_by = [
        google_compute_instance.vm.id
      ]
    }
  }
  ```
- Create a high availability controller by using a sole-tenant node group:

  ```terraform
  resource "google_compute_ha_controller" "ha_controller" {
    provider            = google-nightly
    name                = "hac-st"
    description         = "HA Controller Sole-Tenancy Example"
    region              = "us-central1"
    instance_name       = google_compute_instance.vm.name
    failover_initiation = "MANUAL_ONLY"

    zone_configuration {
      zone = "us-central1-a"
      node_affinities {
        key      = "workload"
        operator = "IN"
        values   = ["synthetic"]
      }
    }

    zone_configuration {
      zone = "us-central1-b"
      node_affinities {
        key      = "workload"
        operator = "IN"
        values   = ["synthetic"]
      }
    }

    # To recreate the VMs, Compute Engine must delete the HA Controller first.
    lifecycle {
      replace_triggered_by = [
        google_compute_instance.vm.id
      ]
    }
  }
  ```
- Create a high availability controller by using on-demand capacity:

  ```terraform
  resource "google_compute_ha_controller" "ha_controller" {
    provider            = google-nightly
    name                = "hac-bs"
    description         = "HA Controller Basic Example"
    region              = "us-central1"
    instance_name       = google_compute_instance.vm.name
    failover_initiation = "MANUAL_ONLY"

    zone_configuration {
      zone = "us-central1-a"
    }

    zone_configuration {
      zone = "us-central1-b"
    }

    # To recreate the VMs, Compute Engine must delete the HA Controller first.
    lifecycle {
      replace_triggered_by = [
        google_compute_instance.vm.id
      ]
    }
  }
  ```

For more information about how to use Terraform, see
[Using Terraform with Google Cloud](https://docs.cloud.google.com/docs/terraform.md.txt).

### REST

To create a high availability controller from scratch, make a `POST` request
to the
[preview `haControllers.insert` method](https://docs.cloud.google.com/compute/docs/reference/rest/2026-10-01-preview/haControllers/insert.md.txt)
with the `$apiVersion=2026-10-01-preview` query parameter in the request
URL.

Based on the method that you want to use to create the high availability
controller, make a request as follows:

- To create a high availability controller by using reservations, make a
  request as follows:

      POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/regions/REGION/haControllers?$apiVersion=2026-10-01-preview

      {
        "name": "HA_CONTROLLER_NAME",
        "instanceName": "INSTANCE_NAME",
        "failoverInitiation": "FAILOVER_INITIATION",
        "zoneConfigurations": {
          "PRIMARY_ZONE": {
            "reservationAffinity": {
              "consumeReservationType": "RESERVATION_AFFINITY_1"
            }
          },
          "SECONDARY_ZONE": {
            "reservationAffinity": {
              "consumeReservationType": "RESERVATION_AFFINITY_2"
            }
          }
        },
        "networkingAutoConfiguration": {
          "internal": {
            "stackType": "STACK_TYPE"
          }
        },
        "params": {
          "migrateDisksToRegional": MIGRATE_DISKS_TO_REGIONAL
        }
      }

- To create a high availability controller by using a sole-tenant node
  group, make a request as follows:

      POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/regions/REGION/haControllers?$apiVersion=2026-10-01-preview

      {
        "name": "HA_CONTROLLER_NAME",
        "instanceName": "INSTANCE_NAME",
        "failoverInitiation": "FAILOVER_INITIATION",
        "zoneConfigurations": {
          "PRIMARY_ZONE": {
            "nodeAffinities": [
              {
                "key": "compute.googleapis.com/node-group-name",
                "operator": "IN",
                "values": [
                  "PRIMARY_NODE_GROUP"
                ]
              }
            ]
          },
          "SECONDARY_ZONE": {
            "nodeAffinities": [
              {
                "key": "compute.googleapis.com/node-group-name",
                "operator": "IN",
                "values": [
                  "SECONDARY_NODE_GROUP"
                ]
              }
            ]
          }
        },
        "networkingAutoConfiguration": {
          "internal": {
            "stackType": "STACK_TYPE"
          }
        },
        "params": {
          "migrateDisksToRegional": MIGRATE_DISKS_TO_REGIONAL
        }
      }

- To create a high availability controller by using on-demand capacity,
  make a request as follows:

      POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/regions/REGION/haControllers?$apiVersion=2026-10-01-preview

      {
        "name": "HA_CONTROLLER_NAME",
        "instanceName": "INSTANCE_NAME",
        "failoverInitiation": "FAILOVER_INITIATION",
        "zoneConfigurations": {
          "PRIMARY_ZONE": {},
          "SECONDARY_ZONE": {}
        },
        "networkingAutoConfiguration": {
          "internal": {
            "stackType": "STACK_TYPE"
          }
        },
        "params": {
          "migrateDisksToRegional": MIGRATE_DISKS_TO_REGIONAL
        }
      }

Replace the following:

- `PROJECT_ID`: the ID of your project.

- `REGION`: the region where your VM resides.

- `HA_CONTROLLER_NAME`: the name of the high availability
  controller that you want to create.

- `INSTANCE_NAME`: the name of the running VM that you
  want the high availability controller to manage.

- `FAILOVER_INITIATION`: how the high availability
  controller triggers a failover. Specify one of the following values:

  - To trigger failovers when a zonal outage occurs, the VM remains in
    the `REPAIRING` state for over 10 minutes, or you request a
    failover: `AUTOMATIC`

  - To trigger failovers only when you request them: `MANUAL_ONLY`

- `PRIMARY_ZONE` and `SECONDARY_ZONE`:
  the primary zone where your VM runs and the secondary zone where the
  high availability controller maintains a capacity guarantee for
  failovers. Both zones must reside in the same region as the VM.

- `RESERVATION_AFFINITY_1` and
  `RESERVATION_AFFINITY_2`: the reservation affinity
  for the primary and secondary zones. For the primary zone, the
  reservation affinity must match the reservation configuration on your
  VM. Specify one of the following values:

  - To automatically consume any matching reservation: `ANY_RESERVATION`

  - To consume a specific reservation: `SPECIFIC_RESERVATION`

  - To not consume any reservation: `NO_RESERVATION`

  If you specify `SPECIFIC_RESERVATION`, then you must also specify the
  name of the targeted reservation that you want to consume. For the
  primary zone, the target reservation must match the reservation that
  your VM consumes. To specify the reservation, set the
  `reservationAffinity.key` field to
  `"compute.googleapis.com/reservation-name"`, not
  `"googleapis.com/reservation-name"`, and add the
  `reservationAffinity.values` field as follows:

      "reservationAffinity": {
        "consumeReservationType": "SPECIFIC_RESERVATION",
        "key": "compute.googleapis.com/reservation-name",
        "values": [
          "RESERVATION_URL"
        ]
      }

  Replace `RESERVATION_URL` with the URL of the
  reservation. Specify one of the following values:
  - If the reservation resides in your project:
    `RESERVATION_NAME`

  - If the reservation resides in a different project and your project
    can consume it:
    `projects/OWNER_PROJECT_NUMBER/reservations/RESERVATION_NAME`

- `PRIMARY_NODE_GROUP` and
  `SECONDARY_NODE_GROUP`: the names of the sole-tenant
  node groups that you want to use in the primary and secondary zones.

- `STACK_TYPE`: the IP address versions that the high
  availability controller uses for automatic network configuration. This
  value must match the IP stack type of the VM's network interface.
  Specify one of the following values:

  - To use only IPv4 addresses: `IPV4_ONLY`

  - To use only IPv6 addresses: `IPV6_ONLY`

  - To use both IPv4 and IPv6 addresses: `IPV4_IPV6`

  By default, Compute Engine assigns an ephemeral internal IP
  address to the forwarding rule that the high availability controller
  creates. To assign a specific internal IP address instead, include one
  or both of the following fields in
  `networkingAutoConfiguration.internal`:
  - To assign a specific IPv4 address, add the `ipAddress` field as
    follows:

        "networkingAutoConfiguration": {
          "internal": {
            "stackType": "IPV4_ONLY",
            "ipAddress": "IPV4_ADDRESS"
          }
        }

    Replace `IPV4_ADDRESS` with the specific IPv4
    address.
  - To assign a specific IPv6 address, add the `ipv6Address` field as
    follows:

        "networkingAutoConfiguration": {
          "internal": {
            "stackType": "IPV6_ONLY",
            "ipv6Address": "IPV6_ADDRESS"
          }
        }

    Replace `IPV6_ADDRESS` with the specific IPv6
    address.
- `MIGRATE_DISKS_TO_REGIONAL`: whether to
  [convert the VM's zonal disks to regional disks](https://docs.cloud.google.com/compute/docs/instances/about-ha-controllers.md.txt#disk-conversion),
  which stops and restarts the VM. Specify one of the following values:

  - To convert the VM's disks to regional disks: `true`

  - To not convert the VM's disks to regional disks: `false`

Optionally, you can do one or both of the following in the request body:

- To use an existing regional backend service instead of automatic network
  configuration, replace the `networkingAutoConfiguration` field with the
  `backendServices` field:

      "backendServices": [
        "projects/PROJECT_ID/regions/REGION/backendServices/BACKEND_SERVICE"
      ]

  Replace `BACKEND_SERVICE` with the name of the backend
  service.
- To assign specific internal IP addresses to the VM's network interfaces
  in the secondary zone instead of ephemeral internal IP addresses, add
  the `instanceNetworkInterfaces` field to both
  `PRIMARY_ZONE` and `SECONDARY_ZONE` in
  the `zoneConfigurations` field as follows:

      "zoneConfigurations": {
        "PRIMARY_ZONE": {
          "instanceNetworkInterfaces": {
      "NIC_NAME": {
      "networkIP": "PRIMARY_IPV4_ADDRESS",
      "ipv6Address": "PRIMARY_IPV6_ADDRESS"
      }
      }
        },
        "SECONDARY_ZONE": {
          "instanceNetworkInterfaces": {
      "NIC_NAME": {
      "networkIP": "SECONDARY_IPV4_ADDRESS",
      "ipv6Address": "SECONDARY_IPV6_ADDRESS"
      }
      }
        }
      }

  Replace the following:
  - `NIC_NAME`: the name of an existing network
    interface on the VM, from `nic0` to `nic7`. Any network interface
    that you omit gets an ephemeral internal IP address in the secondary
    zone. In the primary zone, the controller records the interface's
    current IP address.

  - `PRIMARY_IPV4_ADDRESS` and
    `PRIMARY_IPV6_ADDRESS`: the current internal IPv4
    or IPv6 address assigned to `NIC_NAME` on the VM
    in the primary zone. Omit `networkIP` or `ipv6Address` if the
    network interface doesn't use that IP version.

  - `SECONDARY_IPV4_ADDRESS` and
    `SECONDARY_IPV6_ADDRESS`: the internal IPv4 or
    IPv6 address to assign to `NIC_NAME` on the VM in
    the secondary zone. Because the controller doesn't reserve IP
    addresses or promote ephemeral IP addresses, Google recommends that
    you
    [reserve a static internal IP address](https://docs.cloud.google.com/compute/docs/ip-addresses/configure-static-internal-ip-address.md.txt).
    This reservation prevents other resources from using the address
    while your VM runs in the primary zone. Both zones must configure
    the same network interfaces and the same IP address versions.

### Create a high availability controller based on an existing controller

To create a high availability controller based on the configuration of an
existing controller, export the configuration of the existing controller to a
YAML file, and then create a new controller by using the YAML file. To do so,
complete the following steps:

> [!NOTE]
> **Note:** To convert the zonal disks attached to your VM to regional disks when you create a high availability controller, [create the controller from scratch](https://docs.cloud.google.com/compute/docs/instances/create-ha-controller.md.txt#create-scratch).

1. To export the configuration of an existing high availability controller to a
   YAML file, use the
   [`gcloud preview compute ha-controllers export` command](https://docs.cloud.google.com/sdk/gcloud/reference/preview/compute/ha-controllers/export):

       gcloud preview compute ha-controllers export EXISTING_HA_CONTROLLER_NAME \
           --region=REGION \
           --destination=YAML_FILE_PATH

   Replace the following:
   - `EXISTING_HA_CONTROLLER_NAME`: the name of the
     existing high availability controller.

   - `REGION`: the region where the high availability
     controller exists.

   - `YAML_FILE_PATH`: the path to the YAML file where you
     want to export the configuration options of the existing high
     availability controller.

2. In the YAML file, update `instanceName` to the name of the VM that you want
   the new controller to manage. If you omit `instanceName`, then
   Compute Engine uses the name of the new high availability controller
   as the VM name. Update the reservation configuration for the primary zone so
   that it matches the reservation configuration on the VM, remove or update
   any IP addresses that belong to the existing controller (such as `ipAddress`
   or `ipv6Address` in `networkingAutoConfiguration`), and modify any other
   options as needed. The YAML is similar to the following:

   ```yaml
   failoverInitiation: AUTOMATIC
   instanceName: example-vm
   name: example-hac-1
   networkingAutoConfiguration:
     stackType: IPV4_ONLY
   zoneConfiguration:
     us-central1-a:
       reservationAffinity:
         consumeReservationType: SPECIFIC_RESERVATION
         key: compute.googleapis.com/reservation-name
         values:
         - reservation-1
     us-central1-b:
       reservationAffinity:
         consumeReservationType: SPECIFIC_RESERVATION
         key: compute.googleapis.com/reservation-name
         values:
         - reservation-2
   ```
3. To create the high availability controller by using the YAML file that you
   exported in the previous step, use the
   [`gcloud preview compute ha-controllers import` command](https://docs.cloud.google.com/sdk/gcloud/reference/preview/compute/ha-controllers/import):

       gcloud preview compute ha-controllers import HA_CONTROLLER_NAME \
           --region=REGION \
           --source=YAML_FILE_PATH

   Replace the following:
   - `HA_CONTROLLER_NAME`: the name of the high availability
     controller that you want to create.

   - `REGION`: the region where you want to create the high
     availability controller and where the VM resides.

   - `YAML_FILE_PATH`: the path to the YAML file that you
     exported in the previous step.

## Configure network traffic after creation

After you create a high availability controller, complete the following steps so
that the controller can redirect traffic to the secondary zone during a
failover:

1. If the high availability controller uses automatic network configuration,
   then
   [view the details of the controller](https://docs.cloud.google.com/compute/docs/instances/view-ha-controllers.md.txt#view-details)
   and find the forwarding rule's internal IP address in the
   `networkingAutoConfiguration.internal.ipAddress` or
   `networkingAutoConfiguration.internal.ipv6Address` field.

2. Configure your clients or DNS records to send traffic to the internal IP
   address of the forwarding rule instead of the `nic0` IP address of the VM.
   Because active connections to the VM drop during a failover, also configure
   your clients to retry dropped connections.

3. If your workload communicates with on-premises systems over
   Cloud Interconnect or Cloud VPN, then configure your on-premises
   firewalls before a failover occurs:

   - **Inbound traffic**: permit traffic to the internal IP address of the
     forwarding rule.

   - **Outbound traffic**: because the VM uses a different internal IP
     address in the secondary zone than in the primary zone, permit outbound
     traffic from either of the following:

     - The Classless Inter-Domain Routing (CIDR) range of the VM's subnet,
       which covers the VM in both the primary and secondary zones. To find
       the subnet's CIDR range, see
       [Describe a subnet](https://docs.cloud.google.com/vpc/docs/create-modify-vpc-networks.md.txt#describing_an_existing_subnet).

     - The static internal IP addresses of the VM in both the primary and
       secondary zones, if you reserved and assigned static internal IP
       addresses when you created the controller.

## What's next

- [View high availability controllers](https://docs.cloud.google.com/compute/docs/instances/view-ha-controllers.md.txt)

- [Trigger a failover for a high availability controller](https://docs.cloud.google.com/compute/docs/instances/trigger-ha-controller-failover.md.txt)

- [Modify a high availability controller](https://docs.cloud.google.com/compute/docs/instances/modify-ha-controller.md.txt)

- [Back up disks to a backup vault](https://docs.cloud.google.com/backup-disaster-recovery/docs/cloud-console/compute/disk-backup.md.txt)

- [Troubleshoot high availability controllers](https://docs.cloud.google.com/compute/docs/troubleshooting/ha-controllers.md.txt)