Scaleway logo
Instance API

Instance API

Scaleway Instances are virtual machines in the cloud. Different Instance typesOpen in new context offer different technical specifications in terms of vCPU, RAM, bandwidth, and storage. Once you have created your Instance and installed your image of choice (e.g. an operating system), you can connect to your Instance via SSHOpen in new context to use it as you wish. When you are done using the Instance, you can delete it from your account.

Tip

To retrieve information about the different images available to install on Scaleway Instances, check out our Marketplace APIOpen in new context.

Concepts

Refer to our dedicated concepts pageOpen in new context to find definitions of all concepts and terminology related to Instances.

Requirement

Quickstart

  1. Configure your environment variables:

    Note

    This is an optional step that seeks to simplify your usage of the Instances API. See Availability Zones below for help choosing an Availability Zone. You can find your Project ID in the Scaleway consoleOpen in new context.

    TerminalCode
    export SCW_SECRET_KEY="<API secret key>" export SCW_DEFAULT_ZONE="<Scaleway Availability Zone>" export SCW_PROJECT_ID="<Scaleway Project ID>"
  2. Create an Instance: Run the following command to create an Instance. You can customize the details in the payload (name, description, type, tags etc) to your needs: use the information below to adjust the payload as necessary.

    TerminalCode
    curl -X POST \ -H "X-Auth-Token: $SCW_SECRET_KEY" \ -H "Content-Type: application/json" \ "https://api.scaleway.com/instance/v2alpha1/zones/$SCW_DEFAULT_ZONE/servers" \ -d '{ "name": "my-new-instance", "project_id": "'"$SCW_PROJECT_ID"'", "server_type": "GP1-S", "public_network_interface": { "ips": [ { "new_ip": { "type": "zonal_ipv4" } }, { "ipam_ip_id": "<IP-ID>" } ] }, "volumes": [ { "volume_type": "l_ssd", "new_volume": { "name": "my-new-volume", "image_label": "ubuntu_noble" } }, { "volume_type": "sbs", "volume_id": "<Volume-ID>" } ] }'
ParameterDescriptionValid values
nameA name of your choice for the Instance (string).Any string containing only alphanumeric characters, dots, spaces, and hyphens, e.g. "my-new-instance".
project_idThe Project in which to create the Instance (string).Any valid Scaleway Project ID (see above), e.g. "b4bd99e0-b389-11ed-afa1-0242ac120002".
server_typeThe 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 endpoint to get a list of all valid Instance types and their IDs.
public_network_interfaceThe IPs to attach to the Instance (list).A list where each item is a dictionary containing either "ipam_ip_id", with the IP ID as its value, or "new_ip", containing "type" ("zonal_ipv4" or "zonal_ipv6").
volumesThe storage volumes to attach to the Instance (list).A list where each item is a dictionary containing the "volume_type" key ("l_ssd", "sbs", or "scratch") and either the "volume_id" or the "new_volume" key. Use "volume_id" to attach an existing volume, with the volume ID as its value. Use "new_volume" to create a volume from a Scaleway image ("image_label") or a snapshot ("base_snapshot_id").
  1. List your Instances: Run the following command to get a list of all the Instances in your account, with their details:

    TerminalCode
    curl -X GET \ -H "Content-Type: application/json" \ -H "X-Auth-Token: $SCW_SECRET_KEY" \ "https://api.scaleway.com/instance/v2alpha1/zones/$SCW_DEFAULT_ZONE/servers/"
  2. Delete an Instance: Run the following command to delete an Instance, specified by its Instance ID:

    TerminalCode
    curl -X DELETE \ -H "X-Auth-Token: $SCW_SECRET_KEY" \ -H "Content-Type: application/json" \ "https://api.scaleway.com/instance/v2alpha1/zones/$SCW_DEFAULT_ZONE/servers/<Instance-ID>"

    The expected successful response is empty.

Technical information

Availability Zones

You can deploy Instances in the following Availability Zones:

NameAPI ID
Parisfr-par-1 fr-par-2 fr-par-3
Amsterdamnl-ams-1 nl-ams-2 nl-ams-3
Warsawpl-waw-1 pl-waw-2 pl-waw-3
Milanit-mil-1

Pagination

The listing requests receive a paginated response. They accept two query arguments:

  • page_token, a string representing the wanted page. If it's not provided the first page will be returned.
  • page_size, a positive integer lower or equal to 100 to select the number of items to return per page. The default value is 100.

Paginated endpoints usually also accept filters to search and sort results. These filters are documented along each endpoint documentation.

The listing response contain the next_page_token, the token to retrieve the next page.

Going further

For more help using Scaleway Instances, check out the following resources:

Tags
Resource Counts
Provides a summary of your current resource usage within a project or organization. The response includes counts for various Instance-related resources such as numbers of Instances, GPU Instances, Security groups, Placement groups, Snapshots, Volumes, and Private Network interfaces.
Instances
Instances are computing units providing resources to run your applications on. Scaleway offers various Instance types including CPU Instances and GPU Instances. Note: Instances can be referenced as "servers" in API endpoints.
Instance Types
All Instance types available in a specified zone. Each type contains all the features of the Instance (CPU, RAM, storage).
Private Network Interfaces
A Private Network Interface is the network interface that connects an Instance to a Private Network. An Instance can have multiple private network interfaces at the same time, but each private network interface must belong to a different Private Network.
Placement Groups
Placement groups allow the user to express a preference regarding the physical position of a group of Instances. The feature lets the user choose to either group Instances on the same physical hardware for best network throughput and low latency, or spread Instances across physically distanced hardware to reduce the risk of physical failure. The operating mode is selected by a policy_type. Two policy types are available:
  • low_latency will group Instances on the same hypervisors
  • max_availability will spread Instances across physically distanced hypervisors
The policy_type is set to max_availability by default.
Security Groups
A security group is a set of firewall rules on a set of Instances. Security groups enable you to create rules that either drop or allow incoming traffic from certain ports of your Instances. Security groups are stateful by default, which means that return traffic is automatically allowed, regardless of any rules. You can switch to a stateless mode if you want to only allow explicitly defined traffic. That mode may be difficult to use when filtering outgoing flows.
User Data
User data is a key/value store you can use to provide your Instance with introspective data. There are two ways of accessing user data:
  • From within a running Instance, by requesting the Metadata API at http://169.254.42.42/user_data (or http://[fd00:42::42]/user_data using IPv6). The scaleway-ecosystem package, installed by default on all OS images provided by Scaleway, ships with the scw-userdata helper command that allows you to easily query the user data from the Instance. For security reasons, viewing and editing user data is only allowed to queries originating from a port below 1024 (by default, only the super-user can bind to ports below 1024). To specify the source port with cURL, use the --local-port option (e.g. curl --local-port 1-1023 http://169.254.42.42/user_data).
  • From the Instance API by using the methods described below.
Templates
Templates are blueprints for creating Instances with predefined configurations. A template includes specifications such as Instance type, attached volumes, security groups, placement groups, private networks, and public IP settings. Using templates allows you to standardize and automate Instance deployment across your infrastructure.