Docs Home → Atlas Command Line Interface
Atlas CLI Environment Variables
On this page
For easier scripting, you can specify configuration settings by using environment variables.
Precedence
When you run any command, each setting that you specify with an environment variable takes precedence over the profile stored in the configuration file.
When you run a command using the
--projectId
option, the command line option takes precedence over both the environment variable and the profile stored in the configuration file.
Supported Environment Variables
Important
Atlas CLI supports both MongoDB CLI environment variables and Atlas CLI environment variables. You can use either MongoDB CLI environment variables or Atlas CLI environment variables, but not both together.
The Atlas CLI supports the following environment variables:
Variable | Description | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
MONGODB_ATLAS_PUBLIC_API_KEY | Sets the public API key for commands that interact with
Atlas. | ||||||||||
MONGODB_ATLAS_PRIVATE_API_KEY | Sets the private API key for commands that interact with
Atlas. | ||||||||||
MONGODB_ATLAS_ORG_ID | Sets the organization ID for commands that require the
--orgId option. | ||||||||||
MONGODB_ATLAS_PROJECT_ID | Sets the project ID for commands that require the --projectId
option. | ||||||||||
MONGODB_ATLAS_OUTPUT | Sets the output fields and format. Valid values are:
| ||||||||||
MONGODB_ATLAS_MONGOSH_PATH | The full path on your local system to the MongoDB Shell,
mongosh . | ||||||||||
MONGODB_ATLAS_SKIP_UPDATE_CHECK | When set to yes , the Atlas CLI does not prompt you to update
to new versions. | ||||||||||
MONGODB_ATLAS_ACCESS_TOKEN | String that grants access to your Atlas account. The access token is
valid for 12 hours. | ||||||||||
MONGODB_ATLAS_REFRESH_TOKEN | String that allows Atlas to automatically request a new
access token when the current access token expires. |