I currently route many https services through Cloudflare Tunnel; these work really well.
However I’m having a hard time forwarding TCP connections through the tunnel.
Here’s some context about my tunnel setup
I’m running a tunnel in a separate server on AWS.
Currently I forward many http applications though that tunnel.
I have an AWS RDS Postgres database that I’d like to forward through the tunnel as well.
Obviously the Postgres database is a managed database therefore it is not running on the same server where the tunnel
is running.
I tried to set up the tcp connection using the cloudflared access tcp
command as so:
cloudflared access tcp --tunnel-host mytcp.example.com --url thePostgresDbHost.amazon.com:5432
Errors
Here’s the error that I get:
2022-10-11T17:58:13Z INF Start Websocket listener host=thePostgresDbHost.amazon.com:5432
2022-10-11T17:58:13Z ERR Error on Websocket listener error="failed to start forwarding server: listen tcp HOST_IP:5432: bind: cannot assign requested address"
where HOST_IP
is the IP address of the my postgres db hostname thePostgresDbHost.amazon.com
(not the real hostname btw)
What am I doing wrong?
Is it possible to forward a tcp connection from a remote host?
I took the example from this Cloudflare blog post here https://blog.cloudflare.com/cloudflare-tunnel-for-postgres/