Easiest way to revert to a snapshot?

Hi everyone,

I recently wanted to do some testing scenarios where if the change didn't go according to plan I would be able to rollback to that original image. I haven't found any ProfitBricks documentation that had the information or answer I was looking for.

My current process is to take a Snapshot of the HDD storage, once complete, make the change in the VM and have a go/no go decision. If this fails, what I've done is attached a HDD Storage with the Snapshot from above, make it the boot storage, detach the now "broken" VM, provision the changes and repeat the process.

Is there an easier way to revert to snapshots?

  • **bold**
  • _italics_
  • `code`
  • ```code block```
  • # Heading 1
  • ## Heading 2
  • > Quote


You could put together a script to make calls against the Cloud API that could potentially automate the snapshot creation and restoration process a bit.

The relevant API calls are documented at:

Create a Volume Snapshot

Restore a Volume Snapshot

I'm not sure how much "easier" this would be than using the DCD.

The basic outline would be:

  • Get the volumeId for the storage volume that you need to take a snapshot of.
  • Create a new snapshot giving it a helpful name.
  • Check the request status to see when the snapshot is complete.
  • Get the snapshotId from the list of available snapshots.
  • Perform the go/no-go testing.
  • If rollback is necessary, call restore-snapshot passing in the snapshotId.

I don't have a script all put together, but here is a set of curl calls showing the process outlined above.

curl --user 'username@domain.tld:password' \{DATACENTER-ID}/volumes?depth=2

That will return a list of volumes and their details (appending ?depth=2 does this) so we can pick out the relevant volumeId. Use that volumeId to create a snapshot.

curl --include \
     --user 'username@domain.tld:password' \
     --request POST \
     --header "Content-Type: application/x-www-form-urlencoded" \
     --data-urlencode "name=PrePatchSnap01" \{DATACENTER-ID}/volumes/{VOLUME-ID}/create-snapshot

That API call will return a status URL (in the headers) that can be checked periodically until it shows the snapshot is ready. (Changes from RUNNING to DONE.)

curl --user 'username@domain.tld:password' \{REQUEST-STATUS-ID}/status

Now we get a list of snapshots and their details, looking for one with the name= that was set when creating the snapshot above.

curl --user 'username@domain.tld:password' \

If we want to revert to the snapshot, then encode the snapshotId (example: 25b30e97-c646-4435-a681-b49527374810) and make the request to restore-snapshot like this:

curl --include --user 'username@domain.tld:password' \
     --request POST \
     --header "Content-Type: application/x-www-form-urlencoded" \
     --data-urlencode "snapshotId=25b30e97-c646-4435-a681-b49527374810" \{DATACENTER-ID}/volumes/{VOLUME-ID}/restore-snapshot

There will be another status URL, in the returned headers, that can be checked to see when the restore-snapshot operation has completed.

I'm not currently aware of which, if any, of the available ProfitBricks Tools could be leveraged to address snapshot creation and restoration. Perhaps somebody else in the community has another solution and will chime in.


  • Thanks Eric for the detailed response! I agree that using the API / PowerShell / Command line method would be the most repeatable process and will have to give that a try.

    Would be a "Nice to have" feature to have in the DCD itself that Storage objects knew that they had SnapShot available to revert to. I guess it's more of a specific scenario based situation for me where we're using one Datacenter as a lab area for testing and need to do this regularly.

    Much appreciate the suggestion and answer!