← Guides

MongoDB Atlas IP access list without 0.0.0.0/0

Atlas blocks every connection that is not on the project IP access list. When home IPs, serverless functions or CI runners keep changing address, many teams give up and add 0.0.0.0/0. Here is a safer setup.

Updated 2026-11-19 · 5 min read

Why 0.0.0.0/0 is a bad idea

With the whole internet allowed, only the database password protects your data. Leaked connection strings are common (in repositories, logs and screenshots), and automated scanners try Atlas hosts all day.

Your options

Step 1: get a static IP

Use a server with a fixed IPv4 that only you use. With MazeVPN you get one in about three minutes, with WireGuard for people and a SOCKS5/HTTP proxy for code.

Step 2: add it to Atlas

In Atlas open Security → Network Access → Add IP Address and enter your IP as a single address (it is saved as /32). Remove 0.0.0.0/0 afterwards.

Step 3: developers connect through WireGuard

Turn on the WireGuard tunnel and use Compass or mongosh as usual. Traffic to Atlas leaves from your static IP.

Step 4: apps connect through the SOCKS5 proxy

The official Node.js driver (version 6 and later) can connect through a SOCKS5 proxy, so serverless functions can reach Atlas from your static IP:

import { MongoClient } from 'mongodb';

const client = new MongoClient(process.env.MONGODB_URI, {
  proxyHost: process.env.MAZE_IP,        // your static IP
  proxyPort: 1080,                       // SOCKS5 port
  proxyUsername: 'app',
  proxyPassword: process.env.MAZE_PROXY_PASSWORD,
});
await client.connect();

Checklist

Skip the setup

A dedicated server and static IPv4 in 38 cities, ready in about 3 minutes. WireGuard for people, SOCKS5/HTTP proxy for code. From $9.99/month.

FAQ

Questions, answered.

Something else? Open a ticket, a human replies.

Will the proxy slow down queries? +

Pick the city closest to your Atlas region (for example Frankfurt for eu-central-1) and the added latency is a few milliseconds.

Can several apps share the IP? +

Yes. The IP is yours, so any number of apps and team members can use it.

More guides

Stop getting blocked. Start getting allowlisted.

Your own static IP, live in minutes. Full refund within 3 days if it is not right for you.