0

I've got a postgres db in a private subnet that I'm trying to access from a flask app running locally. The DB was previously publicly accessible, and I've just put it in the subnet to restrict access. I've set up a jump host for ssh tunneling, and I'm able to connect to the jump host and, using dbeaver, to the RDS instance.

Postgres uses port 5432 by default, and my RDS instance is no exception. But I have a process running on 5432 locally, so I am trying to use another port (5555) and have that traffic sent to 5432 on RDS. I run ssh on my local to send requests on the postgres port through the jump server. My command looks like

ssh -NL 5555:<rds_instance_dns>:5432 ec2-user@<jump_host_ip> -i ~/.ssh/<pk_filename>

I was previously able to connect to my RDS with my local app server when it was publicly accessible, but now I can't, though I've updated the db uri to point at <rds_instance_dns> and using port 5555. Is there something I'm missing?

Tried connecting to the db w/ my app server; was expecting to be able to connect; instead, it times out.

sjg1729
  • 11
  • 3
  • The db uri needs to point to the local end of the tunnel, which is presumably 'localhost:5555'. If you tell it to connect to the host rds_instance_dns, then it is not trying to use the tunnel you just created. – jjanes Aug 10 '23 at 00:48
  • success! thank you – sjg1729 Aug 10 '23 at 01:11

0 Answers0