Connect to Postgres Read Replica Externally

Hey all!

I’m attempting to connect an external visualization app to a read replica of my postgres instance. I’ve done the following

  • Spin up a read replica
  • Assign an IP address
  • Expose the ports through this config:
[[services]]
  internal_port = 5432 # Postgres instance
  protocol = "tcp"

# Example of opening port 443 for secure connections
[[services.ports]]
  handlers = ["tls"]
  port = 443

# Example of opening port 10000 for insecure connections.
[[services.ports]]
  handlers = []
  port = 10000

That allows me to connect to the write replica. But if I try to point to the internal port at 5433 (which from my understanding should point at the read replica), the connection doesn’t work. I can, however, connect to the read replica through the internal connection (port 5433).

My goal is to only expose the read replica externally.

Any thoughts would be greatly appreciated.

Thanks!