Skip to content

Commit

Permalink
feat(ins): update image create feature
Browse files Browse the repository at this point in the history
  • Loading branch information
bene2k1 committed Nov 15, 2024
1 parent ba7a83d commit 25ce548
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 18 deletions.
54 changes: 53 additions & 1 deletion compute/instances/how-to/create-image-from-snapshot.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@ categories:
- An [Instance](/compute/instances/how-to/create-an-instance/)
- At least one [snapshot](/compute/instances/how-to/create-a-snapshot/)

## Creating an image from a snapshot via the Scaleway console

1. Click **Instances** in the **Compute** section of the side menu. The [Instances page](https://console.scaleway.com/instance/servers) displays.
2. Click the **Images** tab. A list of your images displays.
3. Hover over the <Icon name="plus"/> button to **Create image**. The overview page displays.
3. Hover over the <Icon name="plus" /> button to **Create image**. The overview page displays.
4. Choose the **Availability Zone** in which you want your image to be created.
5. Enter a **name** for your image.
<Message type="note">
Expand All @@ -35,3 +36,54 @@ categories:
<Message type="tip">
You can also create an image from the **Snapshots** dashboard by clicking <Icon name="more"/> next to the snapshot from which you want to create an image. Click **Image from snapshot**. A new tab opens: enter a name for your image. Then click **Create image from snapshot**.
</Message>

## Creating an image via the Scaleway CLI

You can also create an image using the [Scaleway CLI](/developer-tools/scaleway-cli/quickstart/). Use the following command:

```bash
scw instance image create snapshot-id="$SCW_VOLUME_ID_1" additional-volumes.0.id="$SCW_VOLUME_ID_2" arch="x86_64"
```

- Replace `$SCW_VOLUME_ID_1` with the ID of the snapshot or volume you want to use as the root volume.
- Replace `$SCW_VOLUME_ID_2` with the ID of any additional volume to be included.
- Ensure the architecture (`arch`) is set to a valid value (e.g., `x86_64`).

<Message type="note">
Supported volume IDs include:
- Local SSD (`l_ssd`)
- Block SSD (`b_ssd`)
- Block Storage Low Latency (`sbs`) volumes.
</Message>

## Creating an image via the Scaleway API

You can also create an image using the [Scaleway API](https://www.scaleway.com/en/developers/api/instance/#path-images-create-an-instance-image). Use the following `curl` command:

```bash
curl --location "https://api.scaleway.com/instance/v1/zones/$SCW_AVAILABILITY_ZONE/images" \
--header "Content-Type: application/json" \
--header "X-Auth-Token: $SCW_SECRET_KEY" \
--data '{
"root_volume": "'$SCW_VOLUME_ID_1'",
"arch": "x86_64",
"name": "image_name",
"extra_volumes": {
"1": {"id":"'$SCW_VOLUME_ID_2'"}
},
"organization": "'$SCW_ORG_ID'"
}'
```

- Replace `$SCW_VOLUME_ID_1` with the ID of the snapshot or volume to use as the root volume.
- Replace `$SCW_VOLUME_ID_2` with the ID of any additional volume.
- Use `$SCW_ORG_ID` for the ID of your organization.
- Ensure the architecture (`arch`) is set to a valid value (e.g., `x86_64`).

<Message type="tip">
Supported volume IDs include:
- Local SSD (`l_ssd`)
- Block SSD (`b_ssd`)
- Block Storage Low Latency (`sbs`) volumes.
</Message>

40 changes: 23 additions & 17 deletions compute/instances/how-to/migrate-volumes-snapshots-to-sbs.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,15 @@ categories:
- compute
---

Scaleway is transitioning the management of Block Storage volumes and snapshots from Compute teams to Storage teams to enhance performance and reliability.
The characteristics of your migrated volumes and snapshots will remain unchanged, it is seamless even for a volume attached to a running instance, these resources will be managed from Compute to [Storage](https://www.scaleway.com/en/docs/storage/block/quickstart/).
The unified snapshot migration will result in a snapshot in Block Storage and the deletion of the unified snapshot in Compute. If the unified snapshot is part of an image, it's replaced by the snapshot of Block Storage.
This guide provides the steps needed to migrate your volumes and snapshots using either the [Scaleway Command Line Interface (CLI)](/developer-tools/scaleway-cli/quickstart/) tool (recommended) or via the [Instances API](https://www.scaleway.com/en/developers/api/instance/#path-volumes-migrate-a-volume-andor-snapshots-to-sbs-scaleway-block-storage).
To enhance performance and reliability, Scaleway is transitioning the management of Block Storage volumes and snapshots from Compute to Storage.

The migration process ensures that the characteristics of your volumes and snapshots remain unchanged, even for volumes attached to running Instances.

After migration, these resources will be managed under [Storage](https://www.scaleway.com/en/docs/storage/block/quickstart/) instead of Compute.

During migration, unified snapshots will be converted into Block Storage snapshots and removed from Compute. If a unified snapshot is part of an image, it will be replaced by the corresponding Block Storage snapshot.

This guide offers step-by-step instructions to migrate your volumes and snapshots using either the [Scaleway Command Line Interface (CLI)](/developer-tools/scaleway-cli/quickstart/) tool (recommended) or the [Instances API](https://www.scaleway.com/en/developers/api/instance/#path-volumes-migrate-a-volume-andor-snapshots-to-sbs-scaleway-block-storage).

<Message type="tip">
The easiest way to migrate your Block Storage volumes and snapshots is by using the [Scaleway Command Line Interface (CLI)](/developer-tools/scaleway-cli/quickstart/) tool.
Expand All @@ -36,15 +41,15 @@ This guide provides the steps needed to migrate your volumes and snapshots using
<Tabs>
<TabsTab label="CLI">
<Message type="note">
When you migrate a volume, the volume and any snapshots created from the volume will be migrated.
When you migrate a volume, the volume and any snapshots created from it will be migrated as well.
</Message>
1. Retrieve the ID of your Block Storage volume using the `scw instance volume list` command. This command returns a list of your volumes, as shown below:
1. Use the following command to list your Block Storage volumes and retrieve the ID of the volume you wish to migrate:
```
$ scw instance volume list
ID STATE SERVER ID SERVER NAME
369feb53-165f-437d-875e-188725df462b available
```
2. Plan the volume migration with the `scw instance volume plan-migration <VOLUME_ID>` command. It returns the volume and its snapshots that will be migrated. It also returns an unique `ValidationKey`, which is needed to start the migration.
2. Plan the volume migration using the `scw instance volume plan-migration <VOLUME_ID>` command. This command returns the volume and its snapshots that will be migrated, along with a unique `ValidationKey` required to start the migration.
```
$ scw instance volume plan-migration 369feb53-165f-437d-875e-188725df462b
Volume.ID 369feb53-165f-437d-875e-188725df462b
Expand Down Expand Up @@ -87,14 +92,13 @@ This guide provides the steps needed to migrate your volumes and snapshots using
✅ Success
```
The volume migration is complete. You can now manage the migrated volume from the [Block Storage Volumes section](https://console.scaleway.com/block-storage/volumes) in the Scaleway console.

</TabsTab>
<TabsTab label="API">
<Message type="note">
When you migrate a volume using the API, the volume and any snapshots created from the volume will be migrated.
</Message>

1. Plan the migration by using the following `curl` command:
1. Plan the migration by sending a `POST` request to the Scaleway API:

```bash
curl --location "https://api.scaleway.com/instance/v1/zones/$SCW_AVAILABILITY_ZONE/block-migration/plan" \
Expand All @@ -105,9 +109,9 @@ This guide provides the steps needed to migrate your volumes and snapshots using
}"
```

It returns the volume and its snapshots that will be migrated. It also returns an unique `ValidationKey`, which is needed to start the migration.
This request returns the volume and its snapshots that will be migrated, along with a unique `ValidationKey` required to start the migration.

2. Confirm the migration by using the following `curl` command:
2. Confirm and execute the migration by sending another `POST` request:

```bash
curl --location "https://api.scaleway.com/instance/v1/zones/$SCW_AVAILABILITY_ZONE/block-migration/apply" \
Expand All @@ -132,13 +136,13 @@ This guide provides the steps needed to migrate your volumes and snapshots using
<Message type="note">
When you migrate a snapshot, the source volume of the snapshot and any snapshots created from this volume will also be migrated.
</Message>
1. Retrieve the ID of your snapshot using the `scw instance snapshot list` command. This command provides an output similar to the following:
1. Use the following command to list your snapshots and retrieve the ID of the snapshot you wish to migrate:
```
$ scw instance snapshot list
ID NAME
a377afe5-a9a3-4706-b8c2-8d1c247a620f snap-eloquent-edison
```
2. Plan the migration with the `scw instance snapshot plan-migration <SNAPSHOT_ID>` command. It returns the source volume of the snapshot and the volume snapshots that will be migrated. It also returns an unique `ValidationKey`, which is needed to start the migration.
2. Plan the snapshot migration using the `scw instance snapshot plan-migration <SNAPSHOT_ID>` command. This command returns the source volume of the snapshot and any related snapshots that will be migrated, along with a unique `ValidationKey`.
```
$ scw instance snapshot plan-migration a377afe5-a9a3-4706-b8c2-8d1c247a620f
Volume.ID 369feb53-165f-437d-875e-188725df462b
Expand Down Expand Up @@ -187,7 +191,7 @@ This guide provides the steps needed to migrate your volumes and snapshots using
When you migrate a snapshot using the API, the source volume of the snapshot and any snapshots created from this volume will also be migrated.
</Message>

1. Plan the migration by using the following `curl` command:
1. Plan the migration by sending a `POST` request to the Scaleway API:

```bash
curl --location "https://api.scaleway.com/instance/v1/zones/$SCW_AVAILABILITY_ZONE/block-migration/plan" \
Expand All @@ -198,9 +202,9 @@ This guide provides the steps needed to migrate your volumes and snapshots using
}"
```

It returns the source volume of the snapshot and the volume snapshots that will be migrated. It also returns an unique `ValidationKey`, which is needed to start the migration.
This request returns the source volume and any related snapshots that will be migrated, along with a unique `ValidationKey`.

2. Confirm the migration using the following `curl` command:
2. Confirm and execute the migration by sending another `POST` request:

```bash
curl --location "https://api.scaleway.com/instance/v1/zones/$SCW_AVAILABILITY_ZONE/block-migration/apply" \
Expand All @@ -216,4 +220,6 @@ This guide provides the steps needed to migrate your volumes and snapshots using

## Going further

To learn more about managing your migrated Block Storage volumes from the Scaleway console, refer to the [Block Storage - Console documentation](/storage/block/quickstart/). Additionally, you can manage your Block Storage volumes using the [Scaleway Block Storage API](https://www.scaleway.com/en/developers/api/block/).
To learn more about managing your migrated Block Storage volumes and snapshots from the Scaleway console, refer to the [Block Storage Quickstart Guide](/storage/block/quickstart/). Additionally, you can explore advanced features using the [Scaleway Block Storage API](https://www.scaleway.com/en/developers/api/block/).

If you encounter any issues during migration, contact [Scaleway's support team](https://console.scaleway.com/support/tickets) for assistance.

0 comments on commit 25ce548

Please sign in to comment.