How to Convert Backups to Snapshots

Validated on 1 Aug 2024 • Last edited on 23 Jan 2025

Backups are automatically-created disk images of Droplets. Enabling backups for Droplets enables system-level backups at weekly or daily intervals, which provides a way to revert to an older state or create new Droplets.

Backups and snapshots are both disk images of Droplets. We retain weekly backups for four weeks and daily backups for seven days, and we retain snapshots until you choose to delete them.

If you want to keep a backup indefinitely, you can convert it to a snapshot. When you convert a backup to a snapshot, snapshot pricing applies.

Convert to a Snapshot

Using the Control Panel

To convert a backup to a snapshot from the control panel, click the Droplet’s name to go to its detail page, then click Backups in the left menu.

Find the backup that you want to convert. Click More to open the drop-down menu, then click Convert to snapshot.

The backup list for a Droplet with the More menu of a specific backup opened

You can create Droplets based on snapshots and copy snapshots to additional datacenter regions.

Using the API

To convert a backup to a snapshot using the API, use the image actions endpoint and set the type field to convert.

How to Add an Image to a Region Using the DigitalOcean CLI
  1. Install doctl, the official DigitalOcean CLI.
  2. Create a personal access token and save it for use with doctl.
  3. Use the token to grant doctl access to your DigitalOcean account.
    doctl auth init
  4. Finally, run doctl compute image-action transfer. Basic usage looks like this, but you can read the usage docs for more details:
    doctl compute image-action transfer <image-id> [flags]
    The following example transfers an image with the ID 386734086 to the region with the slug nyc3:
    doctl compute image-action transfer 386734086 --region nyc3
How to Add an Image to a Region Using the DigitalOcean API
  1. Create a personal access token and save it for use with the API.
  2. Send a POST request to https://api.digitalocean.com/v2/images/{image_id}/actions.

cURL

Using cURL:

# Transfer an Existing Image
curl -X POST \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \
  -d '{"type":"transfer","region":"nyc2"}' \
  "https://api.digitalocean.com/v2/images/7938269/actions"

# Convert an Image into a Snapshot
curl -X POST \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \
  -d '{"type":"convert"}' \
  "https://api.digitalocean.com/v2/images/7938291/actions"

Go

Using Godo, the official DigitalOcean API client for Go:

import (
    "context"
    "os"

    "github.com/digitalocean/godo"
)

func main() {
    token := os.Getenv("DIGITALOCEAN_TOKEN")

    client := godo.NewFromToken(token)
    ctx := context.TODO()

    // Transfer an existing image
    transferRequest := &godo.ActionRequest{
        "type":   "transfer",
        "region": "nyc2",
    }
  # Transfer an Image
    transfer, _, err := client.ImageActions.Transfer(ctx, 7938269, transferRequest)

  # Convert an Image to a Snapshot
  # client.image_actions.convert(image_id: 7938269)

}

Ruby

Using DropletKit, the official DigitalOcean API client for Ruby:

require 'droplet_kit'
token = ENV['DIGITALOCEAN_TOKEN']
client = DropletKit::Client.new(access_token: token)

# Transfer an Image
client.image_actions.transfer(image_id: 7938269, region: 'nyc2')

# Convert an Image to a Snapshot
# client.image_actions.convert(image_id: 7938269)

Python

Using PyDo, the official DigitalOcean API client for Python:

import os
from pydo import Client

client = Client(token=os.environ.get("DIGITALOCEAN_TOKEN"))

req = {
  "type": "convert"
}
resp = client.image_actions.post(image_id=342341, body=req)

We can't find any results for your search.

Try using different keywords or simplifying your search terms.