Scaleway DocumentationComputeBare Metal CloudAPI/CLI
Managing Bare Metal servers with the API

Jump toUpdate content

Deploying a Bare Metal Cloud Server with one API call

Our Bare Metal Cloud Server offer provide 100% dedicated resources, combined with the advantages of the cloud, such as hourly billing and full flexibiliy. The servers’ hardware is 100% dedicated to you, there is no virtualization, no overallocation, no neighbours on your server. They come combined with a powerful REST-API, allowing you to automate tasks on your machines and deploy them automatically with tools like Terraform.

The new deployment in one command feature allows you to speed-up the delivery of your servers, as you don’t have to wait for it to be delivered and then launch the installation of the server - do both in a single API call and your server is up and running in less than 15 minutes.


Deploying Bare Metal Cloud Servers using the API

Besides creating your Bare Metal Cloud Servers from the graphical Scaleway Console, you can also create and manage them directly from the command line using the CLI-tool or the API.


You need to generate API keys to access the Scaleway API.

  1. Open a terminal on your computer and set your secret API Key, your SSH Key ID, and your Project ID as variables.

    $ SCW_KEY="<Your Secret Key>"$ SSH_KEY_ID="<Your SSH Key ID>"$ SCW_PROJECT="<Your Project ID"
  2. Retrieve a list of all Operating systems available in the desired Availability Zone. Currently all Bare Metal Cloud Servers are located in the AZ fr-par-2:

    $ curl -H "X-Auth-Token: $SCW_SECRET_KEY" | jq .

    A JSON formatted list with all offer characteristics displays. Take a note of the ID of the offer you want to deploy, as you need it in a later step.

    {"total_count": 9,"offers": [    {    "id": "3ab0dc29-2fd4-486e-88bf-d08fbf49214b",    "name": "HC-BM1-L",    "stock": "low",    "bandwidth": 1048576000,    "commercial_range": "high_cpu",    "disks": [        {        "capacity": 1099511627776,        "type": "NVMe"        },        {        "capacity": 1099511627776,        "type": "NVMe"        },        {        "capacity": 1099511627776,        "type": "NVMe"        },        {        "capacity": 1099511627776,        "type": "NVMe"        }    ],    "enable": true,    "cpus": [        {        "name": "Intel Xeon Gold 5120",        "core_count": 14,        "thread_count": 28,        "frequency": 2200        },        {        "name": "Intel Xeon Gold 5120",        "core_count": 14,        "thread_count": 28,        "frequency": 2200        }    ],    "memories": [        {        "capacity": 412316860416,        "type": "DDR4",        "frequency": 2133,        "is_ecc": true        }    ],    "quota_name": "bmaas_high_cpu",    "price_per_hour": {        "currency_code": "EUR",        "units": 1,        "nanos": 499900000    },    "price_per_month": {        "currency_code": "EUR",        "units": 749,        "nanos": 990000000    },    "persistent_memories": [],    "raid_controllers": []    },[...]]}
  3. Retrieve a list of all available Operating systems available in the desired Availability Zone (in our case fr-par-2).

    $ curl -H "X-Auth-Token: $SCW_SECRET_KEY" | jq .

    You will receive a JSON formatted list of all operating systems available, and their associated ID. Take a note of the ID of the image you want to install:

    {"total_count": 8,"os": [    {    "id": "03b7f4ba-a6a1-4305-984e-b54fafbf1681",    "name": "Ubuntu",    "version": "20.04"    },    {    "id": "60f5d1e3-fa69-45af-9fc0-c9e3c114dd09",    "name": "Ubuntu",    "version": "19.10"    },    [...]]}
  4. Create the Bare Metal Cloud Server from the API using cURL and the POST command on the endpoint /baremetal/v1/zones/fr-par-2/servers:

    The syntax to create the server is as follows:

    {"offer_id": "<OFFER_ID>","project_id": "$SCW_SECRET_KEY","name": "<SERVER_NAME>","description": "<SERVER_DESCRIPTION>","tags": [    "<SERVER_TAGS>"],"install": {    "os_id": "<OS_ID>",    "hostname": "<SERVER_HOSTNAME>",    "ssh_key_ids": [    "<SSH_KEY_ID>"    ]}}

    In the following example we create a GP-BM1-S server running on Ubuntu 20.04 LTS:

    curl -X POST -H "X-Auth-Token: $SCW_KEY" -H "Content-Type: application/json" -d "{ \"offer_id\": \"7fde3890-9787-488c-ac89-c4e00a4e5f83\", \"project_id\": \"$SCW_PROJECT\", \"name\": \"my-bmaas\", \"description\": \"my server running on ubuntu\", \"tags\": [    \"bmaas, tutorial\" ], \"install\": { \"os_id\": \"03b7f4ba-a6a1-4305-984e-b54fafbf1681\", \"hostname\": \"my-bmaas-api\", \"ssh_key_ids\": [ \"$SSH_KEY_ID\" ] }}"  | jq .

    Again the API returns a JSON output informing you about the server creation:

    {"id": "<SERVER_ID>","organization_id": "<ORGANIZATION_ID>","name": "my-bmaas","description": "my server running on ubuntu","updated_at": "2020-10-05T13:37:02.136789208Z","created_at": "2020-10-05T13:37:02.136789208Z","status": "delivering","offer_id": "7fde3890-9787-488c-ac89-c4e00a4e5f83","install": {    "os_id": "03b7f4ba-a6a1-4305-984e-b54fafbf1681",    "hostname": "my-bmaas-api",    "ssh_key_ids": [    "<SSH_KEY_ID>"    ],    "status": "to_install"},"tags": [    "bmaas, tutorial"],"ips": [],"domain": "","boot_type": "normal","ping_status": "ping_status_unknown","project_id": "<PROJECT_ID>","zone": "fr-par-2"}
  5. The server is being delivered to your account and is automatically being installed on the Operating System choosen. You can retieve the status of the installation using the following API call:

    $ curl{server_id} -H "X-Auth-Token: $SCW_SECRET_KEY" | jq .

    Your new Bare Metal Cloud Server will be installed and ready to be used in usually less than 15 minutes, all API features are listed in the API documentation.

For more information about Bare Metal Cloud Servers, refer to our dedicated product documentation and the FAQ.