使用 sequel pro 连接到 AWS RDS
Use seqel pro connect to AWS RDS
我使用 AWS 免费套餐来设置我的 Rails 项目。
但是,我对为什么无法通过 sequel pro
连接 RDS
感到困惑。
这是 RDS
使用的 VPC
security group
。
我在 rails database.yml
.
中设置了相同的主机、用户名、密码和数据库名称
我在 EC2
上的 Rails 项目可以完美地连接到 RDS
,但是无法从 sequel pro 连接。
无法从 VPC 外部连接到 RDS 实例,而从 VPC 访问正常,这通常与 RDS 的 DNS 名称无法在 VPC 外部解析有关。将数据库的 Publicly accessible
设置设置为 yes
以便能够从外部连接。
来自AWS docs - Hiding a DB Instance in a VPC from the Internet:
When you launch a DB instance inside a VPC, you can designate whether
the DB instance you create has a DNS that resolves to a public IP
address by using the PubliclyAccessible parameter. This parameter lets
you designate whether there is public access to the DB instance. Note
that access to the DB instance is ultimately controlled by the
security group it uses, and that public access is not permitted if the
security group assigned to the DB instance does not permit it.
You can modify a DB instance to turn on or off public accessibility by
modifying the PubliclyAccessible parameter. This parameter is modified
just like any other DB instance parameter. For more information, see
the modifying section for your DB engine.
注意: 在 0.0.0.0/0
CIDR 范围内打开 RDS 安全组中的任何端口是一种危险的做法。具体而言,仅设置应该能够连接到安全组中的 RDS 实例的源 IP。
我使用 AWS 免费套餐来设置我的 Rails 项目。
但是,我对为什么无法通过 sequel pro
连接 RDS
感到困惑。
这是 RDS
使用的 VPC
security group
。
我在 rails database.yml
.
我在 EC2
上的 Rails 项目可以完美地连接到 RDS
,但是无法从 sequel pro 连接。
无法从 VPC 外部连接到 RDS 实例,而从 VPC 访问正常,这通常与 RDS 的 DNS 名称无法在 VPC 外部解析有关。将数据库的 Publicly accessible
设置设置为 yes
以便能够从外部连接。
来自AWS docs - Hiding a DB Instance in a VPC from the Internet:
When you launch a DB instance inside a VPC, you can designate whether the DB instance you create has a DNS that resolves to a public IP address by using the PubliclyAccessible parameter. This parameter lets you designate whether there is public access to the DB instance. Note that access to the DB instance is ultimately controlled by the security group it uses, and that public access is not permitted if the security group assigned to the DB instance does not permit it.
You can modify a DB instance to turn on or off public accessibility by modifying the PubliclyAccessible parameter. This parameter is modified just like any other DB instance parameter. For more information, see the modifying section for your DB engine.
注意: 在 0.0.0.0/0
CIDR 范围内打开 RDS 安全组中的任何端口是一种危险的做法。具体而言,仅设置应该能够连接到安全组中的 RDS 实例的源 IP。