尽管设置了入站规则,仍无法连接到 AWS RDS

Kar*_*pan 5 amazon-web-services amazon-rds

我正在使用 AWS RDS,我想远程连接到数据库。然而,我不断得到

Database connection failed due to connection to server at 
"mydb.12345.eu-central-1.rds.amazonaws.com" (x.xx.xxx.xx),
port 5432 failed: Connection timed out (0x0000274C/10060)
Is the server running on that host and accepting TCP/IP connections?
Run Code Online (Sandbox Code Playgroud)

这些似乎是一个非常常见的问题,所有解决方案都建议应将入站规则设置为接受来自您自己的 IP 的所有流量。

然而,对我来说这并不能解决问题。

这是我的设置:

在此输入图像描述

这些是安全组中的入站规则sg-650cbe0b

在此输入图像描述

我还尝试添加入站规则,例如:

在此输入图像描述

或者

在此输入图像描述

但这没有用。

我尝试通过移动网络进行连接(以查看是否是防火墙问题),但出现了相同的错误。

不过,我从 AWS Lambda 函数内访问该数据库,并且没有任何问题。

这是我用来访问数据库的代码:

Database connection failed due to connection to server at 
"mydb.12345.eu-central-1.rds.amazonaws.com" (x.xx.xxx.xx),
port 5432 failed: Connection timed out (0x0000274C/10060)
Is the server running on that host and accepting TCP/IP connections?
Run Code Online (Sandbox Code Playgroud)

jar*_*mod 2

RDS 连接失败的原因有多种,包括:

  • RDS 实例未配置为可公开访问
  • 它被启动到私有子网中并且没有到 IGW 的路由

我推荐RDS 连接问题排查程序如何排查与使用 VPC 公有或私有子网的 Amazon RDS 数据库实例的连接问题?