postgREST -- http API calls fail though other connections are working

0

Hey guys!

i'm evaluating RDS as a possible solution for a company database migration. I've spun up a Postgres instance and successfully connected via psql , and my postgREST API server is successfully connected and listening on port 3000.

I've read the security-group tutorial and have added inbound security rules to allow for connection to port 3000 from my IP (ditto for 5432). However, when I try a postgREST call with curl to port 3000, the server does not respond and postgREST does not log the request.

I've been fiddling with the security settings, etc, and reading the docs all afternoon but can't figure out where the configuration is wrong. [I even tried temporarily allowing inbound to port 3000 from all traffic, but that didn't work either. I tried routing the postgREST call to 5432, which at least got a server response, but that response is
curl: (52) Empty reply from server

I must be missing something critical. Any and all help / insight will be much appreciated!

Edited by: MisterOctober on Jul 22, 2019 8:48 AM

Edited by: MisterOctober on Jul 22, 2019 8:48 AM

asked 5 years ago291 views
4 Answers
0

You did not really explain how/where you are running postgREST
i am guessing on EC2? in that case, make sure you are adding the rule to the SG of the EC2 instance, and not the RDS instance

answered 5 years ago
0

Howdy Ruslan! Thanks for taking the time to look at my question.

My test unit of postgREST associated with this RDS instance is running on a local machine; sorry for the lack of clarity.

I've got another instance running great on DigitalOcean (postgres _ postgREST running on same VM), but clearly I'm doing something wrong with this RDS _ remote postgREST config.

Edited by: MisterOctober on Jul 23, 2019 2:39 PM

answered 5 years ago
0

You are running postgrest locally so aws has nothing to do with it.
You need to open the port 3000 on your local machine, not in rds.
How are you testing, what is your exact curl line?
It should be like curl http://localhost:3000/ ....

answered 5 years ago
0

Thanks for your help, Ruslan! I ended up moving postgREST to an EC2 instance, but was having the same problem {plus some!}-- the fix ended up being :
** to set the RDS instance port 5432 ingress rule source ID to _the security group, rather than the CIDR IP block, of the EC2 instance.**

postgREST API calls are now working properly in all respects. Bellissimo!

p.s. special thanks also to Pooja @ AWS Support for the analysis and additional tips

Edited by: MisterOctober on Jul 30, 2019 3:10 PM
edited for clarity

Edited by: MisterOctober on Jul 30, 2019 4:06 PM

answered 5 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions