Getting started with Managed Service for MongoDB

    To use the service, create a cluster and connect to a DBMS:

    1. All you need to create a database cluster is a folder in Yandex.Cloud that you are allowed to access. If you already have a folder in Yandex.Cloud, open the page of that folder in the management console. If there is no folder yet, create one:

      1. Click Create folder in the Home page of the management console.

      2. Enter the folder name.

        • The name must be unique within the folder.
        • The name may contain lowercase Latin letters, numbers, and hyphens.
        • The first character must be a letter. The last character can't be a hyphen.
        • The maximum length of the name is 63 characters.
      3. Select Create a default network. A network is created with subnets in each availability zone.

      4. Click Create folder.

    2. Create a VM (based on Linux or Windows) that you will use for accessing the DB cluster. If you plan to connect to the database from outside Yandex.Cloud, request external IP addresses for hosts when creating a cluster.

      1. To connect to a DB cluster from inside the Cloud, create a VM in the same network as the DB cluster (based on Linux or Windows)
      2. To connect to a cluster from the internet, request public access to the hosts when creating the cluster.
    3. In the management console, select the folder where you want to create a cluster.

    4. Select Managed Service for MongoDB.

    5. Click Create cluster and select the necessary DBMS.

    6. Set the cluster parameters and click Create cluster. This process is described in detail in Creating MongoDB clusters.

    7. When the cluster is ready, its status on the Managed Service for MongoDB dashboard will change to RUNNING.

    8. To connect to the DB server, you need an SSL certificate. You can prepare all the necessary authentication data as follows:

      $ mkdir ~/.mongodb
      $ wget "" -O ~/.mongodb/CA.pem
    9. You can now connect to the cluster:

      $ mongo --norc \
              --ssl \
              --sslCAFile ~/.mongodb/CA.pem \
              --host 'rs01/<address of host 1>:27018,<address of host 2>:27018,<address of host N>:27018' \
              -u <user name> \
              -p <user password> \
              <DB name>