Managing File Storage snapshots using the Scaleway API
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:
- A Scaleway account logged in to the console (External link)
- Owner status or IAM permissions allowing you to perform actions in the intended Organization
- An API key with sufficient permissions
- Created a file system
curlor another HTTP client installed
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
-
Run the following command to retrieve the ID of the file system you want to snapshot:
Copycurl -X GET \ -H "X-Auth-Token: $SCW_SECRET_KEY" \ "https://api.scaleway.com/file/v1alpha1/regions/$SCW_DEFAULT_REGION/filesystems" -
Run the following command to create a snapshot of the file system. Replace the placeholders with the appropriate values.
Copycurl -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
creatinguntil the snapshot is ready, then it switches toavailable.
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
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.