Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Situation Awareness
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive
Help Center/ Bare Metal Server/ API Reference/ Examples/ Example 1: Creating a BMS

Example 1: Creating a BMS

Updated on 2024-10-22 GMT+08:00

Scenarios

BMSs are recommended for key applications and services that require high performance (such as Big Data clusters and enterprise middleware systems) and a secure and reliable running environment.

This section describes how to create a BMS using the Creating BMSs API. For details about how to call the API, see Calling APIs.

NOTE:

Currently, only yearly/monthly BMSs can be created.

Prerequisites

  • You have planned the region where you want to create the BMS and obtained the endpoint required for API calls. For details, see Endpoints.
  • A BMS can boot from a local disk or an EVS disk. Quickly provisioned BMSs boot from an EVS disk. You can use either of the following methods to check the boot device:
    • After selecting a flavor on the BMS console, if System Disk is displayed in the Disk option, a BMS of this flavor boots from an EVS disk. Otherwise, the BMS boots from a local disk.
    • Call the Querying Flavor Details and Extended Flavor Information API and check the value of baremetal:extBootType in the response. If the value is LocalDisk, the BMS is booted from a local disk. If the value is Volume, the BMS is booted from an EVS disk.

Create a BMS with Local Disks

The following example uses the most basic configuration required for creating a BMS with local disks.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
{
    "server": {
        "availability_zone": "cn-north-4a",
        "name": "bms-test01",
        "imageRef": "766a545a-02e1-433e-b1d1-733b5dc95e94",
        "flavorRef": "physical.s3.large",
        "vpcid": "8df83bf2-fd2e-4ee0-9692-c0b7736513fb",
        "nics": [
            {
                "subnet_id": "c6bb8788-4fd1-4a8f-adab-7eba3bed8616"
            }
        ],
        "extendparam": {
            "chargingMode": "prePaid",
            "periodType": "month",
            "periodNum": 1,
            "isAutoRenew": "true",
            "isAutoPay": "true",
            "regionID": "cn-north-4"
        },
        "metadata": {
            "op_svc_userid": "59781460e9e54886a7d03df7d3f3fc81"
        },
        "key_name": "$key_name"
    }
}
  • availability_zone: AZ where you want to create the BMS. You can query the AZ in Regions and Endpoints. For example, cn-north-4a indicates AZ1 of the CN North-Beijing4 region.
  • name: name of the BMS, for example, bms-test01
  • imageRef: ID of the image (OS) used to create the BMS You can query the image ID on the IMS console.
  • flavorRef: BMS flavor ID in physical.x.x format You can obtain the flavor ID from the BMS console and determine the boot device of the flavor based on Prerequisites. In this example, a flavor that boots from a local disk is used, for example, physical.s3.large.
  • vpcid: ID of the VPC where the BMS resides. You can query the ID on the VPC console or using the Querying VPCs API.
  • nics.subnet_id: ID of the VPC subnet. You can query the ID on the VPC console or using the Querying Subnets API.
  • extendparam: chargingMode specifies the billing mode, and prePaid indicates prepayment, that is, the yearly/monthly mode. periodType specifies the period type, and month indicates the monthly mode. periodNum specifies the number of periods, and 1 in this example indicates one month. isAutoRenew specifies whether to enable auto-renewal. isAutoPay specifies whether to automatically deduct the charges from your account balance without requiring manual payment. regionID specifies the ID of the region where the BMS resides, which can be obtained from Regions and Endpoints.
  • metadata.op_svc_userid: user ID, which you can obtain from My Credentials.
  • key_name: key pair name. To log in to the BMS using an SSH key pair, set the value to the name of an existing key pair. You can obtain the key pair name from the Key Pair console.

Create a BMS Supporting Quick Provisioning

The following example uses the most basic configuration required for creating a BMS supporting quick provisioning.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
{
    "server": {
        "availability_zone": "cn-north-4a",
        "name": "bms-test02",
        "imageRef": "766a545a-02e1-433e-b1d1-733b5dc95e94",
        "flavorRef": "physical.h2.large",
        "root_volume": {
                "volumetype": "SAS",
                "size": 150
        },
        "vpcid": "8df83bf2-fd2e-4ee0-9692-c0b7736513fb",
        "nics": [
            {
                "subnet_id": "c6bb8788-4fd1-4a8f-adab-7eba3bed8616"
            }
        ],
        "extendparam": {
            "chargingMode": "prePaid",
            "periodType": "month",
            "periodNum": 1,
            "isAutoRenew": "true",
            "isAutoPay": "true",
            "regionID": "cn-north-4"
        },
        "metadata": {
            "op_svc_userid": "59781460e9e54886a7d03df7d3f3fc81"
        },
        "key_name": "$key_name"
    }
}

Compared with creating a BMS with local disks, you need to select a flavor whose boot device is EVS disk and set system disk parameters.

  • volumetype: type of the system disk. SAS indicates high I/O. You can specify other types. For details, see the parameter descriptions in Creating BMSs.
  • size: system disk size (GB). The value ranges from 40 to 1024. The system disk size cannot be less than the minimum size of the system disk (min_disk) in the image. You can obtain the value of min_disk using the Querying Images API.

Create a BMS with Data Disks

You can configure data disks for BMSs by adding the data_volumes field to the request body. An example is as follows:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
{
    "server": {
        "availability_zone": "cn-north-4a",
        "name": "bms-test03",
        "imageRef": "766a545a-02e1-433e-b1d1-733b5dc95e94",
        "flavorRef": "physical.s3.large",
        "data_volumes": [
            {
                "volumetype": "SAS",
                "size": 10,
                "shareable": false
            }
        ],
        "vpcid": "8df83bf2-fd2e-4ee0-9692-c0b7736513fb",
        "nics": [
            {
                "subnet_id": "c6bb8788-4fd1-4a8f-adab-7eba3bed8616"
            }
        ],
        "extendparam": {
            "chargingMode": "prePaid",
            "periodType": "month",
            "periodNum": 1,
            "isAutoRenew": "true",
            "isAutoPay": "true",
            "regionID": "cn-north-4"
        },
        "metadata": {
            "op_svc_userid": "59781460e9e54886a7d03df7d3f3fc81"
        },
        "key_name": "$key_name"
    }
}
  • volumetype: data disk type. SAS indicates high I/O.
  • size: data disk size (GB). The value ranges from 10 to 32768.
  • shareable: whether the disk is shareable. true indicates a shared disk and false indicates a common disk.

Create a BMS with an EIP

You can bind an EIP to the BMS by adding the publicip field to the request body. During the BMS creation, an EIP is assigned and bound to the BMS. An example is as follows:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
{
    "server": {
        "availability_zone": "cn-north-4a",
        "name": "bms-test04",
        "imageRef": "766a545a-02e1-433e-b1d1-733b5dc95e94",
        "flavorRef": "physical.s3.large",
        "data_volumes": [
            {
                "volumetype": "SAS",
                "size": 10,
                "shareable": false
            }
        ],
        "vpcid": "8df83bf2-fd2e-4ee0-9692-c0b7736513fb",
        "nics": [
            {
                "subnet_id": "c6bb8788-4fd1-4a8f-adab-7eba3bed8616"
            }
        ],
        "extendparam": {
            "chargingMode": "prePaid",
            "periodType": "month",
            "periodNum": 1,
            "isAutoRenew": "true",
            "isAutoPay": "true",
            "regionID": "cn-north-4"
        },
        "metadata": {
            "op_svc_userid": "59781460e9e54886a7d03df7d3f3fc81"
        },
        "publicip": {
            "eip": {
                "iptype": "5_bgp",
                "bandwidth": {
                    "chargemode": "bandwidth",
                    "name": "bms-test04-bandwidth",
                    "size": 1,
                    "sharetype": "PER"
                },
                "extendparam": [
                    "chargingMode": "prePaid"
                ]
            }
        },
        "key_name": "$key_name"
    }
}
  • iptype: EIP type. 5_bgp indicates dynamic BGP.
  • chargemode: bandwidth billing type. The value can be traffic or bandwidth.
  • name: bandwidth name
  • size: bandwidth (Mbit/s). The value ranges from 1 to 2000.
  • sharetype: bandwidth sharing type. PER indicates dedicated bandwidth.
  • extendparam.chargingMode: billing mode of the EIP. prePaid indicates prepayment, that is, the yearly/monthly mode.

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback