Create a read pool instance in an AlloyDB cluster

This page describes how to create a read pool instance in an AlloyDB for PostgreSQL cluster.

Before you begin

  • The Google Cloud project you are using must have been enabled to access AlloyDB.
  • You must have one of these IAM roles in the Google Cloud project you are using:
    • roles/alloydb.admin (the AlloyDB Admin predefined IAM role)
    • roles/owner (the Owner basic IAM role)
    • roles/editor (the Editor basic IAM role)

    If you don't have any of these roles, contact your Organization Administrator to request access.

Create a read pool instance

Console

  1. In the Google Cloud console, go to the Clusters page.

    Go to Clusters

  2. Click a cluster in the Resource Name column.

  3. Go to the Instances in your cluster section, and click Add read pool.

  4. Configure your read pool instance:

    1. In the Read pool instance ID field, enter an ID for the read pool instance.

    2. In the Node count field, enter a node count.

      The number of nodes in a read pool instance determines the instance's overall computing capacity.

    3. Select a machine type.

    4. Optional: To connect your applications and clients over the public internet, click Enable Public IP in Public IP Connectivity. Enabling public IP might require additional configuration to ensure a secure connection. For more information, see Connect using public IP.

      By default, private IP is always enabled. For more information, see Enable private services access.

    5. Choose your network security settings. To keep your data secure, we recommend that you use mTLS encryption using AlloyDB connectors or SSL encryption.

      When you change your security settings, your instance is available for use, but existing, noncompliant connections are dropped.

    6. Optional: Set custom flags to your instance. For each flag, follow these steps:

      1. Click Advanced Configuration Options.
      2. Click Add a database flag.
      3. Select a flag from the New database flag list.
      4. Provide a value for the flag.
      5. Click Done.
    7. Click Add read pool.

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 create command to create a read pool instance.

gcloud alloydb instances create INSTANCE_ID \
    --instance-type=READ_POOL \
    --cpu-count=CPU_COUNT \
    --read-pool-node-count=NODE_COUNT \
    --region=REGION_ID \
    --cluster=CLUSTER_ID \
    --project=PROJECT_ID

Replace the following:

  • INSTANCE_ID: The ID of the instance you are creating. It must begin with a lowercase letter and can contain lowercase letters, numbers, and hyphens.
  • CPU_COUNT: The number of vCPUs you want for the instance. Valid values include:
    • 2: 2 vCPUs, 16 GB RAM
    • 4: 4 vCPUs, 32 GB RAM
    • 8: 8 vCPUs, 64 GB RAM
    • 16: 16 vCPUs, 128 GB RAM
    • 32: 32 vCPUs, 256 GB RAM
    • 64: 64 vCPUs, 512 GB RAM
    • 96: 96 vCPUs, 768 GB RAM
    • 128: 128 vCPUs, 864 GB RAM
  • NODE_COUNT: The number of nodes in the instance. Specify a number 1 through 20, inclusive. Note that you cannot have more than 20 nodes across all read pool instances in a cluster.
  • REGION_ID: The region where you want the instance placed.
  • CLUSTER_ID: The ID of the cluster where you want the instance placed.
  • PROJECT_ID: The ID of the project where the cluster is placed.

To create a read pool instance for a Private Service Connect-enabled cluster, add the --allowed-psc-projects flag to set a comma separated list of project IDs or project numbers that you want to allow access to the instance—for example, my-project-1, 12345,my-project-n.

gcloud alloydb instances create INSTANCE_ID \
            --instance-type=READ_POOL \
            --cpu-count=CPU_COUNT \
            --region=REGION_ID \
            --cluster=CLUSTER_ID \
            --project=PROJECT_ID \
            --allowed-psc-projects=ALLOWED_PROJECT_LIST

Replace the following:

  • ALLOWED_PROJECT (Optional): The comma separated list of project IDs or project numbers that you want to allow access to the instance—for example,my-project-1, 12345,my-project-n. You must set a list of allowed projects or numbers, if your cluster is using Private Service Connect as the method of connecting to the instance.

To create a read pool instance for a public IP-enabled cluster, add the --assign-inbound-public-ip=ASSIGN_IPV4 parameter.

gcloud alloydb instances create INSTANCE_ID \
            --instance-type=READ_POOL \
            --cpu-count=CPU_COUNT \
            --region=REGION_ID \
            --cluster=CLUSTER_ID \
            --project=PROJECT_ID \
            --assign-inbound-public-ip=ASSIGN_IPV4

Optionally, you can pass the comma separated list of CIDR blocks, such as 64.233.160.0/16 to the --authorized-external-networks parameter to set authorized external networks on your instance.

What's next