When would you choose an Atlas private endpoint over VPC peering, and what changes for clients?
answer
- One joins two networks, one exposes a service
- Ask about overlapping address ranges first
- Direction of initiation is the security argument
- Clients get a different hostname to connect to
- Endpoints are per region and metered
basics
~20 sChoose a private endpoint when you want one-way, non-routable access with no CIDR coordination: the endpoint lives in your VPC and Atlas cannot initiate back. Peering joins two networks bidirectionally, needs non-overlapping CIDRs, and still requires access-list entries. Clients use an endpoint-specific connection string.
solid answer
~50 s**VPC peering** joins your VPC or VNet to the Atlas project's network at the routing layer. It is bidirectional, requires non-overlapping CIDR ranges on both sides, is confined to a single cloud provider, does not work transitively through a third VPC, and still leans on the IP access list — you add the peer CIDR or, on AWS, the peer security group. **Private endpoints** (AWS PrivateLink, Azure Private Link, GCP Private Service Connect) instead place an interface endpoint inside your own VPC that fronts the cluster. The connection is unidirectional — Atlas never initiates toward you — CIDR overlap stops mattering, and the endpoint approval itself is the admission control, so you are not maintaining public IP entries for that path. The visible client change is the connection string: Atlas issues a distinct private-endpoint SRV hostname you must use instead of the public one. Endpoints are regional, so a multi-region cluster needs one per region, and they carry hourly and data-processing charges.
go deeper
Know that Atlas can be reached privately rather than over the internet, and that the two mechanisms are VPC peering and cloud-provider private endpoints.
Explain the mechanics that differ: bidirectional routing with CIDR constraints versus a one-way service endpoint, and the fact that peering still needs access-list entries while an approved endpoint is its own admission.
Drive the decision from real constraints — overlapping address space, cross-account clients, one-way exposure requirements — and plan the cutover, since clients must move to the endpoint-specific connection string.
Own the connectivity standard across environments and accounts: which path is mandatory for production, how cost scales with data processed, and how the network story is evidenced alongside least-privilege database users.
## The problem both solve By default an Atlas cluster is reached over the public internet, protected by TLS, database authentication, and the project's IP access list. That is defensible, but many organizations require that database traffic never traverse the public internet at all. Atlas offers two private paths, and the interview question is which one and why. ## VPC peering Peering creates a routing relationship between your VPC (or Azure VNet, or GCP VPC) and the VPC Atlas runs the project's clusters in. Once routes and rules are in place, your instances address the cluster over private addressing. Properties that decide the choice: - **Bidirectional.** Peering is a network join, not a service exposure. Both sides can, in principle, route to each other, which some security teams reject on principle. - **CIDR coordination.** Peered networks must not have overlapping address ranges. In a large organization with historically allocated RFC 1918 space, this is frequently the blocker — and it is not fixable without renumbering. - **Non-transitive.** If your application lives in VPC A, which peers with VPC B, which peers with Atlas, A cannot reach Atlas. Every VPC that needs access needs its own peering connection. - **Same cloud provider.** You peer AWS to AWS, Azure to Azure, GCP to GCP. - **Access list still applies.** Peering changes the path, not the admission control. You add the peer VPC's CIDR — or, on AWS, the peer security group, which is the more maintainable form because membership follows the group rather than an address range. ## Private endpoints A private endpoint uses the cloud provider's service-exposure primitive: AWS PrivateLink, Azure Private Link, or GCP Private Service Connect. Atlas publishes the cluster as a service; you create an interface endpoint in your own VPC and Atlas approves it. Your clients then resolve a private address inside your own network. What this changes: - **Unidirectional.** The endpoint exposes Atlas to you. Atlas cannot initiate connections back into your VPC, which is a materially smaller blast radius and the argument that usually wins with a security reviewer. - **No CIDR coordination.** Because nothing is routed between networks, overlapping address space is irrelevant. This alone decides the question in many enterprises. - **Endpoint approval is the control.** The path is admitted by virtue of the approved endpoint, so you are not maintaining public IP access-list entries for application traffic. In practice the access list then shrinks to whatever administrative tooling still comes over the public path. - **A different connection string.** This is the operational gotcha. Atlas issues a distinct private-endpoint SRV hostname; the public string will not resolve to the endpoint. Applications must be redeployed with the new URI, and a migration therefore has a cutover, not a silent switch. - **Regional and per-provider.** An endpoint serves one region. A multi-region replica set — or a multi-cloud cluster — needs an endpoint in each region where you want private connectivity, and each is configured separately. - **Cost.** Provider charges apply per endpoint-hour and per gigabyte processed. At high volume this is a real line item and worth modelling before committing. ## Choosing Reach for a **private endpoint** when: CIDRs overlap or you cannot coordinate address space; the security requirement is one-way exposure; clients are spread across accounts and VPCs (each gets its own endpoint without a mesh of peerings); or you want to stop maintaining public IP entries entirely. Reach for **peering** when: you already operate a peered topology and want private addressing with minimal new machinery; you need the cluster reachable from a network where creating endpoints is awkward; or the per-gigabyte endpoint charge is unattractive at your volume and the CIDR space is clean. Many production deployments end with private endpoints for application traffic, a tiny access list for operators and CI, no public application path at all, and separate Atlas projects per environment so none of this configuration leaks between staging and production. ## What neither does Private connectivity is not authentication and not authorization. Anyone who reaches the endpoint still needs a database user with roles, and TLS still protects the session. A frequent review finding is a cluster with a beautiful private path and a `readWriteAnyDatabase` credential shared by six services — the network work was the easy half.
- Your VPC's CIDR overlaps the Atlas project's network. What are your options?Peering is off the table; overlapping ranges cannot be routed between, and no amount of route configuration fixes it. Either renumber your network — rarely realistic — or use a private endpoint, where nothing is routed between networks and overlap is irrelevant. That constraint alone is the most common reason teams land on PrivateLink.
- What breaks if an application keeps using the public SRV string after you enable a private endpoint?It keeps working over the public path as long as its egress address is still on the IP access list, so the private endpoint quietly carries no traffic and you have paid for nothing. Cutover requires deploying the endpoint-specific hostname, verifying traffic moved, and only then tightening the access list.
- You have a multi-region Atlas cluster. What does private connectivity require?An endpoint in each region you intend to reach privately, configured and approved separately, plus a connection string that reflects that setup. A single endpoint in one region does not privately serve nodes elsewhere, which matters for read preferences that deliberately target a local secondary.
Peering is knocking a doorway between two offices so people can walk both ways; a private endpoint is a service window cut into your own wall — you can reach through it, but nobody comes back the other way.
saying these in an interview costs you the question
- Believes peering removes the need for IP access-list entries
- Assumes the public connection string works over a private endpoint
- Thinks peering is transitive through an intermediate VPC
- Treats private connectivity as a replacement for authentication
- Forgets endpoints are regional on a multi-region cluster