Reputation: 2674
I'm trying to connect to an Amazon RDS Postgres instance via a Rails app on Heroku. I've set up my instance, and followed the instructions in this gist, but whenever I try to deploy the app with my new settings I get:
PG::ConnectionBad: could not connect to server: Connection timed out
at release time. I can connect absolutely fine on my local machine via psql
with these settings:
psql -h my-db-name.eu-west-2.rds.amazonaws.com "dbname=db user=username sslrootcert=config/rds-combined-ca-bundle.pem sslmode=verify-full"
And even using the database settings locally in my Rails app works fine, so it seems like there's an issue on the Heroku side of things, but I can't for the life of me think what. Any ideas?
Upvotes: 0
Views: 987
Reputation: 2674
This is embarrassing. I set up my RDS instance which automatically created a security group. The automatically created security group allows inbound traffic from your IP by default, which is why it worked on my machine. I switched to allow inbound traffic from all IPs (0.0.0.0/0, ::/0
), and it now all works!
Upvotes: 2