大网数据广告活动
服务器运维问答

Unable to connect to public PostgreSQL RDS instance

· 52CE 我爱测

I created a basic test PostgreSQL RDS instance in a VPC that has a single public subnet and that should be available to connect over the public Internet. It uses the default security group, which is open for port 5432. When I try…

问题原文

原帖链接 · Edward Q. Bridges · CC BY-SA 4.0

I created a basic test PostgreSQL RDS instance in a VPC that has a single public subnet and that should be available to connect over the public Internet. It uses the default security group, which is open for port 5432. When I try to connect, it fails. I must be missing something very straightforward—but I'm pretty lost on this.

Here’re the database settings. Note that it's marked as Publicly Accessible:

Here’re the security group settings. Note it's wide open (affirmed in the RDS settings above by the green "authorized" hint next to the endpoint):

Here's the command I'm trying to use to connect:

psql --host=myinstance.xxxxxxxxxx.us-east-1.rds.amazonaws.com \
     --port=5432
     --username=masteruser
     --password
     --dbname=testdb

And this is the result I'm getting when trying to connect from a Mac OS X v10.10 (Yosemite) MacBook Pro (note, it's resolving to a 54.* IP address):

psql: could not connect to server: Operation timed out
    Is the server running on host "myinstance.xxxxxxxxxx.us-east-1.rds.amazonaws.com" (54.xxx.xxx.xxx) and accepting
    TCP/IP connections on port 5432?

I do not have any kind of firewall enabled, and am able to connect to public PostgreSQL instances on other providers (e.g., Heroku).

How can I troubleshoot this?

Here are the inbound ACL rules for the default VPC:

已采纳解答

原帖链接 · Edward Q. Bridges · CC BY-SA 4.0

The issue was that the inbound rule in the Security Group specified a security group as the source. Changing it to a CIDR that included my IP address fixed the issue.

Open the database security group in AWS; and choose "Edit inbound rules"; "Add rule". There is a "My IP" option in the dropdown menu; select that option to auto-populate with your computer's public IP address in CIDR notation:

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2015-01-03)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。