Reduce costs using basic instances

By default, an AlloyDB for PostgreSQL primary instance is highly available (HA), with the ability to perform an automated failover to a standby node in the case of an outage. If your AlloyDB for PostgreSQL cluster does not require HA, then you have the option to reduce your operating costs by making the cluster's primary instance a basic instance, instead of an HA one.

This page provides an overview of basic instances. It also shows you how to perform the following procedures:

  • Create a basic instance within an AlloyDB cluster.

  • Change a basic instance into an HA instance, and vice-versa.

  • Determine whether a given instance is basic or HA.

For a more general overview of AlloyDB clusters and instances, see AlloyDB overview.

Overview of basic instances

A basic instance works exactly like an HA primary instance, with one key difference: it lacks a standby node. This simpler architecture makes a basic instance, also known as a zonal instance, cost less to operate than an HA instance.

Because of its single node, a basic instance lacks key high-availability features found in an HA primary instance:

  • No automated failover. If the zone that hosts a basic instance's active node has an outage, then the instance becomes unavailable to any queries until the outage ends. This behavior is in contrast with an HA primary instance, which responds to any outage of its active node by automatically turning the instance's standby node into the new active node.

  • Longer maintenance downtime. A basic instance requires up to two minutes of downtime during maintenance operations. In contrast, an HA primary instance typically has maintenance downtime of less than one second.

Basic instances are appropriate for use in development or staging environments, which don't necessarily need to provide high availability. Google strongly recommends using only HA instances, and not basic instances, in production deployments of AlloyDB clusters. The uptime guarantees provided by the AlloyDB SLA apply only to multi-zone instances. Since basic instances comprise only one node in a single zone, we cannot guarantee high availability for basic instances.

Create a cluster with a basic instance

Console

Follow the procedure described in Create a cluster and its primary instance, with the following modification:

After clicking Create cluster, select either Basic or Basic with read pool(s) as the cluster type. Then, proceed with the cluster creation process as usual.

gcloud

Follow the procedure described in Create a cluster and its primary instance, with the following modification:

When running the gcloud alloydb instances create command to create the new cluster's primary instance, add the argument --availability-type=ZONAL.

Create a basic instance for an existing cluster

Console

Follow the procedure described in Create a primary instance, with the following modification:

In the Configure primary instance pane, under Zonal availability, select Single zone.

gcloud

Follow the procedure described in Create a primary instance, with the following modification:

When running the gcloud alloydb instances create command to create the primary instance, add the argument --availability-type=ZONAL.

Upgrade a basic instance to an HA instance

This operation effectively brings a new node online, and sets it as the instance's standby.

Console

  1. Go to the Clusters page.

    Go to Clusters

  2. Click the Actions column of the primary instance that you want to upgrade from basic to HA.

  3. Select Edit.

  4. In the Edit primary instance pane, under Zonal availability, select Multiple zones (Highly available).

  5. Click Update instance.

gcloud

To use the gcloud CLI, you can install and initialize the Google Cloud CLI, or you can use Cloud Shell.

Use the gcloud alloydb instances update command to turn a basic instance into a highly available one.

gcloud alloydb instances update INSTANCE_ID \
--availability-type=REGIONAL
--region=REGION_ID \
--cluster=CLUSTER_ID \
--project=PROJECT_ID

Replace the following:

  • INSTANCE_ID: The ID of the instance that you are updating.

  • REGION_ID: The region where the instance is placed.

  • CLUSTER_ID: The ID of the cluster where the instance is placed.

  • PROJECT_ID: The ID of the project where the cluster is placed.

Downgrade an HA instance to a basic instance

This operation effectively takes the instance's standby node offline, leaving it with only its active node.

Console

  1. Go to the Clusters page.

    Go to Clusters

  2. Click the Actions column of the primary instance that you want to downgrade from HA to basic.

  3. Select Edit.

  4. In the Edit primary instance pane, under Zonal availability, select Single zone.

  5. Click Update instance.

gcloud

To use the gcloud CLI, you can install and initialize the Google Cloud CLI, or you can use Cloud Shell.

Use the gcloud alloydb instances update command to turn a basic instance into a highly available one.

gcloud alloydb instances update INSTANCE_ID \
--availability-type=ZONAL
--region=REGION_ID \
--cluster=CLUSTER_ID \
--project=PROJECT_ID

Replace the following:

  • INSTANCE_ID: The ID of the instance that you are updating.

  • REGION_ID: The region where the instance is placed.

  • CLUSTER_ID: The ID of the cluster where the instance is placed.

  • PROJECT_ID: The ID of the project where the cluster is placed.

Determine whether an instance is HA or basic

Console

  1. Follow the procedure described in View instance details.

  2. Find the High availability row in the instance's details table. It has one of the following values:

    • Highly available: This instance has more than one node across multiple zones, making it HA.

    • No: This instance has only one node, and is not HA.

gcloud

  1. Follow the procedure described in View instance details.

  2. Find the availabilityType line in the command output.

    Its value is either REGIONAL, for an HA instance, or ZONAL, for a basic instance.