Connect to a BYOC Warehouse from Another AWS Account
Suppose your reporting application runs in Account A and your data team runs a VeloDB Cloud BYOC warehouse in Account B. They use separate VPCs in the same AWS Region. When a user opens a dashboard, the application needs to query the warehouse over a private connection.
If the application can already reach the warehouse's private SQL host and port, use the existing connection. Otherwise, choose one of the following paths. See Connect to a BYOC Warehouse.
| Choose | When it fits | How the application reaches the warehouse |
|---|---|---|
| VPC peering | The VPC address ranges do not overlap, and both teams can configure routes for the application and warehouse subnets. | The application uses the existing private SQL endpoint. This is often simpler because neither team needs to create a service or an interface endpoint. |
| AWS PrivateLink | The VPC address ranges overlap, or the teams want to share only the warehouse service without routing between VPCs. The warehouse must have an internal Network Load Balancer (NLB) for SQL traffic. | The application connects to an interface endpoint in its own VPC. AWS forwards that traffic to the service published by Account B. |
Before you begin
In Account B, open Connect for the running BYOC warehouse in the VeloDB Cloud Console. Choose MySQL CLI or JDBC and, if prompted, select the frontend group the application will use. Give the application administrator the Host, Port, and TLS setting.
In Account A, identify the VPC and subnets where the application runs. Have a SQL client in that network and a warehouse SQL username and password ready for the connection test.
Connect with VPC peering
With VPC peering, Account A uses the same private SQL endpoint that a client in Account B uses. First, confirm that the host and port from Connect work inside the warehouse VPC. Then configure a direct peering connection between the application VPC and the warehouse VPC in AWS. Peering through a third VPC is not supported. See How VPC peering works.
Step 1. Connect the two VPCs
If these two VPCs already have an active peering connection, use its ID in Step 2.
- Exchange the AWS account IDs, VPC IDs, and VPC CIDR blocks. Check all associated CIDR blocks for overlap, including secondary blocks. If they overlap, use AWS PrivateLink.
- In Account A, open Peering connections in the Amazon VPC console and choose Create peering connection. Select the application VPC as the requester. For the accepter, choose Another account, enter Account B's ID, and specify the warehouse Region and VPC ID. Create the request and send the peering connection ID to Account B. See Create a VPC peering connection.
- In Account B, open Peering connections. Verify the requester account and VPC, select the matching request, and choose Actions > Accept request. Wait for the connection to show Active. See Accept a VPC peering connection.
Step 2. Add a route in each direction
In each account, open Route tables and edit the tables associated with the subnets that will carry this connection. Both routes use the same peering connection ID as their target. For example, if the application uses 10.10.1.0/24 and the warehouse endpoint uses 10.20.2.0/24, add these routes using your actual subnet ranges.
| Route tables to update | Destination in this example | Target |
|---|---|---|
| Account A, application subnets | 10.20.2.0/24 (warehouse endpoint subnet) | The peering connection |
| Account B, subnets serving the warehouse endpoint | 10.10.1.0/24 (application subnet) | The same peering connection |
If the warehouse endpoint uses multiple subnets, cover every subnet its hostname can resolve to and check the return route for each one. See Update route tables for VPC peering.
Step 3. Allow the SQL connection and verify DNS
- In Account A, allow outbound TCP from the application to the warehouse on the SQL port from Connect. If either VPC uses custom network ACLs, allow the SQL port in the request direction and the client's ephemeral ports in the return direction.
- In Account B, if the internal NLB has a security group, check that it allows the application's source range on the SQL listener port. Also check the security group on the warehouse targets. For an NLB without a security group that preserves client IPs, the targets must allow the application's source range on the target port. Check the actual range even if the application uses private IP addresses. See AWS NLB security groups and VeloDB Cloud-managed resources.
- From the application network, resolve the warehouse Host. If it resolves to the expected private addresses, use it as supplied. If the record is in a Route 53 private hosted zone visible only to Account B, ask your DNS administrator to make the record visible to Account A. For a zone your team owns and wants to share, the zone owner authorizes the association and the application VPC owner completes it. See Associate a private hosted zone with a VPC in another account.
- Keep the warehouse hostname for TLS verification. Use the port and TLS setting from Connect and test the SQL connection.
Connect with AWS PrivateLink
In Account A, an interface endpoint provides private IP addresses in the application's subnets. In Account B, an endpoint service makes the warehouse's internal NLB available through PrivateLink. The application can open a SQL connection even when the VPCs use overlapping IP ranges. See AWS PrivateLink connectivity.
Before you start, identify the internal NLB in Account B that serves the SQL port and verify that its targets are healthy. In Account A, give the warehouse administrator the ARN of the IAM role you will use to create the interface endpoint.
Step 1. Share the warehouse service from Account B
- In the Amazon VPC console, open Endpoint services. If the warehouse NLB already has an endpoint service, review its listeners and access settings before sharing it. An NLB can belong to only one endpoint service.
- If you need to create the service, choose Create endpoint service, select Network and the warehouse NLB, enable Acceptance required, and create the service. See Create an AWS PrivateLink endpoint service.
- Select the service and open Allow principals. Add the IAM role ARN from Account A. See Manage endpoint service permissions.
Send the application administrator the AWS service name and Region to create the endpoint. They will also need the SQL port from Connect for the endpoint security group.
Step 2. Create the application endpoint in Account A
- Using the authorized IAM role, open Endpoints in the Amazon VPC console in the warehouse Region. Choose Create endpoint. Under Type, select Endpoint services that use NLBs and GWLBs. Enter the service name and choose Verify service.
- Select the application's VPC. Choose one subnet in each Availability Zone you want to use from the zones AWS lists for the service. Select an endpoint security group that allows inbound TCP from the application on the warehouse SQL port.
- Create the endpoint. Send its endpoint ID and your AWS account ID to the warehouse administrator so they can identify your request.
Step 3. Accept the endpoint request in Account B
In Endpoint services, select the warehouse service and open Endpoint connections. Find the request that matches Account A and the endpoint ID, then accept it. If the service accepts requests automatically, verify that the expected endpoint is connected.
Step 4. Test SQL access from the application VPC
- In Account A, open Endpoints. Wait for your endpoint to show Available, then copy its regional DNS name.
- If the warehouse uses TLS, configure private DNS in the application VPC so the warehouse hostname resolves to the interface endpoint. For example, in a Route 53 private hosted zone associated with the application VPC, create an A alias record for the warehouse hostname. Choose Alias to VPC endpoint and select the endpoint's regional DNS name. Use the warehouse hostname in your SQL client so it matches the server certificate. For a warehouse without TLS, use the endpoint's regional DNS name as the host. See Route traffic to an interface VPC endpoint.
- From the application VPC, test the SQL connection with the host you selected.
Verify the SQL connection
From a SQL client in the application's VPC, connect using your warehouse SQL credentials. With MySQL CLI, use the command from Connect with the hostname for the path you configured. Keep the generated port and TLS options. Run this query.
SELECT 1;
A result of 1 confirms that this client can reach the warehouse and authenticate. Use the same host, port, and TLS setting in the reporting application.
If the connection times out, check the network path you configured.
- VPC peering. Check that the connection is Active, both subnet route tables use its ID, and the client resolves the warehouse hostname to an address covered by those routes. Check the security group and network ACL rules for the affected subnets.
- AWS PrivateLink. Check the endpoint status, the application's outbound rules, and the endpoint security group's inbound rule for the SQL port. If the NLB enforces inbound security group rules for PrivateLink traffic, those rules must also allow the application's private IP on that port.
Remove the connection
- VPC peering. If the peering connection is dedicated to this application, confirm with both teams that no other workloads use it. Delete the connection and remove its routes from both accounts, along with any dedicated access rules. If other workloads share the connection, remove only the rules or routes dedicated to this application. See Delete a VPC peering connection.
- AWS PrivateLink. Remove the application's dedicated DNS record and delete its interface endpoint in Account A. Before removing a warehouse with a dedicated endpoint service, confirm all consumers have disconnected, then delete the service in Account B. See Delete an AWS endpoint service.