Shardherdfor MongoDB Atlas
Guide

How to whitelist an IP address in MongoDB Atlas

By the Shardherd team · Updated · 3 min read · Sources

Short answer

In Atlas, open your project's Database & Network Access page, choose IP Access List, click Add IP Address, enter your public IP (or a CIDR range) and confirm. Tick "Save as temporary access list" to have Atlas delete the entry after 6 hours, 1 day or 1 week. Avoid 0.0.0.0/0: it opens every cluster in the project to the whole internet, protected only by database passwords.

Steps

  1. Find your public IPUse an IP lookup site, or your cloud console for a server. It is the address the internet sees, not your Wi-Fi's 192.168.x.x address.
  2. Open the IP access listIn Atlas, select the project, then in the sidebar under Security click Database & Network Access, then IP Access List.
  3. Add the addressClick Add IP Address and enter the IP (it becomes a /32 entry) or a CIDR range such as 198.51.100.0/24. Add a comment saying who or what it is for.
  4. Make it temporaryTick Save as temporary access list and pick 6 hours, 1 day or 1 week, so Atlas removes the entry itself.
  5. Confirm and wait for ActiveClick Confirm. The entry shows Pending while Atlas applies it to the project's clusters, then Active.

Whitelist, allowlist, IP access list: same thing

Atlas used to call it the IP whitelist; the docs and the UI now say IP access list. It is a per-project list of addresses that may open a connection to the project's clusters. A client whose public IP isn't on it can't connect at all, however correct its username and password are. That is why the usual symptom is a timeout, not an authentication error (see MongoServerSelectionError).

Points that trip people up:

  • The list applies to every cluster in the project, not one cluster.
  • A project can hold up to 200 entries (100 for projects with a sharded cluster created before 25 August 2017).
  • You need the Project Owner or Project Network Access Manager role to change it. An Organization Owner has to add themselves to the project first.
  • Home and office IPs change. If a connection that worked yesterday fails today, check your current IP against the list first.
  • Removing an entry doesn't always cut existing connections at once; they can stay open for a while.

Temporary entries: let Atlas clean up for you

Most access list entries are added for a reason that doesn't last: a laptop on hotel Wi-Fi, a one-off migration, a contractor's afternoon. Atlas can expire them for you. In the UI, Save as temporary access list offers 6 hours, 1 day or 1 week; the list then shows the time left, and once the entry is deleted that address can no longer connect. You can't turn a permanent entry into a temporary one later, so decide when you add it.

From the command line or code you can pick any expiry up to a week ahead. The Atlas CLI takes --currentIp to add the address of the machine running it, and --deleteAfter for the expiry:

atlas accessLists create --currentIp \
  --deleteAfter 2026-11-28T18:00:00Z \
  --comment "laptop, migration"

The Atlas Administration API does the same with POST /api/atlas/v2/groups/{groupId}/accessList and a deleteAfterDate field on each entry. The date must be in the future and no more than one week away:

[{
  "ipAddress": "203.0.113.7",
  "deleteAfterDate": "2026-11-28T18:00:00Z",
  "comment": "laptop, migration"
}]

Why not allow access from anywhere (0.0.0.0/0)?

Adding 0.0.0.0/0 makes every connection error go away, which is why it is the most common "fix" on forums. It also means any machine on the internet can reach your clusters and try passwords. MongoDB's own docs warn that a /0 entry "can expose your deployment to unauthorized access, data exfiltration, and other malicious activity", and Atlas emails everyone with a role in the project when one is added.

Better options, roughly in order:

  • Fixed egress IPs for servers (a NAT gateway or static outbound IP from your host), listed one by one.
  • VPC peering or private endpoints on dedicated clusters, which keep traffic off the public internet.
  • Temporary entries for people: add your current IP for a few hours when you need it.
  • If a platform truly has no fixed IPs and you must use 0.0.0.0/0, use long random database passwords, least-privilege database users, and treat it as a debt to pay off.

Two different access lists

Atlas has a second, separate access list on service accounts and API keys for the Atlas Administration API. The project IP access list above controls who can connect to your databases; the API access list controls who can manage Atlas through the API. Organizations created in the Atlas UI require an API access list by default, and a call from an address that isn't on it gets HTTP 403. The Atlas API keys guide covers that one.

Questions

How do I allow all IPs in MongoDB Atlas?

Add the entry 0.0.0.0/0 in the IP Access List. It works, but it exposes every cluster in the project to the whole internet and Atlas emails the project's users about it. Prefer specific IPs, private networking or temporary entries.

How long does a new IP access list entry take to work?

Watch the entry's Status column: it shows Pending while Atlas configures it and Active once Atlas has applied it to the project's clusters. Test your connection after it turns Active.

Can I whitelist an IP for just a few hours?

Yes. Tick Save as temporary access list in the UI (6 hours, 1 day or 1 week), or set deleteAfterDate in the API or --deleteAfter in the Atlas CLI to any time up to one week ahead.

I added my IP and still can't connect. Why?

Check that it is your public IP and that it hasn't changed, that you edited the right project, and that the entry is Active. If the error mentions authentication, the access list is fine and the problem is the database user or password.

Sources

Checked on 28 November 2026. Prices and limits change; the linked pages are the authority.

  1. Configure IP Access List Entrieswww.mongodb.com
  2. atlas accessLists create (Atlas CLI)www.mongodb.com
  3. Add Entries to Project IP Access List (Atlas Administration API)www.mongodb.com
  4. Configure API Accesswww.mongodb.com

Shardherd brings your Atlas clusters to iPhone.