I have a VPC with two private subnets (two were required to get an RDS instance set up). I have a security group for this VPC, let's call it
vpc-sg allows TCP access on port 22 from my home machine, and allows all outbound traffic. That's it.
I have a public-facing EC2 server launched inside the VPC, that I've attached a public Elastic IP to. I'm using the EIP to ssh into this EC2 server. I set the security group to
vpc-sg. I installed PostgreSQL 9.2 on the EC2 instance.
I have an RDS instance within the same VPC. It's using
vpc-sg for a security group too. I was forced to pick PostgreSQL version 9.3 when creating the instance. I try accessing the RDS PostgreSQL database from my EC2 instance:
[ec2-user@ip-10-0-0-20 ~]$ psql the_db_name -U the_db_username -h my-db-instance.random-string.us-east-1.rds.amazonaws.com -p 5432 -W Password for user the_db_username: psql: could not connect to server: Connection timed out Is the server running on host "my-db-instance.random-string.us-east-1.rds.amazonaws.com" (10.0.0.147) and accepting TCP/IP connections on port 5432?
What should I be doing?
EDIT -- I am getting the No Inbound Permissions error on RDB, but don't know how to fix it.