**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

```bash
# 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.