I am trying to deploy a rails application on Amazon's Elastic Beanstalk. I am not very well-versed in network/server environments, so I picked up some knowledge along the way by reading documentations and researching whatever technologies are present in my stack, so bear with me if I make any mistakes.
So here's what I am trying to achieve:
I want to deploy my Rails application with Docker on Elastic Beanstalk with my instances launched in a VPC with two public facing subnets and an associated RDS instance. So far so good, I got the stack set up, but upon deployment I get an error which indicates that my EC2 instance is not able to connect to the Postgres RDS instance:
[91mrake aborted! [0m[91mPG::ConnectionBad: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
So, in essence my feeling is that I got quite far with the exception being that my RDS instance cannot be reached by my EC2 instance. My guess is that there are non-satisfiable Security Groups even though I tried to make sure to add both the EC2 instance and the RDS instance into the same security group where incoming traffic on port 5432 (Postgres) is allowed by the Security Group itself.
I added a Security Group with my Ip's CIDR and could confirm that the database is reachable from my machine. That means that the connection parameters I specified in my environment are correct and that it's not related to wrong credentials/configuration.
What could be the culprit for my EC2 instance not being able to establish a connection to my RDS instance ? Again, I'm almost positive on the fact that it lies within my Security Group settings, but I haven't been able to narrow down the source of the problem.
If you require any more information (which I intentionally left out for brevity) please let me know (for example security groups for VPC, EC2 or RDS, etc.).