Atlas network peering lets you create a private connection between your application network and the Atlas network for a dedicated cluster. This connection routes traffic over private IP addresses instead of the public Internet, which helps isolate application-to-database traffic. Atlas supports peering for dedicated clusters on AWS, Azure, and Google Cloud, and for sharded clusters that span multiple cloud providers. Compared to private endpoints, peering allows private network connectivity between Atlas and your cloud network, while private endpoints provide more narrowly scoped private access with less expansion of the network trust boundary.
具体的设置要求和限制因云提供商而异,因此,在配置连接之前,您应查看提供商特定的指导。
A key component of configuring network peering is defining the CIDR range in advance. Your Atlas CIDR must not overlap with any VPCs you plan to peer, and the CIDR size affects how many nodes and replica sets Atlas can support in that project or region. In Atlas, a network container is created automatically when you create a peering connection. In some cases, you might want to create or manage the container separately from the connection. To do this, follow the guide for managing network containers.
注意
The MongoDB Atlas Shared Responsibility Model defines the complementary duties of MongoDB and its customers in maintaining a secure and resilient data environment. Under this framework, MongoDB manages the security and operational integrity of the underlying platform, while customers are responsible for the configuration, management, and data policies of their specific deployments. For a detailed breakdown of ownership across security and operational excellence, see Shared Responsibility Model.
限制
Atlas does not support network peering between clusters deployed in a single region on different cloud providers. For example, you cannot set up network peering between an Atlas cluster hosted in a single region on AWS and an application hosted in a single region on Google Cloud.
免费集群(以前称为
M0)和 Flex 集群不支持 VPC 对等互连。要使用私有网络,必须使用专用集群。
Atlas 对等互连的推荐最佳实践
Plan CIDR ranges early, ideally before deploying the first dedicated {+cluster} in a region. Your Atlas CIDR must not overlap with any VPCs you plan to peer, and the CIDR size affects how many nodes and replica sets Atlas can support in that project or region.
对等互连网络仅使用 RFC 1918 私有地址。
一个 Atlas 项目最多可有 50 个对等互连连接,其中最多可有 25 个待处理。
如果您想要与 Atlas 的私有网络路径,请使用 VPC 或 VNet 对等互连,但请记住,对等互连比私有端点更多地扩展了网络信任边界。如果最大程度地减少信任边界扩展是首要任务,则私有端点通常更加适合。
将对等互连视为一项最小权限网络设计实践:锁定安全组和网络 ACL,以便 Atlas 不会对您的应用程序网络获取不必要的入站访问权限,并考虑使用中间 VPC,以便仅暴露需要 Atlas 访问权限的组件。
Be explicit about connection string choice. In AWS, the standard connection string usually works over peering, and the
-pristring is optional unless you use custom DNS. In Azure and Google Cloud, use the Private IP for Peering connection string.For multi-region deployments, plan peering per cloud behavior: AWS and Azure require peering for each Atlas region involved, while Google Cloud uses global VPCs and needs only one peering connection.