To resolve an IP address shortage when creating an AlloyDB for PostgreSQL cluster or instance in a region that uses private services access, you can increase the allocated IP address space in your Virtual Private Cloud (VPC) network.
When you create an AlloyDB cluster or instance in a region that
doesn't yet have any clusters or instances, AlloyDB creates a
/24 subnet in that region. If the existing IP address space available to
AlloyDB is not large enough to create the subnet, your attempt to
create the cluster or instance fails until you allocate additional IP address
space.
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.
- To increase the IP address range, you also must have these Identity and Access Management (IAM)
permissions:
compute.networks.listcompute.addresses.createcompute.addresses.listservicenetworking.services.addPeering
Procedure
To increase the AlloyDB IP address space, perform two operations:
- Create an additional allocated IP address range in your VPC network.
- Add the additional address range to the existing private services access connection in your VPC network.
Console
Go to the VPC networks page in the Google Cloud console.
Select the project where your VPC network resides.
Select the VPC network that contains your existing private services access connection.
Select the Private services access tab.
In the Private services access tab, select the Allocated IP ranges for services tab.
Click Allocate IP range.
Enter a Name and Description for the allocated range.
Specify an IP range for the allocation:
- To specify an IP address range, select Custom and then enter
a CIDR block, such as
192.168.0.0/16. - To specify a prefix length and let Google select an available range,
select Automatic and then enter a prefix length, such as
16.
- To specify an IP address range, select Custom and then enter
a CIDR block, such as
Click Allocate to create the allocated range.
In the Private services access tab, select the Private connections to services tab.
Click servicenetworking-googleapis-com.
In the Update a private connection dialog, click the Assigned allocation box and then select the additional allocated IP range you created earlier.
Click Update to update the connection.
gcloud
To use the gcloud CLI, you can install and initialize the Google Cloud CLI, or you can use Cloud Shell.
Use the
gcloud config set projectcommand to set the default project to the one where your VPC network resides:gcloud config set project PROJECT_ID
Replace
PROJECT_IDwith the ID of the project where your VPC network resides.Use the
gcloud compute addresses createcommand to create an additional allocated IP address range.To specify an address range and a prefix length (subnet mask), use the
--addressesand--prefix-lengthflags. For example, to allocate the CIDR block192.168.0.0/16, specify192.168.0.0for the address and16for the prefix length:gcloud compute addresses create RESERVED_RANGE_NAME \ --global \ --purpose=VPC_PEERING \ --addresses=192.168.0.0 \ --prefix-length=16 \ --description="DESCRIPTION" \ --network=VPC_NETWORKTo specify only a prefix length (subnet mask), use the
--prefix-lengthflag. When you omit the address range, Google Cloud automatically selects an unused address range in your VPC network. The following example selects an unused IP address range with a16-bit prefix length:gcloud compute addresses create RESERVED_RANGE_NAME \ --global \ --purpose=VPC_PEERING \ --prefix-length=16 \ --description="DESCRIPTION" \ --network=VPC_NETWORK
Replace the following placeholders with relevant values:
RESERVED_RANGE_NAME: a name for the allocated range, such asadditional-alloydb-range.DESCRIPTION: a description for the range, such asallocated to extend AlloyDB range.VPC_NETWORK: the name of your VPC network, such asmy-vpc-network.
The following example creates an additional allocated IP range in the
defaultVPC network:gcloud compute addresses create additional-alloydb-range \ --global \ --purpose=VPC_PEERING \ --prefix-length=16 \ --description="allocated to extend AlloyDB range" \ --network=defaultUse the
gcloud services vpc-peerings listcommand to get a list of IP ranges already allocated to your private services access connection:gcloud services vpc-peerings list \ --service=servicenetworking.googleapis.com \ --network=VPC_NETWORKReplace
VPC_NETWORKwith the name of your VPC network, such asmy-vpc-network.The list of IP ranges already allocated to your private services access connection appears after
reservedPeeringRanges.Use the
gcloud services vpc-peerings updatecommand to add the additional address range to the private services access connection:gcloud services vpc-peerings update \ --service=servicenetworking.googleapis.com \ --ranges=RESERVED_RANGE_NAME,EXISTING_RANGES_LIST \ --network=VPC_NETWORKReplace the following placeholders with relevant values:
RESERVED_RANGE_NAME: the name of the additional allocated IP address range you created.EXISTING_RANGES_LIST: a comma-separated list of the IP address ranges already allocated to the private services access connection.VPC_NETWORK: the name of your VPC network.
The command initiates a long-running operation, returning an operation name.
Check whether the operation was successful:
gcloud services vpc-peerings operations describe OPERATION_NAME
Replace
OPERATION_NAMEwith the operation name that was returned from the previous step.