Increase private services access address space

This page describes how to increase the IP address space available to the private services access configuration that AlloyDB uses for clusters and instances.

When you create an AlloyDB cluster or instance in a region that doesn't yet have any clusters or instances, AlloyDB creates a 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. You must increase the IP address space to resolve the address shortage before retrying to create the cluster or instance.

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 IAM permissions:
    • compute.networks.list
    • compute.addresses.create
    • compute.addresses.list
    • servicenetworking.services.addPeering

Procedure

To increase the AlloyDB IP address space, you 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

  1. Go to the VPC networks page in the Google Cloud console.

    Go to the VPC networks page

  2. Select the project where your VPC network resides.

  3. Select the VPC network that contains your existing private services access connection.

  4. Select the Private service connection tab.

  5. In the Private service connection tab, select the Allocated IP ranges for services tab.

  6. Click Allocated IP range.

  7. Enter a Name and Description for the allocated range.

  8. 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.
  9. Click Allocate to create the allocated range.

  10. In the Private service connection tab, select the Private connections to services tab.

  11. Click servicenetworking-googleapis-com.

  12. Click the Assigned allocation box and then select the additional allocated IP range you created earlier.

  13. Click OK and then 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.

  1. Use the gcloud config set project command to set the default project to the one where your VPC network resides.

    gcloud config set project PROJECT_ID
    

    Where PROJECT_ID is the ID of the project where your VPC network resides.

  2. Use the compute addresses create command to create an additional allocated IP address range.

    • To specify an address range and a prefix length (subnet mask), use the addresses and prefix-length flags. For example, to allocate the CIDR block 192.168.0.0/16, specify 192.168.0.0 for the address and 16 for 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_NETWORK
      
    • To specify just a prefix length (subnet mask), just use the prefix-length flag. 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 a 16 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 as additional-alloydb-range.

    • DESCRIPTION: a description for the range, such as allocated to extend AlloyDB range.

    • VPC_NETWORK: the name of your VPC network, such as my-vpc-network.

    The following example creates a private connection to Google so that the VM instances in the default VPC network can use private services access to reach Google services that support it.

    gcloud compute addresses create additional-alloydb-range \
        --global \
        --purpose=VPC_PEERING \
        --prefix-length=16 \
        --description="allocated to extend AlloyDB range" \
        --network=default
    
  3. Use the services vpc-peerings list command to get a list of IP ranges already allocated to your private services connection:

    gcloud services vpc-peerings list \
        --service=servicenetworking.googleapis.com \
        --network=VPC_NETWORK
    

    Where VPC_NETWORK is the name of your VPC network, such as my-vpc-network.

    The list of IP ranges already allocated to your private services connection appears after reservedPeeringRanges.

  4. Use the services vpc-peerings update command to add the additional address range to the private services connection.

    gcloud services vpc-peerings update \
        --service=servicenetworking.googleapis.com \
        --ranges=RESERVED_RANGE_NAME,EXISTING_RANGES_LIST \
        --network=VPC_NETWORK
    

    Replace 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 connection.

    • VPC_NETWORK: the name of your VPC network.

    The command initiates a long-running operation, returning an operation name.

  5. Check whether the operation was successful.

    gcloud services vpc-peerings operations describe OPERATION_NAME
    

    Replace OPERATION_NAME with the operation name that was returned from the previous step.