Search code examples
postgresqlamazon-web-servicesamazon-rdsaclaws-access-policy

AWS can't access RDS (Postgres) from network


I created a Postgres DB on RDS from my home in country X, currently I am in Y and I can not access the DB. I get a connection timed out response. The DB is set to be publicly accessible. I guess it has something to do with subnets / ACL or something similar. Since I am new to AWS I would love to get help for a quick fix. I need the DB to evaluate a project, later on I plan to dive deeper into AWS.

Thanks for your help.


Solution

  • If you have not modified the default ACL then that should not be the problem.

    Since it worked when you were at home, I believe your already have the correct route set in your VPC route table (0.0.0.0/0 to internet gateway).

    I would start pinging the RDS connection endpoint to make sure you are able to resolve the hostname and there is no typo (I made this mistake before).

    My first guess is that the issue lies in the RDS instance security group inbound setting. You need to make sure you are allowing port 5432 (Postgres default port) connection from either 0.0.0.0/0 (Anywhere in the world) or your location Y IP address (Checkout whatismyip.com if you are unsure).

    If you have a multi-az deployment, another unlikely scenarios might be that the RDS instance in subnet A failed over to the secondary RDS instance in subnet B, which has a different subnet / route table setting.