- The help info for the
zone
argument informs you that the default zone isfr-par-2
because Elastic Metal servers are only available in thefr-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 fordefault zone
tofr-par-2
), or explicitly target thefr-par-2
zone in the commands to create and manage your server. - The available server types are the following:
GP-BM1-L
GP-BM1-M
GP-BM1-S
HC-BM1-L
HC-BM1-S
HM-BM1-XL
HM-BM1-M
.
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:
- A Scaleway account logged into the console
- Owner status or IAM permissions allowing you to perform actions in the intended Organization
- An SSH key
- A valid API key
- Installed and configured the Scaleway CLI
Creating an Elastic Metal server
-
Type the following command in your terminal to create your Elastic Metal server:
scw baremetal server create name=name-of-your-server type=GP-BM1-L zone=fr-par-2An output similar to the following displays:
ID 12345678-1234-1234-1234-123456789123OrganizationID 12345678-1234-1234-1234-123456789123ProjectID 12345678-1234-1234-1234-123456789123Name name-of-your-serverDescription -UpdatedAt 36 seconds agoCreatedAt 36 seconds agoStatus deliveringOfferID 12345678-1234-1234-1234-123456789123Domain -BootType normalZone fr-par-2PingStatus unknownTip- 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, ortags.0
to add tags.
- For more information on creating an Elastic Metal server, type
-
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.
- Type
Installing an OS
You will need the SSH key ID associated with your account to install your chosen OS on your server.
-
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 NAME82ed3c56-935c-4012-b01f-69070fce1b1d Ubuntu0aa99516-52bb-4a7d-b9fe-1adc8478c2e0 Debian58bf948f-8b9b-45c2-9ad6-582c26133f9e Rocky Linuxe8fc12e5-cfcd-434a-a8b0-d5f5141baf91 Ubuntu03b7f4ba-a6a1-4305-984e-b54fafbf1681 Ubuntu86fd5e3a-b023-4fa8-a3ae-1a194d8cd68c CentOSf2aeab5d-6015-4b7c-b4ed-d76e89093621 Debian01d6eef6-6b96-47fd-b9f9-3857321abe4f Ubuntu -
Write down the ID of the OS you want to install.
-
Type the following command to display the list of your SSH key’s ID:
scw iam ssh-key listYou will see an output similar to the following:
ID NAME CREATED AT UPDATED ATyour-ssh-key-ID name-of-your-ssh-key 1 week ago 1 week ago -
Write down your SSH key ID, as you will need it in the next steps.
-
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-2NoteIf 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-ServerOrganizationID ID-of-your-organizationProjectID ID-of-your-projectName name-of-your-serverDescription -UpdatedAt 8 minutes agoCreatedAt 11 minutes agoStatus readyOfferID ID-of-the-offerIPs.0.ID 12345678-1234-1234-1234-123456789123IPs.0.Address 12.345.67.89IPs.0.Reverse -IPs.0.Version IPv4IPs.0.ReverseStatus unknownIPs.0.ReverseStatusMessage -IPs.1.ID 12345678-1234-1234-1234-123456789123IPs.1.Address 1234:123:4567:8:9123:4567:8912:345IPs.1.Reverse 12345678-1234-1234-1234-123456789123.fr-par-2.baremetal.scw.cloudIPs.1.Version IPv6IPs.1.ReverseStatus activeIPs.1.ReverseStatusMessage -Domain 12345678-1234-1234-1234-123456789123.fr-par-2.baremetal.scw.cloudBootType normalZone fr-par-2Install.OsID ID-of-your-OSInstall.Hostname hostname-for-your-serverInstall.SSHKeyIDs.0 your-ssh-key-IDInstall.Status to_installPingStatus up
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.
- 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 theIPs.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-123456789123OrganizationID 12345678-1234-1234-1234-123456789123ProjectID 12345678-1234-1234-1234-123456789123Name name-of-your-serverDescription -UpdatedAt 3 seconds from nowCreatedAt 3 hours agoStatus startingOfferID 12345678-1234-1234-1234-123456789123IPs.0.ID 12345678-1234-1234-1234-123456789123IPs.0.Address 12.345.67.89IPs.0.Reverse -IPs.0.Version IPv4IPs.0.ReverseStatus unknownIPs.0.ReverseStatusMessage -IPs.1.ID 12345678-1234-1234-1234-123456789123IPs.1.Address IPs.1.AddressIPs.1.Reverse IPs.1.ReverseIPs.1.Version IPv6IPs.1.ReverseStatus pendingIPs.1.ReverseStatusMessage -IPs.2.ID IPs.2.IDIPs.2.Address 51.159.17.32IPs.2.Reverse IPs.2.ReverseIPs.2.Version IPv4IPs.2.ReverseStatus activeIPs.2.ReverseStatusMessage -Domain your-domain-nameBootType normalZone fr-par-2Install.OsID 12345678-1234-1234-1234-123456789123Install.Hostname hostname-for-your-serverInstall.SSHKeyIDs.0 12345678-1234-1234-1234-123456789123Install.Status completedPingStatus up
Powering off your server
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-123456789123OrganizationID 12345678-1234-1234-1234-123456789123ProjectID 12345678-1234-1234-1234-123456789123Name name-of-your-serverDescription -UpdatedAt 3 seconds from nowCreatedAt 3 hours agoStatus stoppingOfferID 12345678-1234-1234-1234-123456789123IPs.0.ID 12345678-1234-1234-1234-123456789123IPs.0.Address 12.345.67.89IPs.0.Reverse -IPs.0.Version IPv4IPs.0.ReverseStatus unknownIPs.0.ReverseStatusMessage -IPs.1.ID 12345678-1234-1234-1234-123456789123IPs.1.Address IPs.1.AddressIPs.1.Reverse IPs.1.ReverseIPs.1.Version IPv6IPs.1.ReverseStatus pendingIPs.1.ReverseStatusMessage -IPs.2.ID IPs.2.IDIPs.2.Address 51.159.17.32IPs.2.Reverse IPs.2.ReverseIPs.2.Version IPv4IPs.2.ReverseStatus activeIPs.2.ReverseStatusMessage -Domain your-domain-nameBootType normalZone fr-par-2Install.OsID 12345678-1234-1234-1234-123456789123Install.Hostname hostname-for-your-serverInstall.SSHKeyIDs.0 12345678-1234-1234-1234-123456789123Install.Status completedPingStatus 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-123456789123OrganizationID 12345678-1234-1234-1234-123456789123ProjectID 12345678-1234-1234-1234-123456789123Name name-of-your-serverDescription -UpdatedAt 3 seconds from nowCreatedAt 3 hours agoStatus stoppingOfferID 12345678-1234-1234-1234-123456789123IPs.0.ID 12345678-1234-1234-1234-123456789123IPs.0.Address 12.345.67.89IPs.0.Reverse -IPs.0.Version IPv4IPs.0.ReverseStatus unknownIPs.0.ReverseStatusMessage -IPs.1.ID 12345678-1234-1234-1234-123456789123IPs.1.Address IPs.1.AddressIPs.1.Reverse IPs.1.ReverseIPs.1.Version IPv6IPs.1.ReverseStatus pendingIPs.1.ReverseStatusMessage -IPs.2.ID IPs.2.IDIPs.2.Address 51.159.17.32IPs.2.Reverse IPs.2.ReverseIPs.2.Version IPv4IPs.2.ReverseStatus activeIPs.2.ReverseStatusMessage -Domain your-domain-nameBootType normalZone fr-par-2Install.OsID 12345678-1234-1234-1234-123456789123Install.Hostname hostname-for-your-serverInstall.SSHKeyIDs.0 12345678-1234-1234-1234-123456789123Install.Status completedPingStatus down
Deleting your server
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-IDOrganizationID your-organization-IDProjectID your-project-IDName name-of-your-serverDescription -UpdatedAt nowCreatedAt 4 hours agoStatus deletingOfferID your-offer-IDTags.0 -IPs.1.ID 12345678-1234-1234-1234-123456789123IPs.1.Address 1234:123:4567:8:9123:4567:8912:345IPs.1.Reverse 12345678-1234-1234-1234-123456789123.fr-par-2.baremetal.scw.cloudIPs.1.Version IPv6IPs.1.ReverseStatus activeIPs.1.ReverseStatusMessage -Domain 12345678-1234-1234-1234-123456789123.fr-par-2.baremetal.scw.cloudBootType normalZone fr-par-2Install.OsID ID-of-your-OSInstall.Hostname hostname-for-your-serverInstall.SSHKeyIDs.0 your-ssh-key-IDInstall.Status completedPingStatus 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 GP-BM1-L stopped