I've two databases on the RDS instance. Let's say db1 and db2. I'm trying to do a query like this with dblink on db2.
SELECT * FROM dblink ( 'dbname=db1 port=5432 host=<host_ip> user=<user> password=<password>', 'select count(*) from my_table' );
And getting errors like this:
ERROR: could not establish connection
DETAIL: could not connect to server: Connection timed out
Is the server running on host "<host_ip>" (IP) and accepting
TCP/IP connections on port 5432?