Automation and Tooling
This domain tests repeatable operations: using the Atlas Administration API, CLI, Terraform, Kubernetes Operator, and database tools safely.
Core rules
- The Atlas Administration API is the foundation for automation. Atlas CLI wraps it for clusters, database users, access lists, alerts, and backups. Use API keys scoped to the project and restricted by IP.
- Terraform models Atlas resources declaratively: projects, advanced clusters, database users, and IP access lists. Keep state remote and locked, use modules for repeated environments, and review plans before apply.
- The Atlas Kubernetes Operator manages Atlas projects, clusters, and users through custom resources, letting Kubernetes GitOps workflows own the lifecycle.
- mongosh runs ad hoc commands and scripts; mongodump/mongorestore handle logical backups; mongoexport/mongoimport handle JSON/CSV interchange, not full fidelity.
- Store secrets in a secrets manager, tag resources, enable terminate protection for production, and reconcile manual console changes to avoid drift.
Worked example
Ten teams need identical M20 clusters with a standard database user and office CIDR. Build a Terraform module that accepts project name and region, creates mongodbatlas_advanced_cluster, mongodbatlas_database_user, and mongodbatlas_project_ip_access_list, and stores state in a remote backend. Put the API key in the CI secret store with a project-scoped role. Run plan in pull requests and apply after approval; use Atlas CLI only for break-glass checks.
Traps
Embedding API keys in Terraform or scripts; using an Organization Owner key for project automation; ignoring Terraform state drift after console edits; confusing mongoexport with a backup tool; letting Kubernetes and Terraform manage the same resource.