# Using MongoDB Atlas

In a critical operational context, it can be safer to rely on MongoDB Atlas (opens new window) than on your own instance of MongoDB.

To use MongoDB Atlas with Kargo, there are few things to do:

  1. Create your cluster on MongoDB Atlas

  2. Enables the connection from Kargo to your cluster. On AWS the best practice is to enable a peering connection between your Kargo VPC and your cluster VPC. See the documentation (opens new window) for the detailed procedure.

  3. Configure the services in Kargo to use MongoDB Atlas.

The tricky thing is that you will need to configure the services with the appropriate connection string. Indeed, the connection string provided by MongoDB Atlas is dependent from the MongoDB driver you use and for now Krawler based jobs are using the version 3 of the MongoDB driver while KDK based applications are using the version 2.

In your .env file:

  • declare the following variables, with the connections strings provided by MongoDB Atlas:


To get the connection strings, click on the CONNECT button attached to your cluster. Then select Connect your application and a window will display the connection strings for the different version of the driver.


Do not forget to quote the variables.

  • update the DB URL variables for the services, for instance: