Learn
Replicate a private-IP Cloud SQL MySQL instance to BigQuery
Stream a Cloud SQL for MySQL instance that only has a private IP into BigQuery through a small SSH bastion VM in the same VPC, without adding a public IP.
Many Cloud SQL instances only have a private IP, reachable from inside their VPC. You can replicate them to BigQuery without giving MySQL a public address: connect through a small SSH bastion in the same VPC.
1. Turn on the binary log
Enable automated backups and point-in-time recovery: how to enable binary logging on Cloud SQL.
2. Create a bastion VM
An e2-micro Compute Engine VM with an external IP, in the VPC network the instance's private IP belongs to, is enough; it only forwards traffic.
gcloud compute instances create quayen-bastion \ --zone=ZONE --machine-type=e2-micro --network=VPC_NETWORK \ --tags=quayen-bastion --image-family=debian-12 --image-project=debian-cloud
3. Allow SSH only from Quayen
Create a firewall rule that allows port 22 to the bastion only from Quayen's IP addresses, shown in the setup wizard:
gcloud compute firewall-rules create allow-quayen-ssh \ --network=VPC_NETWORK --allow=tcp:22 \ --source-ranges=QUAYEN_IP_1,QUAYEN_IP_2 --target-tags=quayen-bastion
The bastion reaches the instance's private IP on port 3306 over the VPC; MySQL is never exposed.
4. Connect
In the Quayen setup wizard, tick Connect through an SSH bastion. It shows a public key for your organization and the commands to add a quayen user with that key on the bastion. Enter the VM's external IP as the SSH host and the instance's private IP as the MySQL host, then test. The check says exactly which hop fails, and the bastion's host key is pinned on first connection.
The same pattern works for Amazon RDS and Aurora: replicating a private RDS database.