简体   繁体   English

AWS EC2 私有实例数据库连接

[英]AWS EC2 Private Instance DB Connection

I have a VPC with public & private subnets (Windows 2019).我有一个带有公有和私有子网的 VPC(Windows 2019)。 I installed Postgres database (not RDS) manually in the private instance.我在私有实例中手动安装了 Postgres 数据库(不是 RDS)。 As recommended by AWS I have created all the security group rules in public & private instance security groups.按照 AWS 的建议,我在公共和私有实例安全组中创建了所有安全组规则。 I wasn't able to connect to the DB from public instance.我无法从公共实例连接到数据库。 Please advise.请指教。 Thanks.谢谢。

Public instance security group:公共实例安全组:

  • HTTP TCP 80 0.0.0.0/0 - HTTP TCP 80 0.0.0.0/0 -
  • PostgreSQL TCP 5432 0.0.0.0/0 PostgreSQL TCP 5432 0.0.0.0/0
  • RDP TCP 3389 0.0.0.0/0 - RDP TCP 3389 0.0.0.0/0 -
  • HTTPS TCP 443 0.0.0.0/0 HTTPS TCP 443 0.0.0.0/0

Outbound:出站:

  • PostgreSQL TCP 5432 sg-0f189eca6a0f783dd (PRIVATE-SG) PostgreSQL TCP 5432 sg-0f189eca6a0f783dd (PRIVATE-SG)

Private instance security group:私有实例安全组:

  • PostgreSQL TCP 5432 sg-008ffcfcdec814a91 (PUBLIC-SG) PostgreSQL TCP 5432 sg-008ffcfcdec814a91 (PUBLIC-SG)
  • RDP TCP 3389 sg-008ffcfcdec814a91 (PUBLIC-SG) RDP TCP 3389 sg-008ffcfcdec814a91 (PUBLIC-SG)

Based on the comments.根据评论。

The connection issue was caused by build-in firewall on Windows instances.连接问题是由 Windows 实例上的内置防火墙引起的。

The solution was to add rule to the firewall enabling port 5432.解决方案是将规则添加到启用端口 5432 的防火墙。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM