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
In the Google Cloud console, go to the Clusters page.
Click a cluster in the Resource Name column.
Go to the Instances in your cluster section, and click Add read pool.
Configure your read pool instance:
In the Read pool instance ID field, enter an ID for the read pool instance.
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.
Select one of the following machine series:
- C4A (Google Axion-based machine series)
- N2 (x86-based machine series). This is the default machine series.
Select a machine type.
- C4A supports 1, 4, 8, 16, 32, 48, 64, and 72 machine types or shapes.
- N2 supports 2, 4, 8, 16, 32, 64, 96, and 128 machine types or shapes.
For more information about using the C4A Axion-based machine series, including the 1 vCPU machine type, see Considerations when using the C4A Axion-based machine series.
- 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 make sure that you have 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.
Optional: To enable and use managed connection pooling, check the box Enable managed connection pool under Managed connection pool. For more information, see Configure managed connection pooling.
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.
Optional: Set custom flags to your instance. For each flag, follow these steps:
- Click Advanced Configuration Options.
- Click Add a database flag.
- Select a flag from the New database flag list.
- Provide a value for the flag.
- Click Done.
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 \
--read-pool-node-count=NODE_COUNT \
--region=REGION_ID \
--cluster=CLUSTER_ID \
--cpu-count=CPU_COUNT \
--machine-type=MACHINE_TYPE \
--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.NODE_COUNT
: The number of nodes in the instance. Specify a number1
through20
, 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 located.CLUSTER_ID
: The ID of the cluster where you want the instance placed.CPU_COUNT
: the number of vCPUs that you want for the instance.- You must specify either
cpu_count
ormachine_type
. - If only
cpu_count
is provided, an N2 instance is created with the following specifications:- 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
- If both
machine_type
andcpu_count
are provided, thecpu_count
value must align with the number of vCPUs specified in themachine_type
. For example, ifmachine_type
isn2-highmem-4
, then you must setcpu_count
to4
.
- You must specify either
MACHINE_TYPE
: the machine type of the instance.For the C4A Axion-based machine series, the following are valid values:
c4a-highmem-1
c4a-highmem-4-lssd
c4a-highmem-8-lssd
c4a-highmem-16-lssd
c4a-highmem-32-lssd
c4a-highmem-48-lssd
c4a-highmem-64-lssd
c4a-highmem-72-lssd
For N2 machine series, the following are valid values:
n2-highmem-2
n2-highmem-4
n2-highmem-8
n2-highmem-16
n2-highmem-32
n2-highmem-64
n2-highmem-96
n2-highmem-128
When you use
machine_type
andcpu_count
together, the values incpu_count
andmachine_type
must match. For example, ifmachine_type
isn2-highmem-4
, then you must setcpu_count
to4
.
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](/resource-manager/docs/creating-managing-projects#identifying_projects
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 \
--region=REGION_ID \
--cluster=CLUSTER_ID \
--cpu-count=CPU_COUNT \
--machine-type=MACHINE_TYPE \
--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 uses Private Service Connect as the method of connecting to the instance.
To enable managed connection pooling in your read pool instance, add the
--enable-connection-pooling
flag to the
gcloud alloydb instances create
command:
gcloud alloydb instances create INSTANCE_ID \
--instance-type=READ_POOL \
--region=REGION_ID \
--cluster=CLUSTER_ID \
--cpu-count=CPU_COUNT \
--machine-type=MACHINE_TYPE \
--project=PROJECT_ID \
--enable-connection-pooling
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 \
--region=REGION_ID \
--cluster=CLUSTER_ID \
--cpu-count=CPU_COUNT \
--machine-type=MACHINE_TYPE \
--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.