- Replace
server-id
with the unique identifier of the Instance. - Replace
fr-par-1
with the Availability Zone your Instance is deployed in.
Creating backups of Instances via the Scaleway API
The Backup feature is used to back up your Instance data. It creates an image of a snapshot that contains all your volumes. You can create backups of your Instances using either the Scaleway CLI tool or the Instances API.
Before you start
To complete the actions presented below, you must have:
- A Scaleway account logged into the console
- Owner status or IAM permissions allowing you to perform actions in the intended Organization
- A valid API key
Creating a backup
Use the following commands to create a backup of your Instance using the Scaleway CLI.
scw instance server backup server-id zone=fr-par-1
By default, the name of the image is built according to the name of the server and the date. You can specify a name for the image in the request:
scw instance server backp server-id zone=fr-par-1 name=myimagename
A backup request will create an image object. You can view it using:
scw instance image get image-uid zone=fr-par-1
An image contains one snapshot for each volume of the Instance. These snapshots are visible within the image response as root_volume
and extra_volumes
fields.
A backup is created using the Instances API with the following command:
POST https://api.scaleway.com/instance/v1/zones/<region>/servers/<uid>/action{"action":"backup"}
Replace <region>
with the geographical region of the Instance. For Instances located in Paris, for example, this value would be fr-par-1
. Replace <uid>
with the unique identifier of the Instance.
By default, the name of the image is built according to the name of the server and the date:
image_<servername>_YYYY-MM-DD_hh-mm.
Alternatively, you can specify a name for the image in the request:
POST https://api.scaleway.com/instance/v1/zones/<region>/servers/<id>/action{ "action":"backup", "name":"myimagename" }
A backup request will create an image object (visible in the href_result
: /images/<image_uuid>
)
GET https://api.scaleway.com/instance/v1/zones/<region>/images/<image_uid>
An image contains one snapshot for each volume of the Instance. These snapshots are visible within the image response, as root_volume
and extra_volumes
fields.
Deleting a Backup
To delete a backup, run the following command:
scw instance image delete image-uid zone=fr-par1
It is also recommended to remove every snapshot related to the image by running the following command for each snapshot that is no longer needed:
scw instance snapshot delete snapshot-uid zone=fr-par-1
Run the following call to delete the image that contains a backup:
DELETE https://api.scaleway.com/instance/v1/zones/<region>/images/<image_uid>
It is also recommended to remove every snapshot related to the image by running the following API call for each snapshot that is no longer needed:
DELETE https://api.scaleway.com/instance/v1/zones/<region>/snapshots/<snapshot_uid>