HomeComputeInstancesAPI/CLI
Migrating Instances - Gen. 1 to Gen. 2

Jump toUpdate content

Migrating Instances - DEV1/GP1 to PLAY2/PRO2

Published on 10 May 2022

This page explains how to migrate from a DEV1/GP1 Instance with local storage to a PLAY2/PRO2 Instance with Block Storage using the Scaleway APIs and the Scaleway CLI.

Note:
  • The following procedure also applies when migrating any Instance with local storage to any Instance with Block Storage.

To migrate from a source Instance with local storage to a destination Instance with Block Storage we will:

  • create an image of the source Instance, including unified snapshots of all the source Instance’s volumes,
  • create the destination Instance from the image

Local and block snapshots have different formats. To support the migration from one to the other, we use unified snapshots. Unified snapshots can be created from either a local or block volume and, in turn, used to create either a local or block volume.

Requirements:

Migrating from DEV1/GP1 to PLAY2/PRO2 via the API

  1. Get the information of your source Instance. You will need data like the Instance’s and the volumes’ UUID in the next steps.

    curl --location --request GET 'https://api.scaleway.com/instance/v1/zones/'$ZONE'/servers/'$GP1_INSTANCE_UUID'' \
    --header 'Content-Type: application/json' \
    --header 'X-Auth-Token: '$SCW_SECRET_KEY''

    Response:

    {
    "server": {
    "id": "4295c408-aaad-456a-95a0-7f5f6c2f2354",
    "name": "gp1-test",
    "arch": "x86_64",
    "commercial_type": "GP1-S",
    (...)
    "volumes": {
    "0": {
    "boot": true,
    "id": "$VOLUME0_UUID",
    (...)
    "volume_type": "l_ssd",
    (...)
    },
    "1": {
    "boot": false,
    "id": "$VOLUME1_UUID",
    (...)
    "volume_type": "b_ssd",
    (...)
    },
    "tags": [],
    "state": "running",
    (...)
    }
  2. Create a backup of the Instance.

    Make sure that you:

    • Replace $VOLUME0_UUID, $VOLUME1_UUID, and so forth with volumes’ UUIDs that you recovered in the first step of this tutorial.
    • Specify unified as the volume type of the snapshots embedded in the backup.
    curl --location --request POST 'https://api.scaleway.com/instance/v1/zones/'$ZONE'/servers/'$GP1_INSTANCE_UUID'/action/' \
    --header 'Content-Type: application/json' \
    --header 'X-Auth-Token: '$SCW_SECRET_KEY'' \
    --data-raw '{
    "action": "backup",
    "name": "'$BACKUP_NAME'",
    "volumes": {
    "'$VOLUME0_UUID'": {
    "volume_type": "unified"
    },
    "'$VOLUME1_UUID'": {
    "volume_type": "unified"
    }
    }
    }'

    Response:

    {
    "task": {
    "id": "400f529a-faf9-4171-bcba-172118713d15",
    "description": "server_backup",
    "status": "pending",
    "href_from": "/servers/4295c408-aaad-456a-95a0-7f5f6c2f2354/action",
    "href_result": "/images/34d12fd2-6792-4dcb-81d0-b3dd1a3ddc29",
    "started_at": "2022-05-11T10:43:40.777057+00:00",
    "terminated_at": null
    }
    }
    Note:

    You can find the DEV1/GP1 backup’s UUID from the href_result task output. It will be used in step 4.

  3. Check the state of the backup to make sure it is complete.

    curl --location --request GET 'https://api.scaleway.com/instance/v1/zones/'$ZONE'/images?name='$BACKUP_NAME'' \
    --header 'Content-Type: application/json' \
    --header 'X-Auth-Token: '$SCW_SECRET_KEY''

    Response:

    {
    "images": [
    {
    (...)
    "name": "gp1-backup",
    (...)
    "state": "available",
    (...)
  4. Create the target Instance from the backup.

    curl --location --request POST 'https://api.scaleway.com/instance/v1/zones/'$ZONE'/servers/' \
    --header 'Content-Type: application/json' \
    --header 'X-Auth-Token: '$SCW_SECRET_KEY'' \
    --data-raw '{
    "name": "pro2-test",
    "commercial_type": "PRO2-S",
    "project": "'$PROJECT_UUID'",
    "image":"'$GP1_BACKUP_UUID'",
    "dynamic_ip_required": true
    }'

    Response:

    "server": {
    "id": "998b88d1-1d71-4a0a-8432-5965222d14a1",
    "name": "pro2-test",
    "arch": "x86_64",
    "commercial_type": "PRO2-S",
    (...)
    "state": "stopped",
    (...)
    }
  5. Start the target Instance.

    curl --location --request POST 'https://api.scaleway.com/instance/v1/zones/'$ZONE'/servers/'$PRO2_INSTANCE_UUID'/action/' \
    --header 'Content-Type: application/json' \
    --header 'X-Auth-Token: '$SCW_SECRET_KEY'' \
    --data-raw '{
    "action": "poweron"
    }'

    Response:

    {
    "task": {
    "id": "d7902607-2fe0-45f7-874f-72201e2654d4",
    "description": "server_batch_poweron",
    "status": "pending",
    "href_from": "/servers/998b88d1-1d71-4a0a-8432-5965222d14a1/action",
    "href_result": "/servers/998b88d1-1d71-4a0a-8432-5965222d14a1",
    "started_at": "2022-05-11T10:52:23.222827+00:00",
    "terminated_at": null
    }
    }
  6. Check the status of the Instance.

    curl --location --request GET 'https://api.scaleway.com/instance/v1/zones/$ZONE/servers/'$PRO2_INSTANCE_UUID'' \
    --header 'Content-Type: application/json' \
    --header 'X-Auth-Token: '$SCW_SECRET_KEY''

    Response:

    {
    "server": {
    "id": "998b88d1-1d71-4a0a-8432-5965222d14a1",
    "name": "pro2-test",
    (...)
    "state": "running",
    (...)
    }
    }

Migrating from DEV1/GP1 to PLAY2/PRO2 via the CLI

  1. Open a terminal and type the following command, to create a DEV1/GP1 Instance:

    scw instance server create type=GP1-S zone=fr-par-2

    You will see an output like the following. The Instance’s ID will be required for the next step.

    ID                          123a12ab-12a1-1a12-123a-a1bc1234a123
    Name cli-instance-test
    Organization 0a123456-1a2b-12a3-a123-1abc0123d456
    Project 0b123456-1b2b-12b3-b123-1bca0123d456
    AllowedActions.0 poweron
    AllowedActions.1 backup
    CommercialType GP1-S
    CreationDate 1 second ago
    DynamicIPRequired false
    EnableIPv6 false
    Hostname cli-instance-test
    Image.ID 0a123456-1a2b-12a3-a123-1abc0123d456
    Image.Name Ubuntu 20.04 Focal Fossa
    Image.Arch x86_64
    Image.CreationDate 5 months ago
    Image.ModificationDate 5 months ago
    Image.ExtraVolumes 0
    Image.FromServer -
    Image.Organization 0a123456-1a2b-12a3-a123-1abc0123d456
    Image.Public true
    Image.RootVolume 0a123456-1a2b-12a3-a123-1abc0123d456
    Image.State available
    Image.Project 0a123456-1a2b-12a3-a123-1abc0123d456
    Image.Zone fr-par-2
    Protected false
    PublicIP.ID 0a123456-1a2b-12a3-a123-1abc0123d456
    PublicIP.Address 00.000.000.000
    PublicIP.Dynamic false
    ModificationDate 1 second ago
    State archived
    Bootscript x86_64 mainline 4.4.230 rev1
    BootType local
    Volumes.0.ID 0a123456-1a2b-12a3-a123-1abc0123d456
    Volumes.0.Name ubuntu_20.04_focal_fossa:volume-0
    Volumes.0.ExportURI -
    Volumes.0.Organization 0a123456-1a2b-12a3-a123-1abc0123d456
    Volumes.0.Server.ID 0a123456-1a2b-12a3-a123-1abc0123d456
    Volumes.0.Server.Name cli-instance-test
    Volumes.0.Size 300 GB
    Volumes.0.VolumeType l_ssd
    Volumes.0.CreationDate 1 second ago
    Volumes.0.ModificationDate 1 second ago
    Volumes.0.State available
    Volumes.0.Project 0b123456-1b2b-12b3-b123-1bca0123d456
    Volumes.0.Boot false
    Volumes.0.Zone fr-par-2
    SecurityGroup.ID 0b123456-1b2b-12b3-b123-1bca0123d456
    SecurityGroup.Name Default security group
    StateDetail -
    Arch x86_64
    Zone fr-par-2
  2. Type the following command to back up your Instance:

    scw instance server backup 123a12ab-12a1-1a12-123a-a1bc1234a123 zone=fr-par-2 unified=true

    Make sure that you specify unified=true as the volume type of the snapshots embedded in the backup.

    You will see an output like the following. The Image.ID will be required for the next step.

    Image.ID                 0b123456-1b2b-12b3-b123-1bca0123d456
    Image.Name cli-backup-image
    Image.Arch x86_64
    Image.CreationDate now
    Image.ModificationDate now
    Image.DefaultBootscript x86_64 mainline 4.4.230 rev1
    Image.ExtraVolumes 0
    Image.FromServer 012n23ba-25z8-7g97-530a-m6ol1941f001
    Image.Organization 0b123456-1b2b-12b3-b123-1bca0123d456
    Image.Public false
    Image.RootVolume 012n23ba-25z8-7g97-530a-m6ol1941f001
    Image.State creating
    Image.Project 012n23ba-25z8-7g97-530a-m6ol1941f001
    Image.Zone fr-par-2
  3. Type the following command to create a PLAY2/PRO2 Instance from the image created by the backup:

    scw instance server create image=0b123456-1b2b-12b3-b123-1bca0123d456 zone=fr-par-2 type=PRO2-S

    You will see an output like the following:

    ID                          2566b1c7-8b90-5d67-9876-34f4a9f2c3d1
    Name cli-srv-noisy-herschel
    Organization 0a123456-1a2b-12a3-a123-1abc0123d456
    Project 0a123456-1a2b-12a3-a123-1abc0123d456
    AllowedActions.0 poweron
    AllowedActions.1 backup
    CommercialType PRO2-S
    CreationDate now
    DynamicIPRequired false
    EnableIPv6 false
    Hostname cli-srv-noisy-herschel
    Image.ID 0b123456-1b2b-12b3-b123-1bca0123d456
    Image.Name cli-backup-nervous-antonelli
    Image.Arch x86_64
    Image.CreationDate 5 minutes ago
    Image.ModificationDate 5 minutes ago
    Image.DefaultBootscript x86_64 mainline 4.4.230 rev1
    Image.ExtraVolumes 0
    Image.FromServer 027e84ab-12a8-4m07-993c-c3da1941f883
    Image.Organization 0c518794-9b2f-38g9-a910-9fdf0634b590
    Image.Public false
    Image.RootVolume ah456750-fdc1-4bde-b15e-7d3e1hhhgg74
    Image.State available
    Image.Project 0c514155-7n6s-41a2-a900-9fdf4532b365
    Image.Zone fr-par-2
    Protected false
    PublicIP.ID 48456zs3-7e85-4a94-bb79-cbccbf03kl0c
    PublicIP.Address 00.000.000.000
    PublicIP.Dynamic false
    ModificationDate now
    State archived
    Bootscript x86_64 mainline 4.4.230 rev1
    BootType local
    Volumes.0.ID 760982f8-c321-4cd2-b62c-bc31ef43fccm
    Volumes.0.Name cli-backup-nervous-antonelli_snap_0
    Volumes.0.ExportURI -
    Volumes.0.Organization 0c908137-9d5c-41a2-a900-9fdf0485b365
    Volumes.0.Server.ID 3921b1b6-8b88-4c75-7800-76e4d9f2c4d6
    Volumes.0.Server.Name cli-srv-noisy-herschel
    Volumes.0.Size 300 GB
    Volumes.0.VolumeType b_ssd
    Volumes.0.CreationDate now
    Volumes.0.ModificationDate now
    Volumes.0.State available
    Volumes.0.Project 0c769807-9a1e-42a1-o900-9fdf0591b365
    Volumes.0.Boot false
    Volumes.0.Zone fr-par-2
    SecurityGroup.ID 4917e509-be67-9c12-b42f-bead79081o00
    SecurityGroup.Name Default security group
    StateDetail -
    Arch x86_64
    Zone fr-par-2

Your PLAY2/PRO2 Instance is created and displays in the Scaleway console in the Instances dashboard.

Migrating from DEV1/GP1 to PLAY2/PRO2 via the CLI

You can also migrate your existing DEV1/GP1 Instances to PLAY2/PRO2 Instances using the Scaleway CLI.

Important:

It is required that you have downloaded and configured the Scaleway CLI on your computer to run the following commands.

  1. Create a GP1 Instance by running the following command:
    scw instance server create type=GP1-S zone=fr-par-2
  2. Make a backup of the GP1 Instance by using the snapshot feature with the unified snapshot type.
    scw instance server backup <server-id-gp1> zone=fr-par-2 unified=true
  3. Create the PRO2 Instance from the image created by the backup:
    scw instance server create image=<image-id-gp1> zone=fr-par-2 type=PRO2-S
  4. Power on the PRO2 Instance:
    scw instance server start <server-id-pro2> zone=fr-par-2