Unable to connect to Google Cloud MySql

I have a Google Cloud MySql instance which I’m able to connect to using Prisma from within my Remix.run app while running on localhost.

I’ve added the IP for my fly.io dev site as an authorized network in my Cloud console and set the secret.

I’ve also setup a Connectivity test within Cloud console that validates the connection should be possible.

I’m not sure what I’m missing at this point…

Hi @dreday

The Anycast IP addresses assigned to your fly.io app are for incoming connections only.
Those IP Addresses aren’t used for outgoing connections from your fly.io app to the internet.

Thanks - can you point me to where/how I can create or obtain an IP for outgoing connections?

Hi @dreday

I believe there currently is no list you can use and fly.io recommend not relying on outgoing IP addresses as there is no guarantee they’ll stay the same.

So there’s no way then to connect to a db instance outside of fly.io?

Hi @dreday, the currently suggested approach for accessing cloud provider managed DBs from fly.io is to use Tailscale. They have a guide for how to setup remote access with AWS RDS and I imagine the process would be similar for GCP where you’d deploy a VM through GCE and connect it to your tailnet. Once setup on GCP, you would then setup Tailscale on Fly.io and then your app can connect to the GCP MySQL over tailnet.

A similar discussion is also in https://community.fly.io/t/how-to-connect-to-the-googlecloud-sql-through-wireguard-vpn/