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

Managing File Storage snapshots using the Scaleway API

Important

The snapshot feature for File Storage is currently in private beta. You can request access from the betas page (External link).

A snapshot is a point-in-time copy of a File Storage file system. You can use snapshots to back up the data stored on your file systems.

Snapshots are billed based on the actual size of the data stored, rather than on the provisioned capacity. Creating a snapshot of a 1 TB volume containing 2 GB of data will result in a 2 GB snapshot.

This page shows you how to create, list, retrieve, update, and delete File Storage snapshots using the File Storage API (External link).

Before you start

To complete the following actions, you must have:

Configure your environment variables

Open a terminal and run the following commands to export the environment variables used on this page. Replace the placeholders with your API secret key and the ID of the Project in which your file system is located.

export SCW_SECRET_KEY="<YOUR_API_SECRET_KEY>"
export SCW_DEFAULT_REGION="fr-par"
export SCW_PROJECT_ID="<YOUR_PROJECT_ID>"

Create a snapshot

  1. Run the following command to retrieve the ID of the file system you want to snapshot:

    curl -X GET \
      -H "X-Auth-Token: $SCW_SECRET_KEY" \
      "https://api.scaleway.com/file/v1alpha1/regions/$SCW_DEFAULT_REGION/filesystems"
    Note

    The file system must be in the available status to create a snapshot. If the file system is in a transient status (for example, updating), wait until the current operation completes.

  2. Run the following command to create a snapshot of the file system. Replace the placeholders with the appropriate values.

    curl -X POST \
      -H "X-Auth-Token: $SCW_SECRET_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "filesystem_id": "<FILE_SYSTEM_ID>",
        "name": "<SNAPSHOT_NAME>",
        "project_id": "'"$SCW_PROJECT_ID"'",
        "tags": ["backup"]
      }' \
      "https://api.scaleway.com/file/v1alpha1/regions/$SCW_DEFAULT_REGION/snapshots"

    The API returns the snapshot object. The snapshot status is creating until the snapshot is ready, then it switches to available.

List snapshots

Run the following command to list all snapshots in the region:

curl -X GET \
  -H "X-Auth-Token: $SCW_SECRET_KEY" \
  "https://api.scaleway.com/file/v1alpha1/regions/$SCW_DEFAULT_REGION/snapshots"

See the File Storage API documentation (External link) for more information on the different filters available.

Get snapshot details

Run the following command to retrieve the properties and current status of a snapshot. Replace <SNAPSHOT_ID> with the ID of your snapshot.

curl -X GET \
  -H "X-Auth-Token: $SCW_SECRET_KEY" \
  "https://api.scaleway.com/file/v1alpha1/regions/$SCW_DEFAULT_REGION/snapshots/<SNAPSHOT_ID>"

The API returns the snapshot object. See the File Storage API documentation (External link) for more information on the different fields.

Update a snapshot

You can update the name and the tags of a snapshot.

Run the following command to update a snapshot. Replace the placeholders with the appropriate values.

curl -X PATCH \
  -H "X-Auth-Token: $SCW_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "<NEW_SNAPSHOT_NAME>",
    "tags": ["backup", "production"]
  }' \
  "https://api.scaleway.com/file/v1alpha1/regions/$SCW_DEFAULT_REGION/snapshots/<SNAPSHOT_ID>"

The API returns the updated snapshot object.

Delete a snapshot

Important

Deleting a snapshot is permanent. You cannot recover a deleted snapshot.

Run the following command to delete a snapshot. Replace <SNAPSHOT_ID> with the ID of your snapshot.

curl -X DELETE \
  -H "X-Auth-Token: $SCW_SECRET_KEY" \
  "https://api.scaleway.com/file/v1alpha1/regions/$SCW_DEFAULT_REGION/snapshots/<SNAPSHOT_ID>"

The API returns the snapshot object with the deleting status.

Still need help?

Create a support ticket
No Results