Docs Menu

Save Connection Settings

On this page

  • Locate the Configuration File
  • Create a Profile
  • Update a Profile
  • Run a Command with a Profile

You can save your frequently-used connection settings as profiles. Profiles store the project IDs, organization IDs, and, optionally, API keys to use in future Atlas CLI sessions. To save time, you can specify a profile instead of using the --projectId and --orgId flags with each command. The Atlas CLI stores your profiles in a configuration file called config.toml.

Note

Any settings stored in environment variables take precedence over settings stored in profiles. Any project or organization specified with the --projectId and --orgId flags take precedence over both the profile and the environment variables.

The Atlas CLI saves the configuration file to the following location depending on your operating system:

The Atlas CLI grants the user who ran the command read and write access to the file.

The first time you run the atlas auth login or atlas config init command, the Atlas CLI automatically creates the config.toml file and a default profile. If you run a command without specifying a profile, environment variables, or --projectId and --orgId flags, the Atlas CLI uses the default profile for the command.

Select a connection method based on your use case:

Command
Authentication Method
Use Case
atlas auth login
Atlas login credentials and an authentication token
Best for non-programmatic use
atlas config init
API keys
Best for programmatic use

To learn more, see Select a Connection Method.

Select a use case and follow the procedure to create a profile.

You can update the settings stored in your configuration file in the following ways:

  • Edit the config.toml file with a text editor.
  • Run the atlas config set command for a setting. This edits an individual value in the config.toml file.

To run an Atlas CLI command using a profile:

  • Create a Profile.
  • Append the --profile <profileName> flag to a command or omit the --profile <profileName> flag to use the default profile.
Example

This command uses a profile named myProfile:

atlas <command> --profile myProfile

This command uses the default profile:

atlas <command>
Give Feedback
MongoDB logo
© 2021 MongoDB, Inc.

About

  • Careers
  • Investor Relations
  • Legal Notices
  • Privacy Notices
  • Security Information
  • Trust Center
© 2021 MongoDB, Inc.