Connect to a Google Cloud BYOC Warehouse from Another Region
If your application runs in a different Google Cloud region from your VeloDB Cloud BYOC warehouse, you can connect it to the same private host and port you use in the warehouse region. Enable Global access on the warehouse load balancer's forwarding rule and allow traffic from the application's network.
The warehouse frontend sends query results directly to the SQL client. On that TCP connection, the client sees the load balancer's IP address as the source of the response. See Google Cloud's internal passthrough Network Load Balancer overview.
The warehouse's internal passthrough Network Load Balancer has a private IP in the warehouse subnet. By default, it accepts connections from its own region. Global access lets clients connect from other regions in the same VPC or a peered VPC. It also lets on-premises clients connect through a Cloud VPN tunnel or Cloud Interconnect VLAN attachment in another region. The warehouse nodes stay in their original region.
For a same-region client, follow Connect to a BYOC Warehouse. To use SQL Editor over a private connection from your browser, see Console Private Connectivity.
Step 1. Identify the warehouse endpoint
- In the VeloDB Cloud Console, select your running BYOC warehouse and open Connect in the left navigation pane.
- Under Connect to your warehouse, choose the method your application uses. For MySQL CLI or JDBC, if Select a frontend group appears, select the application's group. Record the Host and Port. If the host is a DNS name, resolve it from the warehouse VPC and record the internal IP address. Keep the hostname for your client connection.
- In the Google Cloud console, select the project that owns the warehouse load balancer and open Load balancing. Find the internal passthrough Network Load Balancer in the warehouse region. Under Frontend configuration, match the IP address and port to the forwarding rule. You need
compute.forwardingRules.updateon this rule to change its access setting.
Step 2. Allow traffic from the client network
The load balancer preserves the client's source IP address. The VeloDB Cloud deployment template allows client traffic from the warehouse subnet by default. If your application uses another subnet, ask your network administrator to check these settings before enabling global access. See Google Cloud Preparation.
- Firewall rules. Allow inbound TCP traffic to the warehouse frontend nodes from the application's source IP range on the port you recorded. Limit the rule to the sources and ports your application needs.
- Routes. Verify that the application has a route to the warehouse's private IP and that the warehouse has a return route to the client range. For on-premises clients, the region that matters is where the Cloud VPN tunnel or Cloud Interconnect VLAN attachment connects to Google Cloud. If you use dynamic routing, check that Cloud Router learns and advertises the required routes in the relevant regions. See Google Cloud access from connected networks.
Step 3. Enable global access
- Under Frontend configuration, click Edit for the forwarding rule you identified. Under Global access, select Enable.
- Click Done, then Update. Return to the load balancer details and verify that the frontend shows
Regional (<region>) with global accessfor your warehouse region. - If your application needs ports served by other forwarding rules, repeat these steps for each of those rules. See Enable global access in Google Cloud.
Step 4. Test from the application region
From the application's network, use the host, port, and TLS settings from Connect. For example, copy the command for MySQL CLI and run it on your client. Enter your warehouse SQL password when prompted, then run the following query.
SELECT 1;
A result of 1 confirms that the client can connect and run a query from the remote region. For other clients, see Connection Methods.
Troubleshoot the connection
| Symptom | What to check |
|---|---|
| The connection works in the warehouse region but times out from the application. | Match the forwarding rule to the application's port and verify that global access is enabled. Check the routes in both directions and the inbound firewall rule for the application's source range. |
| The load balancer shows unhealthy backends. | Verify that the firewall allows Google Cloud's IPv4 health checks from 35.191.0.0/16 to reach the backend nodes on the configured health check port. See Google Cloud firewall requirements. |
| The private IP and port are reachable, but the hostname fails. | Check that DNS in the application network resolves the warehouse hostname to the load balancer's internal IP. Use the hostname from Connect for TLS. |
To inspect the forwarding rule in Google Cloud Shell, replace <rule-name>, <project-id>, and <warehouse-region> with the values from the load balancer details. The rule should show INTERNAL for loadBalancingScheme and true for allowGlobalAccess.
gcloud compute forwarding-rules describe '<rule-name>' \
--project='<project-id>' \
--region='<warehouse-region>' \
--format='yaml(IPAddress,ports,loadBalancingScheme,allowGlobalAccess)'
Restore regional access
When you no longer need cross-region connections, set Global access to Disable on each forwarding rule you changed. Click Done, then Update. Open a new connection from each region to confirm that the warehouse-region client can still connect and the remote client can no longer reach that endpoint.