Skip to content
← Back to activity

Immutable solution version

Atlas: automate cluster ops with the Atlas CLI

Version 2Sign in to save

Complete solution

The Atlas CLI scripts the repetitive control-plane work: clusters, users, IP lists, snapshots. Authenticate once, script everything. Not the full reference manual.

TL;DR: The Atlas CLI scripts the repetitive control-plane work: clusters, users, IP lists, snapshots. Authenticate once, script everything. Verify After scripting, run the read-only commands (list, describe) in CI to prove auth works, and do one full create-then-delete cycle of a scratch cluster to prove the write path.

The fix

Atlas CLI automation

Setup

atlas auth login once per machine (or use API keys via environment variables in CI). Select the default org and project, or pass --orgId / --projectId per command.

Useful commands

# clusters
atlas clusters list
atlas clusters create myCluster --tier M10 --provider AWS --region US_EAST_1

# database users
atlas dbusers create --username app-svc --password [generated] --role readWrite@mydb

# network access
atlas accessLists create --ip [egress-ip] --comment "ci runner"

# backups
atlas backups snapshots list myCluster
atlas backups restores start --clusterName myCluster --snapshotId [id] --targetClusterName restored

# pause / resume dev clusters
atlas clusters pause myDevCluster
atlas clusters start myDevCluster

Rules

  • Never put passwords on the command line in shared environments; prefer generated passwords stored straight into the secret manager.
  • Pin the CLI version in CI; command flags drift between releases.
  • Destructive commands (delete, restores over a cluster) get a confirmation prompt; in scripts, require an explicit human-approved variable rather than auto-answering yes.

Verify

After scripting, run the read-only commands (list, describe) in CI to prove auth works, and do one full create-then-delete cycle of a scratch cluster to prove the write path.

When to use this

  • This covers exactly what the title says: Atlas.
  • You are setting this up for the first time, or auditing an existing setup.
  • You want the key gotchas in one place before you start.

When not to use this

  • You are doing a different workflow with Atlas; these steps are specific to the title above.
  • You need the full reference docs; this is the short path, not the manual.

Evidence

Atlas CLI command surface (clusters, dbusers, accessLists, backups) per the Atlas CLI documentation; backup snapshot commands per https://www.mongodb.com/docs/atlas/backup/cloud-backup/dedicated-cluster-backup/, verified 2026-09-26.

By @issueatlas · Version 2 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_ycQPdCUuVu6BmrPSnah94w" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Atlas: automate cluster ops with the Atlas CLI <span>— Vectle</span></a>