matlas
One CLI for MongoDB Atlas and MongoDB databases. Matlas bridges the Atlas SDK and the MongoDB Go Driver so you can manage infrastructure and data workflows without switching tools.
Core Features
Authentication & Configuration
Flexible authentication with API keys, config files, environment variables, and macOS Keychain integration.
Learn moreAtlas Commands
Manage MongoDB Atlas projects, clusters, users, and networking with intuitive commands.
Learn moreDatabase Commands
Work directly with MongoDB databases, collections, and indexes through Atlas or direct connections.
Learn moreDiscovery & Export
Discover existing Atlas resources and convert to infrastructure-as-code format with database-level resource enumeration.
Learn moreInfrastructure Workflows
Terraform-inspired infrastructure-as-code workflows: discover, plan, diff, apply, destroy.
Learn moreAlerts & Monitoring
Comprehensive alert management and monitoring configuration with multi-channel notifications.
Learn moreExamples & Patterns
Comprehensive YAML examples and usage patterns for all resource types and infrastructure scenarios.
View examplesWhy Choose matlas?
✅ Single Mental Model - Unified interface for both Atlas infrastructure and database operations
✅ Terraform-Inspired - Familiar workflow: Discover → Plan/Diff → Apply
✅ Consistent Interface - Same flags, output formats, and ergonomics across all commands
✅ MongoDB Native - Built on official Atlas SDK and MongoDB Go Driver
Getting started
Installation
# Download from GitHub releases
# Or build from source
go install github.com/teabranch/matlas-cli@latest
Quick setup
# Set up authentication
export ATLAS_API_KEY="your-private-key"
export ATLAS_PUB_KEY="your-public-key"
# List your projects
matlas atlas projects list
# Discover a project's resources
matlas discover --project-id <id> --include-databases --output yaml
Example workflow
# 1. Discover current state
matlas discover --project-id abc123 --include-databases -o project.yaml
# 2. Edit the configuration
vim project.yaml
# 3. Preview changes
matlas infra diff -f project.yaml
# 4. Apply changes
matlas infra apply -f project.yaml
# 5. Explore examples for more patterns
matlas examples --help
📚 Ready-to-use Examples
Jump-start your infrastructure with our comprehensive examples collection:
- Discovery Examples - Convert existing Atlas resources to code
- Cluster Examples - Development to production cluster configurations
- User Management - Database users and authentication patterns
- Custom Roles - Granular permission management
- Network Access - IP allowlisting and security rules
- Alerts & Monitoring - Alert configurations and notification setups
- Infrastructure Patterns - Complete infrastructure workflows