Master MongoDB Atlas cloud setup, cluster configuration, security, networking, backups, and monitoring. Get production-ready cloud database in minutes. Use when setting up cloud MongoDB, configuring clusters, or managing Atlas.
Get your MongoDB database in the cloud with enterprise-grade features.
mongodb+srv://username:[email protected]/database_name
const { MongoClient } = require('mongodb');
const client = new MongoClient(connectionString);
Global users? → Multi-region cluster
USA only? → us-east-1 or us-west-2
EU users? → eu-west-1
Asia-Pacific? → ap-southeast-1
// 1. IP Whitelist (RECOMMENDED)
// Add specific IPs that can access cluster
// e.g., your office, AWS security group, CI/CD runner
// 2. Public Internet (NOT RECOMMENDED)
// Allow 0.0.0.0/0 - anyone can try to connect
// Must have strong password!
// 3. VPC Peering (ENTERPRISE)
// Connect via private network
// Most secure option
// Standard: Direct connection
mongodb+srv://user:[email protected]/database
// With options
mongodb+srv://user:[email protected]/database?retryWrites=true&w=majority
// Connection pooling
mongodb+srv://user:[email protected]/database?maxPoolSize=100
// TLS required
mongodb+srv://user:[email protected]/database?ssl=true
1. Security → Database Access
2. Add Database User
3. Choose authentication method:
- Password: Username + strong password
- Certificate: X.509 certificates
- LDAP: Enterprise directory
4. Assign roles:
- Atlas admin
- Project owner
- Editor
- Viewer
- Custom roles
Free M0: No automatic backups
M2-M5: Daily snapshots
M10+: Hourly snapshots + point-in-time recovery
Backup retention:
- 2 weeks default (M10+)
- 90 days for M10+
- Longer retention available
1. Atlas Console → Backup
2. Select snapshot
3. Restore to new cluster or existing
4. Wait for restore to complete
5. Verify data integrity
- Connections: Active connections, client info
- Operations: Reads, writes, inserts, updates
- CPU: CPU usage percentage
- Memory: Memory usage
- Storage: Database size growth
- Network: Incoming/outgoing bytes
- Queries: Slow queries
- Locks: Lock contention
Automatic recommendations:
- Missing indexes on frequently queried fields
- Schema improvements
- Connection pooling suggestions
- Storage optimization
Implement recommendations:
1. Review suggestion
2. Preview impact
3. Apply with one click
4. Monitor results
Set alerts for:
- High CPU (> 75%)
- High memory (> 90%)
- Low disk space (< 10% available)
- Slow queries (> 1000ms)
- Replication lag
- Connection issues
- Long-running operations
Multi-region replication:
- Write to any region
- Read from nearest region
- Low-latency access globally
- Automatic failover
Private network connection:
- Connect from AWS VPC
- No internet exposure
- Lowest latency
- Most secure
Enabled on M10+ by default:
- AES-256 encryption
- Managed by AWS/GCP/Azure
- Automatic key rotation
- HIPAA/SOC2 compliant
Enterprise directory authentication:
- Connect to company LDAP/Active Directory
- Centralized user management
- Automatic sync
- Role mapping
Free: $0/month (M0)
Small App: $9-57/month (M2-M5)
Production: $57-500+/month (M10-M30)
Plus data transfer costs:
- Within AWS region: Free
- Cross-region: $0.02/GB
- Internet egress: $0.03/GB
❌ "IP not whitelisted"
✅ Add your IP to whitelist in Security → Network Access
❌ "Authentication failed"
✅ Check username/password, correct database
❌ "Cluster not available"
✅ Wait a few minutes, clusters take time to start
❌ "Connection timeout"
✅ Check firewall, increase timeout, check IP whitelist
❌ Slow queries
✅ Check Performance Advisor, add indexes
❌ High CPU
✅ Review resource usage, optimize queries, upgrade tier
❌ Storage full
✅ Archive data, delete old records, upgrade tier
✅ Security:
✅ Performance:
✅ Operations:
Ready to power your app with MongoDB in the cloud! ☁️