Mongodb atlas专用集群:如何与AWS建立对等连接,然后在不使用白名单ips的情况下访问集群

Mongodb atlas dedicated cluster: how to create peering connection with AWS and then access the cluster without whitelisting ips

我们在 Mongodb Atlas 中有一个专用的 M10 集群,我在其上创建了与 AWS 的对等连接,以使用 VPC 整合安全性。我已遵循此 Mongodb 文档来配置 AWS 和集群之间的对等连接。

https://docs.atlas.mongodb.com/security-vpc-peering/

对等连接创建成功,现在处于活动状态。但问题是,如果不将我的 IP 列入白名单,我将无法连接到集群。当我尝试在不将 IP 列入白名单的情况下进行连接时,出现以下错误:

Something went wrong MongooseServerSelectionError: Could not connect to any servers in your MongoDB Atlas cluster. One common reason is that you're trying to access the database from an IP that isn't whitelisted. Make sure your current IP address is on your Atlas cluster's IP whitelist: https://docs.atlas.mongodb.com/security-whitelist/

将 IP 列入白名单后,我能够从本地环境成功连接到集群。 使用应用程序访问 VPC 中的集群需要什么?我无法使用 IP 白名单选项,因为无法将每个用户的 IP 列入白名单。

如上述文档所述,我已经将 CIDR 块列入白名单。

IP 白名单独立于对等互连。对等决定网络,白名单决定允许网络上的谁访问。

如果您希望允许从与数据库具有物理连接的任何对象进行访问,请将整个世界 (0.0.0.0/0) 列入白名单。