postgres_fdw cannot connect to server on Amazon RDS

Question:

I have two Postgres 9.3.5 instances in RDS, both in one security group that allows all inbound traffic from within the security group and all outbound traffic. I’m trying to set up one database to be able to select from a few tables from the other via postgres_fdw.

I’ve created the server –

as well as the requisite user mapping and foreign table –

However, a simple select count(*) from condition_fdw gives me

I can connect to both databases via psql from an EC2 instance. I know until recently RDS didn’t support postgres_fdw, but I’m running the newer versions that do.

In the create server statement, I have tried replacing “myinstance.xxxxxx.amazonaws.com” with the IP address it resolves to, no luck.

Any ideas?

Further Testing

I installed postgres on an ec2 instance with the same security group, foreign tables to the master server behave as expected.

postgres_fdw between databases on the same RDS instance works.

This all leads me to think it must some issue with outgoing connections from postgres_fdw on my Postgres RDS instance.

Answer:

It would appear that Amazon does not allow outgoing connections from RDS instances, so until that changes using postgres_fdw across RDS instances is not possible. I’ll have to run an ec2 instance as my postgres server in order to use a foreign table to a database on another server.

http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Overview.RDSSecurityGroups.html

Leave a Reply