> [!WARNING]
> **Preview**
>
>
> This feature is subject to the "Pre-GA Offerings Terms" in the General
> Service Terms section of the
> [Service Specific
> Terms](https://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).
>
>
> During Preview, Compute Engine doesn't charge the automatic capacity
> guarantee fee.

To minimize downtime and prevent data loss for applications that run on a single
virtual machine (VM) instance, use high availability controllers. High
availability controllers automate failovers across zones within a region for
stateful or legacy applications that run on a single VM. To increase
availability for stateless or distributed workloads that scale across multiple
VMs, use
[regional managed instance groups (MIGs)](https://docs.cloud.google.com/compute/docs/instance-groups/regional-migs.md.txt).

This document explains the requirements and limitations that apply to high
availability controllers. This document is intended for Cloud architects and IT
administrators who want to evaluate high availability options for critical
workloads that run on a single VM.

## Overview of high availability controllers

The high availability controller is a feature for Compute Engine that
you create and pair with an existing, running VM in a primary zone to protect
your workload against zonal disruptions. The controller configures your VM to
operate across two zones in the same region and maintains a capacity guarantee
for your VM in the secondary zone. If a disruption occurs in the primary zone or
if you trigger a failover, then the controller moves your VM to the secondary
zone. The controller starts the VM with your regional disks attached and
redirects network traffic to the VM.

The following diagram shows the architecture of a high availability controller
that manages a VM across a primary zone and a secondary zone:

[![A high availability controller monitoring a primary zone and
secondary zone, with a network endpoint and regional disk connected
to both zones.](https://docs.cloud.google.com/static/compute/images/ha-controller-architecture.svg)](https://docs.cloud.google.com/static/compute/images/ha-controller-architecture.svg)

High availability controllers provide the following benefits:

- **Zero recovery point objective (RPO)** : you prevent data loss for data
  written to boot or non-boot disks because the VM that you pair with the high
  availability controller must use regional Persistent Disk or Hyperdisk Balanced High Availability volumes.
  These types of disks use
  [synchronous disk replication](https://docs.cloud.google.com/compute/docs/disks/about-regional-persistent-disk.md.txt)
  to copy data across two zones in a region.

  > [!CAUTION]
  > **Caution:** Compute Engine doesn't replicate uncommitted data in your VM's memory across zones. If an unplanned failover occurs, then any data that resides only in a VM's memory or in unflushed OS buffers is lost. To prevent data loss, configure your application or database to flush critical data directly to disks. For more information, review the [design considerations for high availability services](https://docs.cloud.google.com/compute/docs/disks/high-availability-regional-persistent-disk.md.txt#design-considerations).

- **Low recovery time objective (RTO)**: during a failover, the high
  availability controller starts your VM in the secondary zone and redirects
  network traffic to it, often within five minutes. If you configure your VM
  to mount its disks and start your application on boot, then your application
  recovers without manual intervention.

- **Guaranteed failover capacity**: the high availability controller helps
  guarantee capacity for your VM in the secondary zone, either by using a
  reservation or sole-tenant node group that you provide, or by holding
  capacity in the secondary zone.

## When to use high availability controllers

High availability controllers monitor physical infrastructure and zonal health
to protect workloads that run on a single VM without changing your application.
They don't detect in-guest application crashes, OS kernel panics, or regional
outages. If you configure a high availability controller to automatically start
a failover after a host error or a maintenance operation that lasts longer than
10 minutes, then the controller triggers a failover to protect your VM against
the following:

- **Hardware faults on the host** : failures of the CPU, memory, motherboard,
  local drive, or hypervisor that keep the VM in the `REPAIRING` state for
  over 10 minutes.

- **Network and rack failures**: damaged network cards, broken fiber links, or
  faults in top-of-rack switches that isolate the physical server or rack.

For short-lived events in the primary zone that recover within 10 minutes, such
as storage cluster faults or standard host maintenance, Compute Engine
resolves the issue in place. Compute Engine uses synchronous disk
replication, live migration, or automatic VM restarts. Because these events
return the VM to service in the primary zone, the high availability controller
doesn't trigger a failover.

## Failover configurations

When you create a high availability controller, you can specify how the
controller triggers a failover:

- **Automatic or manual failovers**: the controller starts an automatic
  failover when a primary-zone failure or host maintenance event lasts longer
  than 10 minutes. You can also trigger a manual failover at any time.

  > [!CAUTION]
  > **Caution:** If the zone where your VM resides experiences a full outage, then the high availability controller might not start an automatic failover. If automatic failover doesn't start, then [trigger a manual failover](https://docs.cloud.google.com/compute/docs/instances/trigger-ha-controller-failover.md.txt).

- **Manual failovers only**: the controller initiates a failover only when you
  manually trigger it. For example, you can trigger a failover to test your
  setup, migrate your workload before primary zone maintenance, or return your
  workload to the original zone.

Compute Engine writes audit logs when a high availability controller
changes state, detects an unhealthy VM, or starts or completes a failover. By
default, Compute Engine doesn't send push notifications for these
events. To view these logs or configure log-based alerts, see
[View audit logs for a high availability controller](https://docs.cloud.google.com/compute/docs/instances/view-ha-controllers.md.txt#view-logs).

## Stages of a high availability controller

After you create a high availability controller, it goes through the following
operational stages:

1. **Stable stage**: your VM runs in the primary zone, and its regional disks
   replicate data across both the primary and secondary zones. The high
   availability controller monitors the VM and the primary zone for
   infrastructure issues, and maintains a capacity guarantee in the secondary
   zone.

2. **Failover stage** : a failover begins when you trigger it, when a zonal
   outage occurs, or when the VM stays in the `REPAIRING` state for over 10
   minutes. The high availability controller moves your VM from the primary
   zone to the secondary zone through the following sequence:

   1. The high availability controller force-attaches the regional disks in
      the secondary zone without waiting for the primary zone to detach them.
      This operation blocks any further disk writes from the primary zone.

   2. The high availability controller starts the VM in the secondary zone
      with the same name, machine configuration, and
      [Resource Manager tags](https://docs.cloud.google.com/compute/docs/tag-resources.md.txt) that the VM used in the
      primary zone.

   3. The high availability controller redirects network traffic to the VM in
      the secondary zone, and then stops the VM and detaches the disks in the
      original primary zone. If a zonal outage is ongoing in the original
      primary zone, then the controller waits until the outage ends to clean
      up resources in that zone.

3. **Post-failover stage**: the failover is complete. Your VM runs in the
   secondary zone, which becomes the new primary zone. The original primary
   zone becomes the new secondary zone. After the new secondary zone recovers
   from the disruption, the high availability controller maintains a capacity
   guarantee in that zone for future failovers.

If you [stop the VM](https://docs.cloud.google.com/compute/docs/instances/stop-start-instance.md.txt) in the primary
zone while no failover is in progress, then the high availability controller
stops and releases the capacity that it holds in the secondary zone. When you
restart the VM, the controller reallocates capacity in the secondary zone and
resumes monitoring. To view the current `state` value of a high availability
controller at any stage, see
[View high availability controllers](https://docs.cloud.google.com/compute/docs/instances/view-ha-controllers.md.txt).

## Network redirection options

In the subnet where your VM resides, the high availability controller uses the
following types of internal IP addresses:

- An internal IP address for your VM in the secondary zone.

- A shared internal IP address on an internal forwarding rule that routes
  traffic between the two zones to whichever zone is active. External shared
  IP addresses aren't supported.

To help ensure that network traffic redirects to the secondary zone during a
failover, you must configure your clients or DNS records to send traffic to the
shared internal IP address of the forwarding rule. Don't connect clients to the
`nic0` IP address of the VM in either zone; otherwise, client connections fail
when the high availability controller moves your VM to the secondary zone. When
you create a high availability controller, you choose between two options to
configure the shared internal IP address:

- **Automatic network configuration** : Compute Engine creates and
  manages zonal network endpoint groups (NEGs), a regional internal backend
  service, and an internal forwarding rule with a shared internal IP address
  in the `networkingAutoConfiguration.internal.ipAddress` or
  `networkingAutoConfiguration.internal.ipv6Address` field. After you
  configure your clients to connect to this shared IP address, the high
  availability controller redirects network traffic to the secondary zone
  during a failover without requiring any action from you.

- **Regional backend service** : you provide an existing regional backend
  service for an
  [internal passthrough Network Load Balancer](https://docs.cloud.google.com/load-balancing/docs/internal.md.txt)
  that has `haPolicy` enabled, no backends attached, and your own internal
  forwarding rule. The high availability controller creates zonal NEGs,
  attaches your VM to the backend service, and updates the backend service
  during a failover to route traffic to the active zone.

By default, Compute Engine assigns ephemeral internal IP addresses to
the network interfaces, from `nic0` to `nic7`, on the VM in the secondary zone.
When you create a high availability controller, you can specify the internal
IPv4 and IPv6 addresses that each network interface uses in the primary and
secondary zones. Because the controller doesn't reserve IP addresses or convert
ephemeral IP addresses to static IP addresses, Google recommends that you
[reserve static internal IP addresses](https://docs.cloud.google.com/compute/docs/ip-addresses/configure-static-internal-ip-address.md.txt)
for both zones. This reservation prevents other resources from claiming the
secondary zone's IP address while your VM runs in the primary zone.

## Conversion of zonal disks to regional disks

A VM that you pair with a high availability controller must use regional
Standard or Balanced Persistent Disk volumes, or Hyperdisk Balanced High Availability volumes. If your VM uses
a machine series that supports these regional disk types and has supported
zonal disks attached, then you can convert the zonal disks to regional disks
when you create the controller. To check which regional disk types a machine
series supports, see
[Machine series comparison](https://docs.cloud.google.com/compute/docs/machine-resource.md.txt#machine_type_comparison).

The following table lists the zonal disk types that you can convert when you
create a high availability controller:

| Attached zonal disk type | Converted regional disk type |
|---|---|
| Zonal Standard Persistent Disk | Regional Standard Persistent Disk, or regional Balanced Persistent Disk for a disk smaller than 200 GB |
| Zonal Balanced Persistent Disk | Regional Balanced Persistent Disk |
| Zonal Hyperdisk Balanced | Hyperdisk Balanced High Availability |

Automatic conversion isn't supported for other zonal disk types, CSEK-encrypted
disks, or Hyperdisk Balanced disks that have Confidential mode enabled. To use data from an
unsupported zonal disk, migrate the disk to a
[Hyperdisk Balanced High Availability volume](https://docs.cloud.google.com/compute/docs/disks/migrate-to-hyperdisk.md.txt#migrate-to-hdbha) or
a
[regional Standard or Balanced Persistent Disk volume](https://docs.cloud.google.com/compute/docs/disks/regional-persistent-disk.md.txt#migrate-repd)
before you create the high availability controller. You can't pair a high
availability controller with a VM that has regional SSD Persistent Disk volumes or
Local SSD disks attached.

The following sections describe how Compute Engine converts zonal disks
to regional disks, as well as how it handles disk metadata and configuration.

### Conversion process

When you convert zonal disks to regional disks during controller creation,
Compute Engine performs the following sequence before it creates the
controller:

1. Compute Engine stops the VM in the primary zone.

2. For each zonal disk that is attached to the VM, Compute Engine
   creates a corresponding regional Persistent Disk or Hyperdisk Balanced High Availability volume named
   `r-DISK_NAME` across the primary and secondary zones.
   `DISK_NAME` is the name of the original zonal disk. If a
   regional disk with that name already exists, then the disk conversion fails.

3. Compute Engine detaches the zonal disks from the VM, attaches the
   new regional disks to the VM, and then restarts the VM.

   > [!CAUTION]
   > **Caution:** Compute Engine doesn't delete the detached zonal disks. To avoid unnecessary charges for those zonal disks, delete them after you verify the configurations of your high availability controller and its managed VM.

### Disk metadata, snapshot schedules, and encryption

When Compute Engine converts zonal disks to regional disks, it handles
disk metadata and configuration as follows:

- **Snapshot schedules** : Compute Engine attaches existing snapshot
  schedules in the `resourcePolicies` field to the new regional disks. The
  schedules also remain attached to the original, detached zonal disks. To
  avoid snapshot charges for idle disks, delete the detached zonal disks or
  remove their snapshot schedules.

- **Labels and descriptions**: Compute Engine copies all key-value
  labels and the disk description to the new regional disks.

- **Disk performance**: when Compute Engine converts a zonal disk to a
  regional disk, the new regional disk might have lower performance limits
  than the original zonal disk:

  - **Hyperdisk Balanced volumes** : Compute Engine doesn't copy the provisioned
    IOPS and throughput from the zonal Hyperdisk Balanced volume. Instead,
    Compute Engine provisions the new Hyperdisk Balanced High Availability volume with the
    [default IOPS and throughput limits](https://docs.cloud.google.com/compute/docs/disks/hd-types/hyperdisk-balanced-ha.md.txt#default-perf)
    based on its size. After conversion, you can
    [modify the provisioned IOPS and throughput](https://docs.cloud.google.com/compute/docs/disks/modify-hyperdisks.md.txt)
    up to the maximum limits for Hyperdisk Balanced High Availability, which are lower than the maximum
    limits for zonal Hyperdisk Balanced. For more information, see
    [Performance of Hyperdisk Balanced High Availability volumes cloned from zonal disks](https://docs.cloud.google.com/compute/docs/disks/clone-duplicate-disks.md.txt#zonal-to-regional-hd-perf).

  - **Standard and Balanced Persistent Disk volumes** : performance scales with
    disk size, but regional Persistent Disk volumes have lower maximum IOPS and
    throughput limits than zonal Persistent Disk volumes of the same size. For
    more information, see
    [Regional Persistent Disk volumes cloned from zonal Persistent Disk volumes](https://docs.cloud.google.com/compute/docs/disks/clone-duplicate-disks.md.txt#regional-pd-perf).

- **Encryption**: Compute Engine preserves customer-managed encryption
  keys (CMEK) on the new regional disks. You can't convert disks encrypted
  with customer-supplied encryption keys (CSEK).

- **Resource Manager tags**: tag bindings on the zonal disks don't transfer to the
  new regional disks. If you use Resource Manager tags on your disks, then
  you must reapply them to the regional disks.

- **Existing snapshots**: past snapshots taken from the zonal disks remain in
  your project and are unaffected.

## Pricing

You don't incur additional management charges for using a high availability
controller. Instead, you incur charges as follows:

- **Running VM in the primary zone**: you pay for only one running VM at any
  given time. You pay standard compute charges for the running VM in the
  primary zone, including charges for its memory, vCPUs, networking, and any
  attached GPUs. When a failover occurs, you incur charges for the running VM
  in the new primary zone. Charges in the original zone stop after the
  controller stops the VM in that zone.

- **Capacity guarantee in the secondary zone**: if you use a reservation or
  sole-tenant node group in the secondary zone, then you don't incur
  additional charges. If the controller provides an automatic capacity
  guarantee instead, then you incur charges for memory, vCPUs, and any
  attached GPUs at the same rate as your running VM.

  > [!NOTE]
  > **Note:** During Preview, Compute Engine doesn't charge the automatic capacity guarantee fee.

- **Regional storage**: you incur standard storage charges for the regional
  Persistent Disk or Hyperdisk Balanced High Availability volumes attached to your VM. Because regional
  disks replicate data across two zones, regional storage costs twice as much
  as zonal storage for the same disk type.

## Limitations

The following sections describe the limitations for high availability
controllers, the VMs that they manage, and failovers.

### Limitations for high availability controllers

When you create a high availability controller, the following limitations apply:

- **Service agent permissions** : high availability controllers require the
  Compute Engine service agent. If you remove this service agent or
  revoke its roles, then any attempt to trigger a failover fails. For more
  information, see [Service agents](https://docs.cloud.google.com/iam/docs/service-agents.md.txt).

- **Zonal DNS required** : if your project uses global DNS, then you must
  migrate your project to zonal DNS before you create a high availability
  controller. Otherwise, you can't create the controller. For more
  information, see
  [Migrate your projects to zonal DNS](https://docs.cloud.google.com/compute/docs/networking/migrate-to-zonal-dns.md.txt).

- **Replica zone alignment and single-region scope** : the primary and
  secondary zones in the high availability controller must reside in the same
  region and match the replica zones of the VM's regional disks. High
  availability controllers don't support cross-region failover. For disaster
  recovery across regions, you can pair your regional Persistent Disk volumes with
  [asynchronous disk replication](https://docs.cloud.google.com/compute/docs/disks/async-pd/about.md.txt) to a
  secondary region.

- **Immutable configurations**: after you create a high availability
  controller, you can update only its description or initiation method for
  failovers. If you want to change any other property, then you must delete
  and recreate the controller.

### Limitations for the VM

When you pair a VM with a high availability controller, the following
limitations apply:

- **Regional disks required**: your VM's disks must meet the following
  requirements:

  - You can only attach regional Standard or Balanced Persistent Disk volumes,
    or Hyperdisk Balanced High Availability volumes to your VM. If your VM uses zonal Standard or
    Balanced Persistent Disk volumes, or zonal Hyperdisk Balanced volumes, then you can
    [convert the attached zonal disks to regional disks](https://docs.cloud.google.com/compute/docs/instances/about-ha-controllers.md.txt#disk-conversion)
    when you create the controller.

  - You can't attach disks encrypted with customer-supplied encryption keys
    (CSEKs). If you want to manage your own encryption keys, then use
    [customer-managed encryption keys (CMEKs)](https://docs.cloud.google.com/compute/docs/disks/customer-managed-encryption.md.txt).

- **Multiple network interfaces** : your VM can use up to eight network
  interfaces, from `nic0` to `nic7`, and the high availability controller
  preserves all of them in the secondary zone. However, the controller
  configures traffic redirection by using automatic network configuration or
  a regional backend service only for `nic0`. For `nic1` through `nic7`, the
  controller doesn't provide a forwarding rule IP address to redirect traffic
  during a failover.

- **Unsupported Compute Engine instances**: high availability
  controllers don't support the following compute instances:

  - Bare metal instances, which use a machine type that ends with `-metal`.

  - VMs that use the spot, flex-start, or reservation-bound provisioning
    models.

  - VMs that use the `f1-micro` or `g1-small` machine types.

  - VMs that use machine series that don't support regional Persistent Disk or
    Hyperdisk Balanced High Availability volumes. To check which disk types a machine series supports,
    see
    [Machine series comparison](https://docs.cloud.google.com/compute/docs/machine-resource.md.txt#machine_type_comparison).

  - VMs that have Local SSD disks attached, either by default or by your
    configuration. To check which machine series have Local SSD disks
    attached by default, see
    [Add a Local SSD disk to your compute instance](https://docs.cloud.google.com/compute/docs/disks/add-local-ssd.md.txt).

  - VMs that have automatic restart disabled. For more information, see
    [Available host maintenance properties](https://docs.cloud.google.com/compute/docs/instances/setting-vm-host-options.md.txt#available-host-maintenance-properties).

  - VMs that have a time limit configured. For more information, see
    [Limit the run time of a VM](https://docs.cloud.google.com/compute/docs/instances/limit-vm-runtime.md.txt).

  - VMs that have deletion protection enabled. For more information, see
    [Prevent accidental VM deletion](https://docs.cloud.google.com/compute/docs/instances/preventing-accidental-vm-deletion.md.txt).

- **Operation locks on managed VMs** : when a high availability controller
  manages a VM, you can stop and start the VM in the primary zone, and you
  can
  [update VM properties](https://docs.cloud.google.com/compute/docs/instances/update-instance-properties.md.txt)
  while the VM is stopped. However, Compute Engine blocks requests to
  update the VM while it runs, and you can't suspend, reset, or delete the
  VM, or modify resources that the controller manages in the secondary zone.
  If you want to perform an unsupported operation on the VM, then you must
  delete the high availability controller first.

### Limitations for failovers

During a failover, Backup and DR Service backup plans that target the VM in the
original primary zone fail because the high availability controller detaches the
disks in that zone. Instead, back up your regional disks by using
[backup vaults](https://docs.cloud.google.com/backup-disaster-recovery/docs/cloud-console/compute/disk-backup.md.txt)
or [disk snapshots](https://docs.cloud.google.com/compute/docs/disks/create-snapshots.md.txt). To attach a regional
disk to a VM that a high availability controller manages, you must first
[stop the VM](https://docs.cloud.google.com/compute/docs/instances/stop-start-instance.md.txt).

## What's next

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

- [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)

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