Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 46 additions & 15 deletions compute/instances/how-to/create-an-instance.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ content:
paragraph: This page explains how to create an Instance
tags: instance create
dates:
validation: 2024-06-10
validation: 2024-12-09
posted: 2021-05-26
categories:
- compute
Expand Down Expand Up @@ -81,10 +81,10 @@ Select a tab below for instructions on how to create an Instance via either our
- Booting from a volume that either lacks an OS or is among multiple volumes with identical operating systems can lead to inconsistent boot outcomes.
</Message>
<Message type="note">
To use **[Block Storage Low Latency](/storage/block/) 15k**, your Instance must have at least **3 GiB/s of block bandwidth**.
You can verify if an Instance type meets this requirement by consulting the [Scaleway Instances internet and Block Storage bandwidth overview](/compute/instances/reference-content/instances-bandwidth-overview/) documentation.
To use **[Block Storage Low Latency](/storage/block/) 15k**, your Instance must have at least **3 GiB/s of block bandwidth**.
You can verify if an Instance type meets this requirement by consulting the [Scaleway Instances internet and Block Storage bandwidth overview](/compute/instances/reference-content/instances-bandwidth-overview/) documentation.

Alternatively, use the [Instances API](https://www.scaleway.com/en/developers/api/instance/#path-instance-types-list-instance-types) to check the `block_bandwidth` field at `/instance/v1/zones/{zone}/products/servers`.
Alternatively, use the [Instances API](https://www.scaleway.com/en/developers/api/instance/#path-instance-types-list-instance-types) to check the `block_bandwidth` field at `/instance/v1/zones/{zone}/products/servers`.
This field provides detailed information about block bandwidth for each Instance type, helping you ensure compatibility with high-performance storage.
</Message>
- **Configure network** of the Instance.
Expand All @@ -109,7 +109,6 @@ Select a tab below for instructions on how to create an Instance via either our
- A Scaleway account logged into the [console](https://console.scaleway.com)
- [Owner](/identity-and-access-management/iam/concepts/#owner) status or [IAM permissions](/identity-and-access-management/iam/concepts/#permission) allowing you to perform actions in the intended Organization
- An [SSH key](/identity-and-access-management/organizations-and-projects/how-to/create-ssh-key/)
- An [SSH key](/identity-and-access-management/organizations-and-projects/how-to/create-ssh-key/)
- A valid [API key](/identity-and-access-management/iam/how-to/create-api-keys/)
- Installed [curl](https://curl.se/) on your local machine

Expand All @@ -128,15 +127,39 @@ Select a tab below for instructions on how to create an Instance via either our
export SCW_PROJECT_ID="<Project ID>"
export SCW_DEFAULT_ZONE="<Availability Zone>"
```
2. Get the label of your OS of choice.

```
curl --location "https://api.scaleway.com/marketplace/v2/images" \
--header "X-Auth-Token: $SCW_SECRET_KEY"

2. Customize the **payload** for your API call. This payload specifies the configuration of the Instance you want to create. We provide an example payload below with all the required parameters, and a table of information to help you adapt it to your needs.
{
"images": [
{
"id": "607b12c2-685d-45f7-905f-57bc23863834",
"name": "Ubuntu 24.04 Noble Numbat",
"label": "ubuntu_noble",
"description": "Ubuntu is the ideal distribution for scale-out computing, Ubuntu Server helps you make the most of your infrastructure.",
"logo": "https://scw-marketplace-logos.s3.fr-par.scw.cloud/ubuntu.png",
"categories": [
"distribution"
],
"valid_until": null,
"created_at": "2024-04-15T11:39:21.011004Z",
"updated_at": "2024-10-09T07:32:04.494117Z"
},
],
"total_count": 23
}
```
3. Customize the **payload** for your API call. This payload specifies the configuration of the Instance you want to create. We provide an example payload below with all the required parameters, and a table of information to help you adapt it to your needs.

```
{
"name": "my-new-instance",
"project": "'""$SCW_PROJECT_ID""'",
"commercial_type": "GP1-S",
"image": "544f0add-626b-4e4f-8a96-79fa4414d99a",
"image": "ubuntu_noble",
"enable_ipv6": true,
"volumes
"0": {
Expand All @@ -153,17 +176,17 @@ Select a tab below for instructions on how to create an Instance via either our
| name | A name of your choice for the Instance (string) | Any string containing only alphanumeric characters, dots, spaces and dashes, e.g. `"my-new-instance"`. |
| project | The Project in which the Instance should be created (string)| Any valid Scaleway Project ID (see above), e.g. `"b4bd99e0-b389-11ed-afa1-0242ac120002"` |
| commercial-type | The commercial Instance type to create (string) | Any valid ID of a Scaleway commercial Instance type, e.g. `"GP1-S"`, `"PRO2-M"`. Use the [List Instance Types](https://www.scaleway.com/en/developers/api/instance/#path-instance-types-list-instance-types) endpoint to get a list of all valid Instance types and their IDs. |
| image | The image to install on the Instance, e.g. a particular OS (string) | Any valid Scaleway image ID, e.g. `"544f0add-626b-4e4f-8a96-79fa4414d99a"` which is the ID for the `Ubuntu 22.04 Jammy Jellyfish` image. Use the [Marketplace API](https://www.scaleway.com/en/developers/api/marketplace/) endpoint to find available images and their IDs. |
| image | The image to install on the Instance, e.g. a particular OS (string) | Any valid Scaleway image label, e.g. `ubuntu_noble` which is the label for the Ubuntu 24.04 Noble Numbat image. |
| enable_ipv6 | Whether to enable IPv6 on the Instance (boolean) | `true` or `false` |
| volumes | An object that specifies the storage volumes to attach to the Instance. Must respect the volume constraints of the `commercial_type` (i.e. for each type of Instance, a minimum amount of storage is required, and there is also a maximum that cannot be exceeded. Some Instance types support only Block Storage (`b_ssd`), others also support Local Storage (`l_ssd`) ). These constraints are available at the [List Instance Types](https://www.scaleway.com/en/developers/api/instance/#path-instance-types-list-instance-types) endpoint, via the `volume_constraints` parameter for each type listed in the response | A (dictionary) object with a minimum of one key (`"0"`) whose value is another object containing the parameters `"name"` (a name for the volume), `"size"` (the size for the volume, in bytes), and `"volume_type"` (`"l_ssd"` or `"b_ssd"`). Additional keys for additional volumes should increment by 1 each time (the second volume would have a key of `1`.) Further parameters are available, and it is possible to attach existing volumes rather than creating a new one, or create a volume from a snapshot. For full details see [here](https://www.scaleway.com/en/developers/api/instance/#path-volumes). |

3. Use the following curl command, replacing the payload with the one you specified in step 2, to create your Instance.
4. Use the following curl command, replacing the payload with the one you specified in step 2, to create your Instance.

```
curl -X POST -H "Content-Type: application/json" \
-H "X-Auth-Token: $SCW_SECRET_KEY" \
"https://api.scaleway.com/instance/v1/zones/{$ZONE}/servers" \
-d '{"name": "my-new-instance", "project": "'"$PROJECT_ID"'", "commercial_type": "GP1-S", "image":"544f0add-626b-4e4f-8a96-79fa4414d99a","enable_ipv6": true, "volumes":{"0":{"name": "my-volume","size": 300000000000,"volume_type": "l_ssd"}}}'
-d '{"name": "my-new-instance", "project": "'"$PROJECT_ID"'", "commercial_type": "GP1-S", "image":"ubuntu_noble","enable_ipv6": true, "volumes":{"0":{"name": "my-volume","size": 300000000000,"volume_type": "l_ssd"}}}'
```

Valid Instance creation results in a `201` response containing a `server` object that confirms the attributes of your Instance.
Expand All @@ -190,15 +213,23 @@ Select a tab below for instructions on how to create an Instance via either our
- A valid [API key](/identity-and-access-management/iam/how-to/create-api-keys/)
- Installed and configured the [Scaleway CLI](https://github.com/scaleway/scaleway-cli) on your local machine

1. Get the label of your OS of choice.

```bash
scw marketplace image list

ID LABEL NAME CATEGORIES VALID UNTIL
607b12c2-685d-45f7-905f-57bc23863834 ubuntu_noble Ubuntu 24.04 Noble Numbat [distribution] -
```

1. Prepare your command by choosing values for the parameters below to define the Instance you want to create. Use the table to select appropriate values.
2. Prepare your command by choosing values for the parameters below to define the Instance you want to create. Use the table to select appropriate values.

```bash
name=my-new-instance
project-id=adcaffc9-38ef-4502-86e1-f70d3c353745
zone=fr-par-1
type=GP1-S
image=544f0add-626b-4e4f-8a96-79fa4414d99a
image=ubuntu_noble
ip=new
root-volume=l:300GB
```
Expand All @@ -209,14 +240,14 @@ Select a tab below for instructions on how to create an Instance via either our
| project-id | The Project in which the Instance should be created | Any valid Scaleway Project ID, e.g. `b4bd99e0-b389-11ed-afa1-0242ac120002` |
| zone | The Availability Zone in which the Instance should be created. Note that some Instance types are only available in certain Availability Zones (see **type`**below) | Any valid Scaleway Availability Zone, e.g. `fr-par-1`, `pl-waw-2` |
| type | The type of Instance to create | Any valid ID of a Scaleway Instance type, e.g. `GP1-S`, `PRO2-M`. Use the [server-type](https://github.com/scaleway/scaleway-cli/blob/master/docs/commands/instance.md#server-type-management-commands) command to get a list of all valid Instance types and their IDs. The default value is `DEV1-S` |
| image | The image to install on the Instance, e.g. a particular OS | Any valid Scaleway image ID or its label, e.g. `544f0add-626b-4e4f-8a96-79fa4414d99a` or`ubutunu_jammy` for the Ubuntu 22.04 Jammy Jellyfish image. The default value is `ubuntu_jammy`. Use the [marketplace](https://github.com/scaleway/scaleway-cli/blob/master/docs/commands/marketplace.md) command to get a list of all available images and their IDs. |
| image | The image to install on the Instance, e.g. a particular OS | Any valid Scaleway image label, e.g. `ubuntu_noble` which is the label for the Ubuntu 24.04 Noble Numbat image. |
| ip | The IP address to use for the Instance. | `new` to create a new IP, `dynamic` to create a dynamic IP address, `none` for no public IP address, or an existing IP ID. Default is `new` |
| root-volume | The root volume for the Instance (type e.g. `l` (local) or `b` (block) followed by a colon and its required size e.g. `10GB`) | Any valid volume type and size that is coherent with the storage constraints of the Instance **type** (available via `scw instance server-type list`) |

2. Open a terminal and run the command below, with the parameters modified according to your needs as defined in step one.
3. Open a terminal and run the command below, with the parameters modified according to your needs as defined in step one.

```bash
scw instance server create name=my-new-instance project-id=2ea18278-847c-4c33-8111-9c2376ed921e zone=fr-par-1 type=GP1-S image=544f0add-626b-4e4f-8a96-79fa4414d99a ip=new root-volume=l:300GB
scw instance server create name=my-new-instance project-id=2ea18278-847c-4c33-8111-9c2376ed921e zone=fr-par-1 type=GP1-S image=ubuntu_noble ip=new root-volume=l:300GB
```

Your Instance is created, and its details are returned to you in response.
Expand Down
Loading