How to migrate from one instance to another

Overwiew

The Scaleway platform makes it very easy to upscale your node to a more powerful one when your requirements grow. In this tutorial we will upgrade a DEV1-S instance to a GP1-XS instance using the backup feature.

Requirements

Migrating from the management console

Backing up the Instance

1 . Enter the instance information page by clicking on Instances followed by clicking on , then More Info next to the instance that shall be migrated:

Instances list

2 . On the instance information page, scroll down to the backup section. Click on Backup Instance:

Backup instance

Important: On virtual cloud instances, hot backups are available. BareMetal cloud instances must be archived before launching the backup process.

3 . Enter a name for the new backup of the instance and click on Backup instance:

Image name

Creating a new Instance from the Backup

1 . Click on the Backups & Images tab to view the list of backups.

2 . Click on , followed by clicking on Create instance from backup:

Create Instance

3 . Choose the desired region and instance type as well as optional values like tags to organize instances:

Create Instance

4 . Scroll down to Configure Advanced Options and untick the box Flexible IP. This creates the new instance without allocated flexible IP.

Create Instance

5 . Click on Create a new instance to launch the new server.

Moving the flexible IP to the new instance

1 . Click on the Flexible IPs tab.

2 . Click on next to the IP to detach. In the pop-up menu click on Detach to detach the IP.

Detach IP

3 . Once the IP has been detached, click on > Change Instance:

Change Instance

4 . Select the new instance in the drop down list and click on Attach this flexible IP

Attach IP

The new instance is now reachable via the previous instances flexible IP.

Migrating via the API

It is possible to automatize the migration process by using the API.

To migrate a server via the API, the instance ID, a valid API token and the users organization key are required.

1 . Start by making a backup of your instance. Replace <REGION> with the region of your server, either fr-par-1 for instances located in Paris, France or nl-ams-1 for instances located in Amsterdam, The Netherlands.

Request:

curl -H "X-Auth-Token: <API_TOKEN>" https://api.scaleway.com/instance/v1/zones/<REGION>/servers/<INSTANCE_ID>/action -d '{"action" : "backup"}' -H "Content-Type: application/json"

Return:

{
    "task": {
        "description": "server_backup",
        "href_from": "/servers/13d0c8d4-cc56-4f8b-b15c-ea25e8dbe989/action",
        "href_result": "/images/88996119-edb9-4283-8a6e-f9b98999bc19",
        "id": "b209f550-c8e1-4378-83e7-961dd834eb9c",
        "progress": 0,
        "started_at": "2019-05-14T13:14:01.573950+00:00",
        "status": "pending",
        "terminated_at": null
    }

The ID of the image is indicated in the line "href_result": "/images/88996119-edb9-4283-8a6e-f9b98999bc19" Take a note of the ID, as it will be required in the next step.

2 . Create the new instance based on the backup created previously. To do so, use the image ID from the "href_result".

Request:

curl https://api.scaleway.com/instance/v1/zones/<REGION>/servers \
-H "X-Auth-Token: <API_TOKEN>" \
-H "Content-Type: application/json" \
 -d '{ \
 "name": "<NEW_INSTANCE_NAME>",
 "image": "88996119-edb9-4283-8a6e-f9b98999bc19",
 "commercial_type": "GP1-S",
 "tags": ["migration"],
 "organization": "<ORGANIZATION_ID>"}'

Return:

{
    "server": {
        "allowed_actions": [
            "poweron",
            "backup"
        ],
        "arch": "x86_64",
        "boot_type": "local",
        "bootscript": {
            "architecture": "x86_64",
            "bootcmdargs": "LINUX_COMMON scaleway boot=local nbd.max_part=16",
            "default": false,
            "dtb": "",
            "id": "54ee2857-8ffb-4323-abba-964f55fea4a2",
            "initrd": "http://169.254.42.24/initrd/initrd-Linux-x86_64-v3.14.6.gz",
            "kernel": "http://169.254.42.24/kernel/x86_64-mainline-lts-4.9-4.9.93-rev1/vmlinuz-4.9.93",
            "organization": "11111111-1111-4111-8111-111111111111",
            "public": true,
            "title": "x86_64 mainline 4.9.93 rev1"
        },
        "commercial_type": "GP1-S",
        "compute_cluster": null,
        "creation_date": "2019-05-14T13:35:06.734740+00:00",
        "dynamic_ip_required": true,
        "enable_ipv6": false,
        "extra_networks": [],
        "hostname": "new-server",
        "id": "c7348333-bd5d-403f-ba54-9b4b398c8c8d",
        "image": {
            "arch": "x86_64",
            "creation_date": "2019-05-14T13:14:01.369030+00:00",
            "default_bootscript": {
                "architecture": "x86_64",
                "bootcmdargs": "LINUX_COMMON scaleway boot=local nbd.max_part=16",
                "default": false,
                "dtb": "",
                "id": "54ee2857-8ffb-4323-abba-964f55fea4a2",
                "initrd": "http://169.254.42.24/initrd/initrd-Linux-x86_64-v3.14.6.gz",
                "kernel": "http://169.254.42.24/kernel/x86_64-mainline-lts-4.9-4.9.93-rev1/vmlinuz-4.9.93",
                "organization": "11111111-1111-4111-8111-111111111111",
                "public": true,
                "title": "x86_64 mainline 4.9.93 rev1"
            },
            "extra_volumes": {},
            "from_server": "13d0c8d4-cc56-4f8b-b15c-ea25e8dbe989",
            "id": "88996119-edb9-4283-8a6e-f9b98999bc19",
            "modification_date": "2019-05-14T13:14:01.369030+00:00",
            "name": "image_testserver_2019-05-14_13-14",
            "organization": "11111111-1111-4111-8111-111111111111",
            "public": false,
            "root_volume": {
                "id": "b57c43a6-dcac-4b4e-b7c2-564a9fd5e29c",
                "name": "snapshot_testserver_0_2019-05-14_13-14",
                "size": 20000000000,
                "volume_type": "l_ssd"
            },
            "state": "available"
        },
        "ipv6": null,
        "location": null,
        "maintenances": [],
        "modification_date": "2019-05-14T13:35:07.608285+00:00",
        "name": "new_server",
        "organization": "11111111-1111-4111-8111-111111111111",
        "private_ip": null,
        "protected": false,
        "public_ip": null,
        "security_group": {
            "id": "13e12ca4-1dfc-4460-a141-2bf63045a1c5",
            "name": "Default security group"
        },
        "state": "stopped",
        "state_detail": "",
        "tags": [
            "migration"
        ],
        "volumes": {
            "0": {
                "creation_date": "2019-05-14T13:35:06.734740+00:00",
                "export_uri": null,
                "id": "304a5478-bea4-49d1-b382-757d3c04adb3",
                "modification_date": "2019-05-14T13:35:07.422687+00:00",
                "name": "snapshot_testserver_0_2019-05-14_13-14",
                "organization": "11111111-1111-4111-8111-111111111111",
                "server": {
                    "id": "c7348333-bd5d-403f-ba54-9b4b398c8c8d",
                    "name": "new_server"
                },
                "size": 300000000000,
                "state": "available",
                "volume_type": "l_ssd"
            }
        }
    }
}

3 . The new instance is available in the account now, but currently powered off. Power it up by launching an action on the instance:

Request:

curl -H "X-Auth-Token: <API_TOKEN>" https://api.scaleway.com/instance/v1/zones/<REGION>/servers/<SERVER_ID>/action \
 -d '{"action":"poweron"}' -H "Content-Type: application/json"

Response:

{
    "task": {
        "description": "server_batch_poweron",
        "href_from": "/servers/c7348333-bd5d-403f-ba54-9b4b398c8c8d/action",
        "href_result": "/servers/c7348333-bd5d-403f-ba54-9b4b398c8c8d",
        "id": "882af4d9-bca3-4005-880e-981fbcaa3343",
        "progress": 0,
        "started_at": "2019-05-14T14:05:12.154138+00:00",
        "status": "pending",
        "terminated_at": null
    }
}

4 . In a final step update the flexible IP of the instance so it will point to the new instance:

Request:

curl --header 'X-Auth-Token: <API_TOKEN>' --header 'Content-Type: application/json' --data '{"server" : "<SERVER_ID>"}' -X PATCH https://api.scaleway.com/instance/v1/zones/<REGION>/ips/<IP_ID>

Response:

{
    "ip": {
        "address": "51.15.74.234",
        "id": "3b0e7af9-3fe8-4cad-9919-0eaaa6966d8f",
        "organization": "11111111-1111-4111-8111-111111111111",
        "reverse": null,
        "server": {
            "id": "c7348333-bd5d-403f-ba54-9b4b398c8c8d",
            "name": "new_server"
        }
    }

The new instance will now be reachable on the usual IP address.

6 . (Optional) Delete the old instance in case it is no longer used:

Request:

curl --header 'X-Auth-Token: <API_TOKEN>' -X DELETE https://api.scaleway.com/instance/v1/zones/<REGION>/servers/<SERVER_ID>

Response:

Empty (204)

For more information on using the API, refer to the complete API documentation.

Discover a New Cloud Experience

Deploy SSD Cloud Servers in seconds.