berkinovish
berkinovish
CDCloudflare Developers
Created by berkinovish on 5/30/2024 in #workers-help
Connecting to AWS RDS from a worker through a Cloudflare tunnel
Hey everyone, Anyone connected to AWS RDS from a worker through a Cloudflare tunnel before? I have an EC2 instance with cloudflared and an RDS Postgres database in the same VPC, and I want to connect to this database from a Worker. The setup on AWS should be correct—we can connect locally to the database through the WARP client. I also want to route our worker-database connection through this tunnel, but I can't get it to work. Directly connecting to the Aurora internal URL from the worker gives Error: proxy request failed, cannot connect to the specified address (while it works locally through the WARP client). I tried setting up a public hostname on the tunnel, but no luck (neither in the worker nor locally). I also experimented with a Zero Trust Application with Service Auth but couldn't figure out how to pass the clientId and secret to postgres.js. Anyone dealt with something like this? I don't want to use Hyperdrive since it requires opening the database to 0.0.0.0, which our policies don't allow. Thanks!
1 replies