IBM Cloud Docs
Creating Bare Metal Servers on VPC

Creating Bare Metal Servers on VPC

Use the following information to create a bare metal server on your IBM Cloud® Virtual Private Cloud (VPC) with the configuration of your choice.

If you want to use an operating system image that is hosted on your own server or on a public server, review Network booting your own operating system with Bare Metal Servers on VPC before creating your bare metal server.

Creating a bare metal server by using the UI

Use the following steps to create a bare metal server by using the IBM Cloud® console. You can also check out the following video to learn more about creating a bare metal server.

  1. In the IBM Cloud console, go to Navigation Menu icon Menu icon > VPC Infrastructure VPC icon > Compute > Bare metal servers.

  2. Click Create and enter the information that is in Table 1.

  3. For Advanced options, you can choose to complete extra server configurations. For more information, see Table 2.

  4. Review the configuration Summary and click Create bare metal server.

Table 1. Bare metal server provisioning selections
Field Value
Location Locations are composed of regions (specific geographic areas) and zones (fault tolerant data centers within a region). Select the location where you want your bare metal server.
Name A name is required for your bare metal server.
Resource group Select a resource group for the server.
Tags You can assign labels to your server so that you can easily filter resources in your resource list.
Access management tags Access management tags help you apply flexible access policies on specific resources.
Image Click Change image to select an image. On the Select an image page, you can select from all available stock images and custom images. After you select your image, click Save. For more information, see x86-64 bare metal server images.
Profile Click Change profile to select from all available vCPU and RAM combinations. The profile families are Balanced, Compute, and Memory. For more information, see x86-64 bare metal server profiles.
SSH key

Select an existing public SSH key or click Create an SSH key to create a new one. For more information about creating an SSH key, see Creating your SSH key by using the UI. You must specify at least one SSH key.

  • For x86 architecture, the SSH key is used to automatically generate a password that is required for accessing VMware® ESXi Direct Console User Interface (DCUI) and the ESXi web client.

Note: SSH keys can either be RSA or Ed25519. You can generate new RSA key pairs using the UI. Pre-existing RSA and Ed25519 SSH keys can be uploaded. Ed25519 can be used only if the operating system supports this key type. Ed25519 can't be used with Windows or VMware images.

  • For s390x architecture, SSH keys are used to securely connect to the server after it's running. For more information, see Getting started with SSH keys.
Virtual private cloud Specify the VPC where you want to create your server. You can use the default VPC, another existing VPC, or you can create a new VPC.
Network interfaces By default the bare metal server is created with a single primary network interface. You can click the pencil icon to edit the details of the network interface. For example, the subnet or security group that's associated with the interface. To include extra secondary network interfaces, click New interface.

With the virtual network interface feature, you can select the type of network interface that you want to use. You can select the new option Network attachment with a virtual network interface or the older option Instance network interface. Whichever type of network interface option that you select when you provision, the bare metal server persists through the lifecycle of the bare metal server. You can click Attach to create a network attachment with an existing virtual network interface. For more information, see About virtual network interfaces.

Table 2. Bare metal server advanced options
Advanced option Value
User data Paste your user data to the User data (optional) field or click Import user data to upload from your user data. For example, you can enable SSH by adding the following script to the User data (optional) field. For more information about user data, see User data.
Trusted Platform Module (TPM) Click the toggle to enable Trusted Platform Module capabilities. Then, select the mode that you want to use. For more information, see Secure boot with Trusted Platform Module (TPM).
Secure boot Click the toggle to enable secure boot. For more information, see Secure boot with Trusted Platform Module (TPM).

For x86 architecture-based bare metal servers, the DHCP response for all interfaces (PCI or VLAN) includes a gateway. So, if you create multiple interfaces on different subnets, consider a static IP configuration or use separate network namespaces to handle the different gateways.

Creating a bare metal server by using the API

You can create a bare metal server by using the API. Use the following steps to create a bare metal server by using the API.

Before you begin

  1. Make sure that you set up your API environment. For more information, see Setting up your API and CLI environment.

    To learn more about the API, click Get sample API call on the create pages in IBM Cloud® console. You can view the correct sequence of API requests and better understand actions and their dependencies.

  2. Make sure that you create a VPC and a subnet before you create a bare metal server.

Gathering information for the bare metal server

Before you use the API to create bare metal server, see the following table for the required information.

Table 2. Information that you need to create a bare metal server by using the API
Server detail Listing options
Image List all images
Keys List all keys

If you don't have any available SSH keys, use Create a key to create one. For more information, see SSH keys.

Note: SSH keys can either be RSA or Ed25519. You can generate new RSA key pairs using the UI. Pre-existing RSA and Ed25519 SSH keys can be uploaded. Ed25519 can be used only if the operating system supports this key type. Ed25519 can't be used with Windows or VMware images.

Subnet List all subnets
Security groups (optional) List all security groups
Profile List all bare metal server profiles
Zone List all regions
List all zones in a region

Creating a bare metal server

After you have all the information, use the Create bare metal server API request to create a bare metal server.

  • For x86 architecture, you can create a bare metal server with the following example configuration:

    • ESXi image ID: "r006-31c8ca90-2623-48d7-8cf7-737be6fc4c3e"
    • SSH Key ID: "a6b1a881-2ce8-41a3-80fc-36316a73f803"
    • Name of the bare metal server: "my-bare-metal-server"
    • A primary network interface with the following configurations:
      • Allows VLAN with the ID of "4" to be attached
      • Name: "my-primary-network-interface"
      • Subnet ID: "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"
    • A secondary VLAN interface with ID "4". This VLAN interface is floatable.
    • Profile name: "bx2d-metal-192x768"
    • Zone: "us-south-1"

    The API request is similar to:

    curl -X POST "$vpc_api_endpoint/v1/bare_metal_servers?version=2021-03-09&generation=2" \
    -H "Authorization: $iam_token" \
    -d '{
        "initialization": {
            "image": {
            "id": "r006-31c8ca90-2623-48d7-8cf7-737be6fc4c3e"
            },
            "keys": [
            {"id": "a6b1a881-2ce8-41a3-80fc-36316a73f803"}
            ]
        },
        "primary_network_interface": {
            "interface_type": "pci",
            "name": "my-primary-network-interface",
            "subnet": {
            "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"
            },
            "allowed_vlans": [4]
        },
        "network_interfaces":[
           {
            "interface_type": "vlan",
            "name": "my-vlan-interface",
            "allow_interface_to_float": true,
            "subnet": {
            "id": "2302-6d5fe694-12f7-4161-b979-21bb4e872696"
             },
            "vlan": 4
           }
        ],
         "name": "my-bare-metal-server",
         "profile": {
             "name": "bx2d-metal-192x768"
         },
         "zone": {
             "name": "us-south-1"
         }
       }' | jq
    

    The example request uses the JSON processing utility jq to format the response. You can modify the command to use another parsing tool or remove " | jq" to receive an unformatted response.

    You see a response that is similar to the following example:

    "bandwidth": 100000,
    "boot_target": {
      "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/2302-5e095b83-ceb4-49b5-9699-0aa5a2c996a4/disks/2302-3744f199-6ccc-4698-8772-bb3937348c96",
      "id": "2302-3744f199-6ccc-4698-8772-bb3937348c96",
      "name": "zipfile-delude-slang-knoll",
      "resource_type": "bare_metal_server_disk"
    },
    "cpu": {
      "architecture": "amd64",
      "core_count": 96,
      "socket_count": 4,
      "threads_per_core": 2
    },
    "created_at": "2021-03-12T09:29:17.000Z",
    "crn": "crn:[...]",
    "disks": [
      {
       "created_at": "2021-03-12T09:29:17.000Z",
        "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/2302-5e095b83-ceb4-49b5-9699-0aa5a2c996a4/disks/2302-3744f199-6ccc-4698-8772-bb3937348c96",
        "id": "2302-3744f199-6ccc-4698-8772-bb3937348c96",
        "interface_type": "sata",
        "name": "zipfile-delude-slang-knoll",
        "resource_type": "bare_metal_server_disk",
        "size": 960
      },
      {
        "created_at": "2021-03-12T09:29:17.000Z",
        "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/2302-5e095b83-ceb4-49b5-9699-0aa5a2c996a4/disks/2302-86003aba-47db-4d07-bd76-62e00cca83e5",
        "id": "2302-86003aba-47db-4d07-bd76-62e00cca83e5",
        "interface_type": "nvme",
        "name": "elderly-mountain-trout-opponent",
        "resource_type": "bare_metal_server_disk",
        "size": 3200
      },
      {
        "created_at": "2021-03-12T09:29:17.000Z",
        "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/2302-5e095b83-ceb4-49b5-9699-0aa5a2c996a4/disks/2302-8372237f-77cb-47e4-9c61-b9d19ddfdbcd",
        "id": "2302-8372237f-77cb-47e4-9c61-b9d19ddfdbcd",
        "interface_type": "nvme",
        "name": "could-kilt-twisty-unloaded",
        "resource_type": "bare_metal_server_disk",
        "size": 3200
      },
      {
        "created_at": "2021-03-12T09:29:17.000Z",
        "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/2302-5e095b83-ceb4-49b5-9699-0aa5a2c996a4/disks/2302-e544d72d-ca08-4924-b748-a8f67b66286d",
        "id": "2302-e544d72d-ca08-4924-b748-a8f67b66286d",
        "interface_type": "nvme",
        "name": "wildcat-impromptu-dribble-hesitate",
        "resource_type": "bare_metal_server_disk",
        "size": 3200
      },
      {
        "created_at": "2021-03-12T09:29:17.000Z",
        "href": "us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/2302-5e095b83-ceb4-49b5-9699-0aa5a2c996a4/disks/2302-de34647b-e7fb-405b-85af-d28c6dfe142c",
        "id": "2302-de34647b-e7fb-405b-85af-d28c6dfe142c",
        "interface_type": "nvme",
        "name": "imperfect-stimulate-culpable-thumb",
        "resource_type": "bare_metal_server_disk",
        "size": 3200
      }
    ],
    "enable_secure_boot": false,
    "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/2302-5e095b83-ceb4-49b5-9699-0aa5a2c996a4",
    "id": "2302-5e095b83-ceb4-49b5-9699-0aa5a2c996a4",
    "memory": 768,
    "name": "my-bare-metal-server",
    "network_interfaces": [
      {
        "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/2302-5e095b83-ceb4-49b5-9699-0aa5a2c996a4/network_interfaces/2302-c094c123-5c82-49a2-8bb7-847bd3a7b62d",
        "id": "2302-c094c123-5c82-49a2-8bb7-847bd3a7b62d",
        "name": "my-primary-network-interface",
        "primary_ipv4_address": "10.240.128.5",
        "resource_type": "network_interface",
        "subnet": {
          "crn": "crn:[...]",
          "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/2302-6d5fe694-12f7-4161-b979-21bb4e872696",
          "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e",
          "name": "my-subnet"
        }
      },
      {
        "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/2302-5e095b83-ceb4-49b5-9699-0aa5a2c996a4/network_interfaces/2302-edd97be7-588e-4f0b-a875-7e0bec68f767",
        "id": "2302-edd97be7-588e-4f0b-a875-7e0bec68f767",
        "name": "my-vlan-interface",
        "primary_ipv4_address": "",
        "resource_type": "network_interface",
        "subnet": {
          "crn": "crn:[...]",
          "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/2302-6d5fe694-12f7-4161-b979-21bb4e872696",
          "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e",
          "name": "my-subnet"
        }
      }
    ],
    "primary_network_interface": {
      "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/2302-5e095b83-ceb4-49b5-9699-0aa5a2c996a4/network_interfaces/2302-c094c123-5c82-49a2-8bb7-847bd3a7b62d",
      "id": "2302-c094c123-5c82-49a2-8bb7-847bd3a7b62d",
      "name": "my-primary-network-interface",
      "primary_ipv4_address": "10.240.128.5",
      "resource_type": "network_interface",
      "subnet": {
        "crn": "crn:[...]",
        "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/2302-6d5fe694-12f7-4161-b979-21bb4e872696",
        "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e",
        "name": "my-subnet"
      }
    },
    "profile": {
      "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_server/profiles/bx2d-metal-192x768",
      "name": "bx2d-metal-192x768"
    },
    "resource_group": {
      "href": "https://us-south.iaas.cloud.ibm.com/v1/resource_groups/823edda102129f3232a0dc0655fcff94",
      "id": "823edda102129f3232a0dc0655fcff94",
      "name": "Default"
    },
    "resource_type": "bare_metal_server",
    "status": "pending",
    "status_reasons": [],
    "trusted_platform_module": {
      "enabled": false,
      "mode": ""
    },
    "vpc": {
      "crn": "crn:[...]",
      "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/r006-96cb322a-6a59-4ac4-8783-1f059f87e4a9",
      "id": "r006-96cb322a-6a59-4ac4-8783-1f059f87e4a9",
      "name": "my-vpc"
    },
    "zone": {
      "href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1",
      "name": "us-south-1"
    }
    }
    

The status displays "Pending" until the server is created.

For more information about the API request, see Create a bare metal server.

Viewing your server

When the server status changes to "Running", use the following request to view it.

curl -X GET "$vpc_api_endpoint/v1/bare_metal_servers/$bare_metal_server_id?version=2021-03-09&generation=2" \
-H "Authorization: $iam_token"

Creating a bare metal server by using the CLI

You can use the CLI to create a bare metal server. Use the following steps to create a bare metal server by using the IBM Cloud® CLI.

Before you begin

  1. Make sure that you set up your CLI environment.
  2. Make sure that you create a VPC and a subnet before you create a bare metal server.

For more information, see Using the CLI to create VPC resources.

Gathering information to create a bare metal server

Before you can use the CLI to create bare metal server, you need to gather the information that is needed.

Table 3. Information that you need to create a bare metal server by using the CLI
Server details Listing options
Image List all images
Keys List all keys

If you don't have any available SSH keys, use Create a key to create one.

Note: SSH keys can either be RSA or Ed25519. You can generate new RSA key pairs using the UI. Pre-existing RSA and Ed25519 SSH keys can be uploaded. Ed25519 can be used only if the operating system supports this key type. Ed25519 can't be used with Windows or VMware images.
For more information, see SSH keys.

Subnet List all subnets
Security groups (optional) List all security groups
Profile List all bare metal server profiles
Zone List all regions
List all zones in a region](/docs/vpc?topic=vpc-vpc-reference#zones)

Creating a bare metal server

After you have all the information ready, you can use the CLI to create a bare metal server.

For example, you can create a bare metal server with the following configuration:

  • For x86 architecture:

    • ESXi image ID: "r006-31c8ca90-2623-48d7-8cf7-737be6fc4c3e"

    • SSH Key ID: "a6b1a881-2ce8-41a3-80fc-36316a73f803"

    • Name of the bare metal server: "my-bare-metal-server"

    • A primary network interface with the following configurations:

      • VLAN with the ID of "4" to attach to the server
      • Name: "my-primary-network-interface"
      • Subnet ID: "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"
    • A secondary VLAN interface with ID "4". This VLAN interface is floatable.

    • Profile name: "bx2d-metal-192x768"

    • Zone: "us-south-1"

    ibmcloud is bare-metal-server-create --name my-bare-metal-server --zone us-south-1 --profile mx2-metal-96x768 --image r006-31c8ca90-2623-48d7-8cf7-737be6fc4c3e --keys a6b1a881-2ce8-41a3-80fc-36316a73f803 --pnic-subnet 7ec86020-1c6e-4889-b3f0-a15f2e50f87e –pnic-name my-primary-network-interface --pnic-allowed-vlans 4 --network-interfaces '[{"name": "my-vlan-interface", "interface_type": "vlan", "vlan": 4, "allow_interface_to_float": true, "subnet": {"id":"7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}]' --output JSON
    

Viewing your server

When the server status changes to Running, use the following command to view it.

ibmcloud is bare-metal-server $bare_metal_server_id --output JSON

Next steps

When the bare metal server status changes to Running, you can connect to it.