Skip to main content

What is this integration?

Manage MongoDB Atlas projects, clusters, and users with Monk.

What Monk manages

  • Project, Cluster, User

Auth

  • Uses a Monk secret for API token (e.g., mongodb-atlas-token) and password secret for users

Getting Started

  1. Set secrets:
monk secrets add -g mongodb-atlas-token="mdb_xxx"
monk secrets add -g mongodb-user-password="strong-password"
  1. Define resources (save as mongodb-atlas.yaml):
namespace: my-mongodb

my-project:
  defines: mongodb-atlas/project
  name: my-application-project
  organization: my-organization
  secret_ref: mongodb-atlas-token
  permitted-secrets:
    mongodb-atlas-token: true

my-cluster:
  defines: mongodb-atlas/cluster
  name: my-application-cluster
  project_id: \<- connection-target("project") entity-state get-member("id")
  provider: AWS
  region: US_EAST_1
  instance_size: M0
  secret_ref: mongodb-atlas-token
  connections:
    project:
      runnable: my-mongodb/my-project
      service: data
  depends:
    wait-for:
      runnables:
        - my-mongodb/my-project
      timeout: 120

my-user:
  defines: mongodb-atlas/user
  name: app-user
  role: readWrite
  project_id: \<- connection-target("project") entity-state get-member("id")
  secret_ref: mongodb-atlas-token
  password_secret_ref: mongodb-user-password
  connections:
    project:
      runnable: my-mongodb/my-project
      service: data
  depends:
    wait-for:
      runnables:
        - my-mongodb/my-project
      timeout: 120
  1. Create/update:
monk update my-mongodb/my-project
monk update my-mongodb/my-cluster
monk update my-mongodb/my-user

Backup & Snapshot Actions (M10+ Clusters)

ActionDescription
get-backup-infoView backup configuration and status
create-snapshotCreate an on-demand backup snapshot
list-snapshotsList available snapshots
describe-snapshotGet detailed info about a specific snapshot
delete-snapshotDelete a backup snapshot
restoreRestore from snapshot or point-in-time
get-restore-statusCheck restore job progress
list-restore-jobsView all restore jobs
# View backup configuration
monk do my-mongodb/my-cluster/get-backup-info

# Create a snapshot before migration
monk do my-mongodb/my-cluster/create-snapshot description="Pre-migration"

# List available snapshots
monk do my-mongodb/my-cluster/list-snapshots

# Restore from snapshot (WARNING: overwrites data!)
monk do my-mongodb/my-cluster/restore snapshot_id="xxx"

# Point-in-time restore
monk do my-mongodb/my-cluster/restore restore_timestamp="2024-12-01T10:00:00Z"

# Check restore progress
monk do my-mongodb/my-cluster/get-restore-status job_id="xxx"

# Get details about a specific snapshot
monk do my-mongodb/my-cluster/describe-snapshot snapshot_id="xxx"

# Delete a snapshot
monk do my-mongodb/my-cluster/delete-snapshot snapshot_id="xxx"
Note: Backup API requires M10+ dedicated clusters. M0/M2/M5 shared tiers do not support backup API.