Skip to navigationSkip to main contentSkip to footerScaleway Docs

Create and manage Elastic Metal servers with the Scaleway CLI

Scaleway's Elastic Metal servers provide you with dedicated servers on-demand, with all the benefits of the cloud, including flexibility and hourly billing. These servers are great for large workloads, big data, and applications that require increased security and dedicated resources. You can create and manage your Elastic Metal servers from the Scaleway console, via the API or the Scaleway Command Line Interface (CLI).

In this tutorial, you will learn how to use the CLI to create an Elastic Metal server, install an OS, and manage the server lifecycle.

Scaleway Command Line Interface overview

The Scaleway Command Line Interface (CLI) allows you to pilot your Scaleway infrastructure directly from your terminal, providing a faster way to administer and monitor your resources. Scaleway CLI is easy to set up and use, and an essential tool for operating efficiently in your cloud environment. The CLI provides many functionalities, including the ability to create and administer Elastic Metal servers.

Before you start

To complete the actions presented below, you must have:

Creating an Elastic Metal server

Important
  • The help info for the zone argument informs you that the default zone is fr-par-2 because Elastic Metal servers are only available in the fr-par-2 zone at the moment. However, fr-par-2 is not necessarily the default zone in your configuration. To create a server, you need to either change the default zone in your configuration file (check the location of this file in the output of scw init and change the value for default zone to fr-par-2), or explicitly target the fr-par-2 zone in the commands to create and manage your server.
  1. Type the following command in your terminal to create your Elastic Metal server:

    scw baremetal server create name=name-of-your-server type=EM-A210R-SATA zone=fr-par-2

    An output similar to the following displays:

    ID              12345678-1234-1234-1234-123456789123
    OrganizationID  12345678-1234-1234-1234-123456789123
    ProjectID       12345678-1234-1234-1234-123456789123
    Name            name-of-your-server
    Description     -
    UpdatedAt       36 seconds ago
    CreatedAt       36 seconds ago
    Status          delivering
    OfferID         12345678-1234-1234-1234-123456789123
    Domain          -
    BootType        normal
    Zone            fr-par-2
    PingStatus      unknown
    Tip
    • For more information on creating an Elastic Metal server, type scw baremetal server create --help in your terminal.
    • You can add additional arguments to your command, such as description to add a description of your Elastic Metal server, or tags.0 to add tags.
  2. Write down the ID of your server, as you will need it in the next steps.

    Tip
    • Type scw baremetal server list zone=fr-par-2 for a summary of information for your Elastic Metal server, and details for other servers you have previously created.
    • Use the command scw baremetal server get ID-of-your-server zone=fr-par-2 for information about a specific server.

Installing an OS

Note

You will need the SSH key ID associated with your account to install your chosen OS on your server.

  1. Type the following command in your terminal to see a list of available OSes:

    scw baremetal os list zone=fr-par-2

    An output with available OSes and their associated IDs displays:

    ID                                    NAME
      82ed3c56-935c-4012-b01f-69070fce1b1d  Ubuntu
      0aa99516-52bb-4a7d-b9fe-1adc8478c2e0  Debian
      58bf948f-8b9b-45c2-9ad6-582c26133f9e  Rocky Linux
      e8fc12e5-cfcd-434a-a8b0-d5f5141baf91  Ubuntu
      03b7f4ba-a6a1-4305-984e-b54fafbf1681  Ubuntu
      86fd5e3a-b023-4fa8-a3ae-1a194d8cd68c  CentOS
      f2aeab5d-6015-4b7c-b4ed-d76e89093621  Debian
      01d6eef6-6b96-47fd-b9f9-3857321abe4f  Ubuntu
  2. Write down the ID of the OS you want to install.

  3. Type the following command to display the list of your SSH key's ID:

    scw iam ssh-key list

    You will see an output similar to the following:

    ID                 NAME                    CREATED AT  UPDATED AT
    your-ssh-key-ID    name-of-your-ssh-key    1 week ago  1 week ago
  4. Write down your SSH key ID, as you will need it in the next steps.

  5. Type the following command to install an OS on your Elastic Metal server:

    scw baremetal server install ID-of-your-elastic-metal-server os-id=ID-of-OS-you-want-to-install hostname=hostname-for-your-server ssh-key-ids.0=your-ssh-key-ID zone=fr-par-2
    Note

    If you have multiple SSH keys, you can use the argument all-ssh-keys=true to install all your SSH keys on the server.

    An output similar to the following displays:

    ID                          ID-of-your-Elastic-Metal-Server
    OrganizationID              ID-of-your-organization
    ProjectID                   ID-of-your-project
    Name                        name-of-your-server
    Description                 -
    UpdatedAt                   8 minutes ago
    CreatedAt                   11 minutes ago
    Status                      ready
    OfferID                     ID-of-the-offer
    IPs.0.ID                    12345678-1234-1234-1234-123456789123
    IPs.0.Address               12.345.67.89
    IPs.0.Reverse               -
    IPs.0.Version               IPv4
    IPs.0.ReverseStatus         unknown
    IPs.0.ReverseStatusMessage  -
    IPs.1.ID                    12345678-1234-1234-1234-123456789123
    IPs.1.Address               1234:123:4567:8:9123:4567:8912:345
    IPs.1.Reverse               12345678-1234-1234-1234-123456789123.fr-par-2.baremetal.scw.cloud
    IPs.1.Version               IPv6
    IPs.1.ReverseStatus         active
    IPs.1.ReverseStatusMessage  -
    Domain                      12345678-1234-1234-1234-123456789123.fr-par-2.baremetal.scw.cloud
    BootType                    normal
    Zone                        fr-par-2
    Install.OsID                ID-of-your-OS
    Install.Hostname            hostname-for-your-server
    Install.SSHKeyIDs.0         your-ssh-key-ID
    Install.Status              to_install
    PingStatus                  up
Note

You can check the status of your server with the command scw baremetal server list zone=fr-par-2.

Using other CLI commands

There are many other functionalities you can access for your Elastic Metal server via the Scaleway CLI. In the following examples, replace your-elastic-metal-server-ID with your server's ID.

Note
  • Before powering off your server, we recommend you log into your server as root and execute the halt command to shut down the OS.
  • Type scw baremetal server get name-of-server-ID zone=fr-par-2 in your terminal if you are not sure what the IP address of your Elastic Metal server is. It will display in the IPs.0.Address field.

Powering on your server

Type the following command in your terminal:

scw baremetal server start your-elastic-metal-server-ID zone=fr-par-2

The following output displays, and you will see "starting" next to the Status field:

ID                          12345678-1234-1234-1234-123456789123
OrganizationID              12345678-1234-1234-1234-123456789123
ProjectID                   12345678-1234-1234-1234-123456789123
Name                        name-of-your-server
Description                 -
UpdatedAt                   3 seconds from now
CreatedAt                   3 hours ago
Status                      starting
OfferID                     12345678-1234-1234-1234-123456789123
IPs.0.ID                    12345678-1234-1234-1234-123456789123
IPs.0.Address               12.345.67.89
IPs.0.Reverse               -
IPs.0.Version               IPv4
IPs.0.ReverseStatus         unknown
IPs.0.ReverseStatusMessage  -
IPs.1.ID                    12345678-1234-1234-1234-123456789123
IPs.1.Address               IPs.1.Address
IPs.1.Reverse               IPs.1.Reverse
IPs.1.Version               IPv6
IPs.1.ReverseStatus         pending
IPs.1.ReverseStatusMessage  -
IPs.2.ID                    IPs.2.ID
IPs.2.Address               51.159.17.32
IPs.2.Reverse               IPs.2.Reverse
IPs.2.Version               IPv4
IPs.2.ReverseStatus         active
IPs.2.ReverseStatusMessage  -
Domain                      your-domain-name
BootType                    normal
Zone                        fr-par-2
Install.OsID                12345678-1234-1234-1234-123456789123
Install.Hostname            hostname-for-your-server
Install.SSHKeyIDs.0         12345678-1234-1234-1234-123456789123
Install.Status              completed
PingStatus                  up

Powering off your server

Important

Before powering off your Elastic Metal server, we recommend you log into your server as root and execute the halt command to shut down the OS.

Type the following command in your terminal:

scw baremetal server stop your-elastic-metal-server-ID zone=fr-par-2

The following output displays, and you will see "stopping" next to the Status field:

ID                          12345678-1234-1234-1234-123456789123
OrganizationID              12345678-1234-1234-1234-123456789123
ProjectID                   12345678-1234-1234-1234-123456789123
Name                        name-of-your-server
Description                 -
UpdatedAt                   3 seconds from now
CreatedAt                   3 hours ago
Status                      stopping
OfferID                     12345678-1234-1234-1234-123456789123
IPs.0.ID                    12345678-1234-1234-1234-123456789123
IPs.0.Address               12.345.67.89
IPs.0.Reverse               -
IPs.0.Version               IPv4
IPs.0.ReverseStatus         unknown
IPs.0.ReverseStatusMessage  -
IPs.1.ID                    12345678-1234-1234-1234-123456789123
IPs.1.Address               IPs.1.Address
IPs.1.Reverse               IPs.1.Reverse
IPs.1.Version               IPv6
IPs.1.ReverseStatus         pending
IPs.1.ReverseStatusMessage  -
IPs.2.ID                    IPs.2.ID
IPs.2.Address               51.159.17.32
IPs.2.Reverse               IPs.2.Reverse
IPs.2.Version               IPv4
IPs.2.ReverseStatus         active
IPs.2.ReverseStatusMessage  -
Domain                      your-domain-name
BootType                    normal
Zone                        fr-par-2
Install.OsID                12345678-1234-1234-1234-123456789123
Install.Hostname            hostname-for-your-server
Install.SSHKeyIDs.0         12345678-1234-1234-1234-123456789123
Install.Status              completed
PingStatus                  up

Rebooting your Server

Type the following command:

scw baremetal server reboot your-elastic-metal-server-ID zone=fr-par-2

The following output displays, and you will see "down" next to the PingStatus field:

ID                          12345678-1234-1234-1234-123456789123
OrganizationID              12345678-1234-1234-1234-123456789123
ProjectID                   12345678-1234-1234-1234-123456789123
Name                        name-of-your-server
Description                 -
UpdatedAt                   3 seconds from now
CreatedAt                   3 hours ago
Status                      stopping
OfferID                     12345678-1234-1234-1234-123456789123
IPs.0.ID                    12345678-1234-1234-1234-123456789123
IPs.0.Address               12.345.67.89
IPs.0.Reverse               -
IPs.0.Version               IPv4
IPs.0.ReverseStatus         unknown
IPs.0.ReverseStatusMessage  -
IPs.1.ID                    12345678-1234-1234-1234-123456789123
IPs.1.Address               IPs.1.Address
IPs.1.Reverse               IPs.1.Reverse
IPs.1.Version               IPv6
IPs.1.ReverseStatus         pending
IPs.1.ReverseStatusMessage  -
IPs.2.ID                    IPs.2.ID
IPs.2.Address               51.159.17.32
IPs.2.Reverse               IPs.2.Reverse
IPs.2.Version               IPv4
IPs.2.ReverseStatus         active
IPs.2.ReverseStatusMessage  -
Domain                      your-domain-name
BootType                    normal
Zone                        fr-par-2
Install.OsID                12345678-1234-1234-1234-123456789123
Install.Hostname            hostname-for-your-server
Install.SSHKeyIDs.0         12345678-1234-1234-1234-123456789123
Install.Status              completed
PingStatus                  down

Deleting your server

Important

This action is irreversible and will permanently delete your Elastic Metal server and your data.

Type the following command in your terminal:

scw baremetal server delete your-elastic-metal-server-ID zone=fr-par-2

An output like the following displays, and you will see "deleting" next to the Status field:

ID                          your-elastic-metal-server-ID
OrganizationID              your-organization-ID
ProjectID                   your-project-ID
Name                        name-of-your-server
Description                 -
UpdatedAt                   now
CreatedAt                   4 hours ago
Status                      deleting
OfferID                     your-offer-ID
Tags.0                      -
IPs.1.ID                    12345678-1234-1234-1234-123456789123
IPs.1.Address               1234:123:4567:8:9123:4567:8912:345
IPs.1.Reverse               12345678-1234-1234-1234-123456789123.fr-par-2.baremetal.scw.cloud
IPs.1.Version               IPv6
IPs.1.ReverseStatus         active
IPs.1.ReverseStatusMessage  -
Domain                      12345678-1234-1234-1234-123456789123.fr-par-2.baremetal.scw.cloud
BootType                    normal
Zone                        fr-par-2
Install.OsID                ID-of-your-OS
Install.Hostname            hostname-for-your-server
Install.SSHKeyIDs.0         your-ssh-key-ID
Install.Status              completed
PingStatus                  down

Enter the following command to make sure that your server has been deleted:

scw baremetal server list zone=fr-par-2

An output similar to the following displays:

12345678-1234-1234-1234-123456789123  name-of-your-server  EM-A210R-SATA    stopped
Still need help?

Create a support ticket
No Results