Elastic Metal Private Network APIv2

Download OpenAPI

Introduction

VPC is a set of products and features allowing you to build your own virtual private cloud on top of Scaleway's shared public cloud. It includes Private Networks, which allow resources to be interconnected through a dedicated, private, and flexible L2 network.

You can add as many servers to your networks as you want, and add up to eight (8) different networks per server, taking the form of additional network interfaces inside your server (VLANs). This allows you to run services isolated from the public internet and expose them to the rest of your infrastructure without worrying about public network filtering. Servers can be plugged and unplugged from a network at will, even when the server is running: the network interface will be hot-plugged to the server, and software can be configured to automatically set it up as soon as it appears.

Technical limitations

  • need to configure manually a VLAN on the BMaaS interface
  • Bandwidth is limited to 1Gbps inside the private network
  • Up to 8 private networks per server
  • Broadcast and Multicast traffic, while supported, are rate-limited

You need to have an HTTP client such as curl to use Scaleway API. It is also a good idea to have jq which will help you to read and parse JSON output. Make sure you have these two tools before you begin. Otherwise use your package manager to install them.

To call Scaleway API, you need an X-Auth-Token. If you don't have one yet, refer to our doc about generating API keys.

Next, you will need your Project ID to create VPC resources in. If you don't have it, refer to our doc about creating a Project.

Finally, you will need to chose the Availability Zone in which to create your Private Networks. Keep in mind that Private Networks are per zone and not per region, thus you will only be able to connect servers to networks from the same Availability Zone.

export SECRET_KEY="<Secret key of your token>"
export PROJECT_ID="<Chosen Project ID>"
export ZONE="<Chosen zone (fr-par-1/nl-ams-1)>"
curl -s -H "Content-Type: application/json" -H "X-Auth-Token: $SECRET_KEY" \
https://api.scaleway.com/baremetal/v2/zones/$ZONE/servers/$SRV_ID/private-networks \
-d '{"private_network_id": "'$PN_ID'"}'

Keep the vlan field from the response. It is your VLAN ID, and will be used to configure the server to handle traffic from and to the private network:

sudo ip link add link eno1 name eno1.$VLAN type vlan id $VLAN
sudo ip link set eno1.$VLAN up
sudo ip addr add 192.168.0.10/24 dev eno1.$VLAN

A private network allows interconnecting your resources (servers, instances, ...) in an isolated and private network. The network reachability is limited to the resources that are on the same private network. A VLAN interface is available on the server and can be freely managed (adding IP addresses, shutdown interface...).

Note that a resource can be a part of multiple private networks.

List the private networks of a server

GET
/baremetal/v2/zones/{zone}/server-private-networks
Path Parameters

zone
required string
The zone you want to target. Possible value is fr-par-2.
Query Parameters

order_by
string
The sort order for the returned private networks. Possible values are created_at_asc, created_at_desc, updated_at_asc and updated_at_desc. The default value is created_at_asc.

page
number
The page number for the returned private networks. The default value is 1.

page_size
number
The maximum number of private networks per page. The default value is 20.

server_id
nullable string
Filter private networks by server ID (UUID format).

private_network_id
nullable string
Filter private networks by private network ID (UUID format).

organization_id
nullable string
Filter private networks by organization ID (UUID format).

project_id
nullable string
Filter private networks by project ID (UUID format).
200 Response

server_private_networks
array
id
string
The private network ID.

project_id
string
The private network project ID.

server_id
string
The server ID.

private_network_id
string
The private network ID.

vlan
nullable number
The VLAN ID associated to the private network.

status
string
The configuration status of the private network. Possible values are unknown, attaching, attached, error, detaching and locked. The default value is unknown.

created_at
string
The private network creation date.

updated_at
string
The date the private network was last modified.

total_count
number
Response Example
{
"server_private_networks": [
{
"id": "string",
"project_id": "string",
"server_id": "string",
"private_network_id": "string",
"vlan": 42,
"status": "unknown",
"created_at": "string",
"updated_at": "string"
}
],
"total_count": 42
}
POST
/baremetal/v2/zones/{zone}/servers/{server_id}/private-networks
Path Parameters

zone
required string
The zone you want to target. Possible value is fr-par-2.

server_id
required string
The ID of the server.
Body

private_network_id
required string
The ID of the private network.
Request Example
{
"private_network_id": "string"
}
200 Response

id
string
The private network ID.

project_id
string
The private network project ID.

server_id
string
The server ID.

private_network_id
string
The private network ID.

vlan
nullable number
The VLAN ID associated to the private network.

status
string
The configuration status of the private network. Possible values are unknown, attaching, attached, error, detaching and locked. The default value is unknown.

created_at
string
The private network creation date.

updated_at
string
The date the private network was last modified.
Response Example
{
"id": "string",
"project_id": "string",
"server_id": "string",
"private_network_id": "string",
"vlan": 42,
"status": "unknown",
"created_at": "string",
"updated_at": "string"
}
PUT
/baremetal/v2/zones/{zone}/servers/{server_id}/private-networks
Path Parameters

zone
required string
The zone you want to target. Possible value is fr-par-2.

server_id
required string
The ID of the server.
Body

private_network_ids
required array
The IDs of the private networks.
Request Example
{
"private_network_ids": [
"string"
]
}
200 Response

server_private_networks
array
id
string
The private network ID.

project_id
string
The private network project ID.

server_id
string
The server ID.

private_network_id
string
The private network ID.

vlan
nullable number
The VLAN ID associated to the private network.

status
string
The configuration status of the private network. Possible values are unknown, attaching, attached, error, detaching and locked. The default value is unknown.

created_at
string
The private network creation date.

updated_at
string
The date the private network was last modified.
Response Example
{
"server_private_networks": [
{
"id": "string",
"project_id": "string",
"server_id": "string",
"private_network_id": "string",
"vlan": 42,
"status": "unknown",
"created_at": "string",
"updated_at": "string"
}
]
}
DELETE
/baremetal/v2/zones/{zone}/servers/{server_id}/private-networks/{private_network_id}
Path Parameters

zone
required string
The zone you want to target. Possible value is fr-par-2.

server_id
required string
The ID of the server.

private_network_id
required string
The ID of the private network.
204 Response

Empty response