NavigationContentFooter
Jump toSuggest an edit

Managing Instance snapshots with the CLI (v2)

Reviewed on 14 October 2024Published on 24 September 2022

You can use the Scaleway CLI to create, export, and import snapshots of your Instances. A snapshot is a QCOW2 image of your Instance’s volumes, stored in a Scaleway Object Storage bucket. It can be imported into any Availability Zone, as long as it is in the same region as the bucket in which it is hosted.

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
  • An SSH key
  • A valid API key
  • Downloaded and installed the Scaleway CLI v2

Creating a snapshot using the CLI

To create a snapshot from a volume using the CLI, run the following command:

scw instance snapshot create [arg=value ...]

The following arguments and flags are available to customize your command:

ARGS:
[name=<generated>] Name of the snapshot
[volume-id] UUID of the volume
[tags.{index}] The tags of the snapshot
[project-id] Project ID to use. If none is passed the default project ID will be used
[bucket] Bucket name for snapshot imports
[key] Object key for snapshot imports
[size] Imported snapshot size, must be a multiple of 512
[organization-id] Organization ID to use. If none is passed the default organization ID will be used
[zone=fr-par-1] Zone to target. If none is passed will use the default zone from the config (fr-par-1 | fr-par-2 | fr-par-3 | nl-ams-1 | nl-ams-2 | pl-waw-1)
FLAGS:
-h, --help help for create
-w, --wait wait until the snapshot is ready
GLOBAL FLAGS:
-c, --config string The path to the config file
-D, --debug Enable debug mode
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
-p, --profile string The config profile to use

Creating a snapshot in the default zone from the given volume ID

To create a snapshot in the default zone from the given volume ID, run the following command. Remember to replace 11111111-1111-1111-1111-111111111111 with the actual ID of your volume.

scw instance snapshot create volume-id=11111111-1111-1111-1111-111111111111

Creating a snapshot in a specific zone from the given volume ID

To create a snapshot in a specific zone (e.g. fr-par-1) from the given volume ID, run the following command. Remember to replace 11111111-1111-1111-1111-111111111111 with the actual ID of your volume.

scw instance snapshot create zone=fr-par-1 volume-id=11111111-1111-1111-1111-111111111111

Creating a named snapshot in the default zone from a given volume ID

Run the following command to create a named snapshot from the given volume ID. Remember to replace 11111111-1111-1111-1111-111111111111 with the actual ID of your volume.

scw instance snapshot create name=foobar volume-id=11111111-1111-1111-1111-111111111111

Importing a QCOW file from an Object Storage bucket as Instance snapshot

Run the following command to import a QCOW file as an Instance snapshot. Replace the bucket name my-bucket with the name of your Object Storage bucket and the file name qcow2-file-name.qcow2 with the name of your QCOW file.

scw instance snapshot create zone=fr-par-1 name=my-imported-snapshot volume-type=b_ssd bucket=my-bucket key=my-qcow2-file-name.qcow
Important

When importing existing QCOW / QCOW2 files from Object Storage as Instance snapshots, make sure that the file has the suffix .qcow or .qcow2.

Was this page helpful?
API DocsScaleway consoleDedibox consoleScaleway LearningScaleway.comPricingBlogCareers
© 2023-2024 – Scaleway