Managed MongoDB® is currently in private beta. Click here to join the waiting list.
Managed Database for MongoDB®
Introduction
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 page to find definitions of the different terms referring to Managed Database for MongoDB®.
Quickstart
-
Configure your environment variables.
NoteThis is an optional step that seeks to simplify your usage of the APIs.
export SCW_ACCESS_KEY="<API access key>"export SCW_SECRET_KEY="<API secret key>"export SCW_REGION="<Scaleway region>" -
Edit the POST request payload you will use to create your Database Instance. Replace the parameters in the following example:
'{"project_id": "d8e65f2b-cce9-40b7-80fc-6a2902db6826","name": "myDB","node_number": 1,"user_name": "my_initial_user","password": "thiZ_is_v0ry_s3cret","version": "7.0.12","tags": ["donnerstag"],"node_type": "mgdb-pro2-l","volume": [{"volume_size": 10000000000,"volume_type": "sbs_5k"},],"endpoints": [{"public": {}}]}'Parameter Description project_id
REQUIRED 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 console. name
REQUIRED Name of the Database Instance node_number
REQUIRED Number of nodes in the Database Instance. You can select either 1 or 3. user_name
REQUIRED Identifier of the default user, which is created concurrently with the Database Instance password
REQUIRED Password for the default user version
REQUIRED Version ID of the MongoDB® engine. To check the list of available version you can use the folowing endpoint: https://api.scaleway.com/mongodb/v1alpha1/regions/$SCW_REGION/versions
tags
The 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 posess all the appended tags.node_type
REQUIRED The node type. To check the list of available node types you can use the folowing endpoint: https://api.scaleway.com/mongodb/v1alpha1/regions/$SCW_REGION/node-types
volume_type
REQUIRED Type of volume where data is stored. You can specify either sbs_5k
orsbs_15k
. The default value issbs_5k
volume_size
REQUIRED Volume size expressed in bytes. For example 30GB is expressed as 30000000000 endpoints
REQUIRED 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"
-
Create a Database Instance by running the following command. Make sure you include the payload you edited in the previous step.
curl -X POST \-H "X-Auth-Token: $SCW_SECRET_KEY" \"Content-Type: application/json" \https://api.scaleway.com/mongodb/v1alpha1/regions/$SCW_REGION/instances \-d '{"project_id": "d8e65f2b-cce9-40b7-80fc-6a2902db6826","name": "myDB","node_number": 1,"user_name": "my_initial_user","password": "thiZ_is_v0ry_s3cret","version": "7.0.12","tags": ["donnerstag"],"node_type": "mgdb-pro2-l","volume": [{"volume_size": 10000000000,"volume_type": "sbs_5k"}],"enpoints":[{"public": {}}],}' -
List your Database Instances.
curl -X GET \-H "Content-Type: application/json" \-H "X-Auth-Token: $SCW_SECRET_KEY" https://api.scaleway.com/mongodb/v1alpha1/regions/$SCW_REGION/instancesYou should get a response like the following:
NoteThis is a response example, the UUIDs and IP address displayed are not real.
{"id": "ffc473a3-250a-40a1-8d12-0d8c47b2ac63","name": "cluster","project_id": "d8e65f2b-cce9-40b7-80fc-6a2902db6826","status": "provisioning","version": "7.0.12","tags": [],"settings": [],"node_number": 1,"node_type": "mgdb-pro2-l","volume": {"type": "sbs_5k","size": 10000000000},"endpoints": [{"id": "1210e327-5f6e-4757-834d-483729dcd330","ips": [],"dns_records": ["ffc473a3-250a-40a1-8d12-0d8c47b2ac63.mgdb.fr-par.scw.cloud"],"port": 27017,"public": {}}],"created_at": "2024-10-17T12:26:46.473753Z","region": "fr-par"} -
Retrieve your Database Instance ID from the response.
-
Get your TLS certificate in the console.
-
Connect to your Database Instance with the
mongosh
client.mongosh "mongodb+srv://{database_instance_id}.mgdb.{region}.scw.cloud" --tlsCAFile {your_certificate.pem} -u {username}NoteAlternatively, you can connect using different clients. Refer to the How to connect to a MongoDB Database Instance documentation page for more information.
-
Enter the database password that you defined upon creation.
You are now connected to your Managed Database.
To perform the following steps, you must first ensure that:
- you have an account and are logged into the Scaleway console
- you have created an API key and that the API key has sufficient IAM permissions to perform the actions described on this page.
- you have installed
curl
Technical Information
Regions
Scaleway's infrastructure is spread across different regions and Availability Zones.
Currently, Managed Database for 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 Database for MongoDB®, you can check out the following pages:
- Managed Database for MongoDB® Documentation
- Scaleway Slack Community join the #database channel
- Contact our support team.
Database Instances
A Managed Database for MongoDB® Database Instance is composed of one or multiple dedicated compute nodes running a single database engine.
GET
/mongodb/v1alpha1/regions/{region}/instances
POST
/mongodb/v1alpha1/regions/{region}/instances
GET
/mongodb/v1alpha1/regions/{region}/instances/{instance_id}
PATCH
/mongodb/v1alpha1/regions/{region}/instances/{instance_id}
DELETE
/mongodb/v1alpha1/regions/{region}/instances/{instance_id}
GET
/mongodb/v1alpha1/regions/{region}/instances/{instance_id}/certificate
POST
/mongodb/v1alpha1/regions/{region}/instances/{instance_id}/upgrade
Node Types
Two node type ranges are available:
- Cost-Optimized: a complete and highly reliable node range with shared resources that is made for scaling from development to production needs, at affordable prices.
- Production-Optimized: database nodes with dedicated vCPU for the most demanding workloads and mission-critical applications.
GET
/mongodb/v1alpha1/regions/{region}/node-types
MongoDB® Versions
A database engine is the core software that handles the storage, retrieval, and management of data in your Database Instance.
GET
/mongodb/v1alpha1/regions/{region}/versions
Snapshots
A snapshot is a consistent, instantaneous copy of the Block Storage volume of your Database Instance at a certain point in time.
POST
/mongodb/v1alpha1/regions/{region}/instances/{instance_id}/snapshots
GET
/mongodb/v1alpha1/regions/{region}/snapshots
GET
/mongodb/v1alpha1/regions/{region}/snapshots/{snapshot_id}
POST
/mongodb/v1alpha1/regions/{region}/snapshots/{snapshot_id}
DELETE
/mongodb/v1alpha1/regions/{region}/snapshots/{snapshot_id}
POST
/mongodb/v1alpha1/regions/{region}/snapshots/{snapshot_id}/restore
Users
Users are profiles to which you can attribute database-level permissions. They allow you to define permissions specific to each type of database usage.
GET
/mongodb/v1alpha1/regions/{region}/instances/{instance_id}/users
POST
/mongodb/v1alpha1/regions/{region}/instances/{instance_id}/users
PATCH
/mongodb/v1alpha1/regions/{region}/instances/{instance_id}/users/{name}
Instance Endpoints
Instance endpoints enable connection to your instance.
POST
/mongodb/v1alpha1/regions/{region}/endpoints
DELETE
/mongodb/v1alpha1/regions/{region}/endpoints/{endpoint_id}