我有一个VPC与两个私人子网(两个需要得到一个RDS实例设置)。 我有一个这个VPC的安全组,我们称之为vpc-sg 。 vpc-sg允许来自我的家用机器的端口22上的TCP访问,并允许所有出站stream量。 而已。
我在VPC内部推出了一个面向公众的EC2服务器,我附带了一个公共弹性IP。 我正在使用EIP ssh到这个EC2服务器。 我将安全组设置为vpc-sg 。 我在EC2实例上安装了PostgreSQL 9.2。
我在同一个VPC中有一个RDS实例。 它也使用vpc-sg作为安全组。 创build实例时,我不得不selectPostgreSQL版本9.3。 我尝试从我的EC2实例访问RDS PostgreSQL数据库:
[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?
我该怎么做?
编辑 – 我得到RDB上没有入站权限错误,但不知道如何解决它。
用5432创build一个新的安全组作为入站TCP连接,并用新创build的RDS实例replace当前安全组。