Scaleway logo
Managed MongoDB®

Managed MongoDB®

Managed MongoDB® Databases provide fully-managed document Database Instances, with MongoDB® as a database engine.

Document databases enable users to store and retrieve data in a document format, such as json. Compared to traditional relational databases where data is stored in a table-like format, document-type storage supports storing multiple nested keys and values in each document key.

Concepts

Refer to our dedicated concepts pageOpen in new context to find definitions of the different terms referring to Managed MongoDB®.

Quickstart

  1. Configure your environment variables.

    Note

    This is an optional step that seeks to simplify your usage of the APIs.

    TerminalCode
    export SCW_ACCESS_KEY="<API access key>" export SCW_SECRET_KEY="<API secret key>" export SCW_REGION="<Scaleway region>"
  2. Edit the POST request payload you will use to create your Database Instance. Replace the parameters in the following example:

    JSONCode
    '{ "project_id": "d8e65f2b-cce9-40b7-80fc-6a2902db6826", "name": "myDB", "node_amount": 1, "user_name": "my_initial_user", "password": "thiZ_is_v0ry_s3cret", "version": "7.0", "tags": ["donnerstag"], "node_type": "mgdb-pro2-l", "volume": [ { "size_bytes": 10000000000, "type": "sbs_5k" }, ], "endpoints": [ { "public_network": {} } ] }'
    ParameterDescription
    project_idREQUIRED The ID of the Project you want to create your Database Instance in. To find your Project ID you can list the projects or consult the Scaleway consoleOpen in new context.
    nameREQUIRED Name of the Database Instance
    node_amountREQUIRED Number of nodes in the Database Instance. You can select either 1 or 3.
    user_nameREQUIRED Identifier of the default user, which is created concurrently with the Database Instance
    passwordREQUIRED Password for the default user
    versionREQUIRED Version ID of the MongoDB® engine. To check the list of available version you can use the following endpoint: https://api.scaleway.com/mongodb/v1/regions/$SCW_REGION/versions
    tagsThe list of tags ["tag1", "tag2", ...] that will be associated with the Database Instance. Tags can be appended to the query of the List Database Instances call to show results for only the Database Instances using a specific tag. You can also combine tags to list Database Instances that possess all the appended tags.
    node_typeREQUIRED The node type. To check the list of available node types you can use the following endpoint: https://api.scaleway.com/mongodb/v1/regions/$SCW_REGION/node-types
    volume.typeREQUIRED Type of volume where data is stored. You can specify either sbs_5k or sbs_15k. The default value is sbs_5k
    volume.size_bytesREQUIRED Volume size expressed in bytes. For example 30GB is expressed as 30000000000
    endpointsREQUIRED Network connection point that allows you to access and interact with your managed Database Instance. You can leave this empty as it will be automatically generated. It takes on the following format: {instance_id}.mgdb.{region}.scw.cloud"
  3. Create a Database Instance by running the following command. Make sure you include the payload you edited in the previous step.

    TerminalCode
    curl -X POST \ -H "X-Auth-Token: $SCW_SECRET_KEY" \ "Content-Type: application/json" \ https://api.scaleway.com/mongodb/v1/regions/$SCW_REGION/instances \ -d '{ "project_id": "d8e65f2b-cce9-40b7-80fc-6a2902db6826", "name": "myDB", "node_amount": 1, "user_name": "my_initial_user", "password": "thiZ_is_v0ry_s3cret", "version": "7.0", "tags": ["donnerstag"], "node_type": "mgdb-pro2-l", "volume": [ { "size_bytes": 10000000000, "type": "sbs_5k" } ], "endpoints":[ { "public_network": {} } ], }'
  4. List your Database Instances.

    TerminalCode
    curl -X GET \ -H "Content-Type: application/json" \ -H "X-Auth-Token: $SCW_SECRET_KEY" https://api.scaleway.com/mongodb/v1/regions/$SCW_REGION/instances

    You should get a response like the following:

    Note

    This is a response example, the UUIDs and IP address displayed are not real.

    JSONCode
    { "id": "ffc473a3-250a-40a1-8d12-0d8c47b2ac63", "name": "cluster", "project_id": "d8e65f2b-cce9-40b7-80fc-6a2902db6826", "status": "provisioning", "version": "7.0", "tags": [], "settings": [], "node_amount": 1, "node_type": "mgdb-pro2-l", "volume": { "type": "sbs_5k", "size_bytes": 10000000000 }, "endpoints": [ { "id": "1210e327-5f6e-4757-834d-483729dcd330", "ips": [], "dns_records": [ "ffc473a3-250a-40a1-8d12-0d8c47b2ac63.mgdb.fr-par.scw.cloud" ], "port": 27017, "public_network": {} } ], "created_at": "2024-10-17T12:26:46.473753Z", "region": "fr-par" }
  5. Retrieve your Database Instance ID from the response.

  6. Get your TLS certificate in the console.

  7. Connect to your Database Instance with the mongosh client.

    TerminalCode
    mongosh "mongodb+srv://{database_instance_id}.mgdb.{region}.scw.cloud" --tlsCAFile {your_certificate.pem} -u {username}

    Note

    Alternatively, you can connect using different clients. Refer to the How to connect to a MongoDB Database InstanceOpen in new context documentation page for more information.

  8. Enter the database password that you defined upon creation.

You are now connected to your Managed Database.

Requirement

To perform the following steps, you must first ensure that:

Technical Information

Regions

Scaleway's infrastructure is spread across different regions and Availability ZonesOpen in new context.

Currently, Managed MongoDB® is available only in the Paris region, which is represented by the following path parameter:

  • fr-par

MongoDB® specifications

User Management

  • Currently, a single user is created when you create your Database Instance. This user has an admin role.
  • Users with an admin role have access to all logical databases and can create new ones.

Going Further

For more information about Managed MongoDB®, you can check out the following pages:

Tags