Skip to navigationSkip to main contentSkip to footerScaleway Docs HomepageAsk our AI
Ask our AI

Manage MongoDB® Database snapshots

Snapshots allow you to restore data in a new Database Instance.

You can have up to 100 snapshots per Instance and project (depending on quotas).

Before you start

To complete the actions presented below, you must have:

Create snapshots

  1. Go to the Snapshots tab of your Database Instance of choice.
  2. Click + Create snapshot.
    Important

    Make sure your Instance is in READY state before creating a snapshot.

    A pop-up displays.
  3. Enter a name for your snapshot and set up the expiration date and time.
    Note

    The default retention period for snapshots is 365 days.

  4. Click Create snapshot to confirm.

Set up a snapshot automation policy via API

You can automate the creation of snapshots for your MongoDB® Database Instance using the update Database Instance endpoint of the Managed MongoDB® API.

  1. Retrieve the ID of the Database Instance you want to configure, either from the console or using the list Database Instances endpoint.

  2. Send a PATCH request to the update Database Instance endpoint, and include the following parameters in the request body:

    • is_snapshot_schedule_enabled: set to true to activate the snapshot automation policy.
    • snapshot_schedule_frequency_hours: frequency, in hours, at which snapshots are created automatically.
    • snapshot_schedule_retention_days: retention period, in days, of each automatically created snapshot.
    curl -X PATCH \
      "https://api.scaleway.com/mongodb/v1/regions/fr-par/instances/11111111-1111-1111-1111-111111111111" \
      -H "X-Auth-Token: $SCW_SECRET_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "is_snapshot_schedule_enabled": true,
        "snapshot_schedule_frequency_hours": 24,
        "snapshot_schedule_retention_days": 7
      }'
    Note

    The base timestamp for snapshot creation is the time at which you update the policy. For example, if you update the frequency to 24 hours at 08:00 on a Thursday, the next automatic snapshot is created at 08:00 on Friday.

  3. Check the snapshot_schedule object in the response to confirm the policy is applied.

Create a Database Instance from a snapshot

You can restore the data contained in a snapshot to a Database Instance. When you do so, a new Database Instance is created and billed to your account.

  1. Go to the Snapshots tab of your Database Instance of choice.

  2. Click the more icon next to the name of the snapshot.

  3. Click Create Database Instance from snapshot. A pop-up appears.

  4. Enter a name for your new Instance.

  5. Choose a node type.

    Important

    It is possible to select a different (larger or smaller) node type for your new Instance. However, the block volume size will be the same as the size of the restored snapshot. All Instance settings will be restored if you chose a node type with the same or more memory size than the initial Instance. Settings will be reset to the default if your node type has less memory.

  6. Select a replica set configuration. You can choose between:

    • Replica-set 1-node - an instance of MongoDB® that runs as a single server and does not provide redundancy or high availability.
    • Replica-set 3-nodes - a group of 3 MongoDB® servers (1 primary and 2 standby nodes) that maintain the same data set. Replica sets provide redundancy and high availability and are the basis for all production deployments. If the main node fails for any reason, one of the remaining standby nodes is assigned and can take over requests, reducing downtime.
  7. Review the estimated cost.

  8. Click Create Instance to confirm.

    You can see the new Instance in your Database Instances list.

Delete snapshots

When you delete a Database Instance, the associated snapshots are not deleted. Snapshots will be deleted after the retention period defined.

If you do not wish to wait for the snapshot to expire, you can delete it manually.

  1. Go to the Snapshots tab of your Database Instance of choice.
  2. Click more icon next to the name of the snapshot.
  3. Click Delete. A pop-up displays to warn you that:
    Important

    This action is irreversible and will permanently destroy your snapshot and all its data.

  4. Type DELETE and click Delete snapshot if you wish to continue.
Still need help?

Create a support ticket
No Results