Create a Dedicated Instance
Last Updated:2020-09-29
Create a Dedicated Instance
Description
This interface is used to create a dedicated instance on a DCC. When a dedicated instance is created, the following operations may be related to your business:
- The dedicated instance is not charged.
- This interface is used to create one or more dedicated instances.
- The batch creation is supported. If one instance failed to be created during the creation process, all other instances are rolled back, including CDS, if applicable. In other words, all other instances failed to be created.
- Dedicated instances support creating and adding local disks.
- The local disk does not support mounting, uninstallation, and deleting operations.
- The DCC enables users to customize the CPU and memory-related parameters of the dedicated instance, and in return, the created dedicated instance can use the DCC resources.
- The dedicated instance can only create a temporary disk and specify the disk type via ephemeralDisks.
- The dedicated instance supports users to customize security groups and subnets, both of which need to be specified under the same VPC. If you failed to specify any security groups and subnets, when a dedicated instance is created, the default security group and subnet are added automatically by the system.
Request structure
POST /v{version}/dedicatedHost/instance?clientToken={clientToken} HTTP/1.1
Host: dcc.bj.baidubce.com
Authorization authorization string
{
"instanceType": instanceType,
"cpuCount": cpuCoreCount,
"memoryCapacityInGB": memoryCapacityInGB,
"ephemeralDisks": [
{
"storageType": storageType,
"sizeInGB": size
},
{
"storageType": storageType,
"sizeInGB": size
}
],
"createCdsList": [
{
"storageType": storageType,
"cdsSizeInGB": cdsSizeInGB
}
],
"name": "name",
"imageId": "imageId",
"localDiskSizeInGB": localDiskSizeInGB,
"networkCapacityInMbps": networkCapacityInMbps,
"dedicatedHostId": dedicatedHostId,
"purchaseCount": purchaseCount,
"billing":{
"paymentTiming": paymentTiming,
"reservation": {
"reservationLength": reservationLength
}
},
"zoneName": zoneName,
"subnetId": subnetId,
"securityGroupId": securityGroupId
}
Request header field
No other special header fields are available, except for common header fields.
Request parameters
Parameter Name | Type | Required | Parameter Position | Description |
---|---|---|---|---|
version | String | Yes | URI parameter | API version number |
clientToken | String | Yes | Query parameters | It is an idempotent Token, which is an ASCII character string with the length of no more than 64 bits |
imageId | String | Yes | RequestBody parameter | It is the image ID to be created for the virtual machine, which can be obtained through calling the interface of the image query list |
billing | Billing | Yes | RequestBody parameter | Order and billing-related parameter |
instanceType | String | No | RequestBody parameter | Type of the virtual machine instance to be created. For more information on optional types, please see the following InstanceType. If it is null, the default type of virtual machine is used |
cpuCount | int | Yes | RequestBody parameter | Number of CPU cores of the virtual machine instance to be created. For more information on optional configurations, please see Regional Models and Optional Configurations |
memoryCapacityInGB | int | Yes | RequestBody parameter | Memory capacity (GB) of the virtual machine instance to be created. For more information on optional configurations, see Regional Models and Optional Configurations |
rootDiskSizeInGb | int | No | RequestBody parameter | System disk size (GB) of the virtual machine instance to be created. Its default value is 40 GB, and its range is [40, 100] GB. If the disk size is over 40 GB, it is charged as a cloud disk. Please note that the size of the specified system disk needs to meet the minimum disk space of the mirror disk used |
rootDiskStorageType | String | No | RequestBody parameter | System disk media of the virtual machine instance to be created. The SSD cloud disk is adopted by default. For more information on the specified types of the system disk, please see StorageType |
localDiskSizeInGB | int | No | RequestBody parameter | “Invalid” The size of the temporary data disk of the virtual machine instance to be created in GB (excluding the free system disk). Its size is 0-500 GB. Please use the ephemeralDisks field |
ephemeralDisks | List<EphemeralDisk> | No | RequestBody parameter | The DCC instance can create multiple local disks. The disk type and size need to be specified. Other BCC types can only use one local disk at most. The default disk type is used, and the disk size needs to be specified. The FPGA instance and the GPU instance use a local disk by default, and the local disk size is specified according to the configuration. For more information, see Optional specifications and configuration of GPU type BCC andOptional specifications and configurations of FPGA type BCC |
createCdsList | List<CreateCdsModel> | No | RequestBody parameter | List of CDS disks to be created. For more information on the specific data format, please see the following CreateCdsModel |
networkCapacityInMbps | int | No | RequestBody parameter | Internet bandwidth (Mbps). It must be an integer within 0-200. If it is zero, it means that no public IP is assigned. Its default value is 0 Mbps |
internetChargeType | String | No | RequestBody parameter | For more information on optional parameters of the Internet bandwidth billing methods, please see internetChargeType. If internetChargeType is not specified, the default payment method is the same with that of BCC. The default prepaid method means that you make payments yearly or monthly, while the default postpaid method means that you pay as you go |
dedicatedHostId | String | Yes | RequestBody parameter | The id of a DCC, which needs to be specified when you need to specify this DCC’s position |
purchaseCount | int | No | RequestBody parameter | The number of the virtual host instances created (purchased) in batch, which is an optional parameter. It must be an integer greater than 0, and its default value is 1 |
name | String | No | RequestBody parameter | Name of virtual machine (optional). The name is not specified by default. If the name is specified: Name is used as the prefix of name in batch. The suffix is attached to the backend name. Suffix generation mode: name { - sequence number}. If no name is specified, generate it automatically in the format of {instance-8-bit random string-Sequence number}. The random string is composed of digital numbers of 0-9 and English letters of a-z. The sequence number increases by order of count. If the count is 100, the sequence number increases from 000 to 100. If it is 10, the sequence number increases from 00 to 10. It consists of uppercase and lowercase letters, numbers, Chinese characters, and such special characters as -, , _ , / and , with a length of 1-65 characters. Also, it must begin with the a letter |
adminPass | String | No | RequestBody parameter | Admin password of an instance to be specified, which is a 8-16-bit string, containing English letters, numbers and symbols at the same time. For symbols, only !, @, #, $, %, * and () can be used. The password needs to be encrypted for transmission. For more information, please see Link |
zoneName | String | No | RequestBody parameter | The ZoneName naming convention is "Country-Region-Availability zone sequence” with lowercase letters, for example, Beijing availability zone A is represented with "cn-bj-a". The dedicated instance uses the zone where the DCC is located without specifying this field |
subnetId | String | No | RequestBody parameter | The specified subnet information. If it is null, the default subnet is used. |
securityGroupId | String | No | RequestBody parameter | The specified security group information. If it is null, the default security group is used. |
gpuCard | String | No | RequestBody parameter | GPU card information carried by the instance to be created. For more optional information, please see GpuType. You do not need to specify this field for non-GPU instances |
fpgaCard | String | No | RequestBody parameter | FPGA card information carried by the instance to be created. For more optional information, please see FpgaType. You do not need to specify this field for non-FPGA instances |
cardCount | String | No | RequestBody parameter | Number of GPU cards or FPGA cards carried by the instance to be created. It is valid only if the gpuCard or fpgaCard field is not null and the requirements of Optional SpecificationS and Configurations of GPU-type BCCor [Optional Specifications and Configurations of FPGA-type BCC](BCC/API Reference/Appendix.md#Optional Specifications and Configurations of FPGA-type BCC) can be met |
Return header field
No other special header fields are available, except for common header fields.
Return parameters
Parameter Name | Type | Description |
---|---|---|
instanceIds | List< string> | It is a set of IDs of the virtual machine instances, each of which is a string with a fixed length in line with the BCE specification, and contains only uppercase and lowercase English letters, numbers, hyphens (-), and underscores (_). |
Error code
Error Code | Error Description | HTTP Status Code | Explanation |
---|---|---|---|
instance.InsufficientRootDiskSize | Not enough root disk size. | 400 | The image used is too large and the system disk size is not enough |
instance.InvalidateRootDiskStorageType | Invalidate root disk storage type. | 400 | The system disk media is invalid |
instance.InstanceBeBanned | The instance is banned. Contact technical support for assistance. | 403 | The BCC service is banned |
instance.GlobalInstanceQuotaLimitExceeded | Quota exceeds limit for regional postpaid instances pool. Contact technical support for further assistance. | 413 | The number of the postpaid virtual machines exceeds the limit of the presale quota in the current region |
instance.InstanceQuotaLimitExceeded | Quota exceeds limit. | 413 | The number of instances exceeds the limit |
instance.EipQuotaLimitExceeded | The number of eip will exceed the limit. | 413 | The number of EIPs exceeds the limit during the merged purchase |
instance.InvalidateConfiguration | Invalidate cpu memory configuration. | 400 | The virtual machine configuration is invalid |
Request example
POST /v1/dedicatedHost/instance?clientToken=be31b98c-5e41-4838-9830-9be700de5a20 HTTP/1.1
Host: dcc.bj.baidubce.com
ContentType: application/json
Authorization bce-auth-v1/4e69d28643af46dea51fef90e221eb17/2019-02-12T09:21:27Z/1800/host;x-bce-date/a582637d5d092ac735a88756ddf3274425fb497f0bcc5cd0e425740d24838be0
{
"cpuCount": 1,
"memoryCapacityInGB": 1,
"ephemeralDisks": [
{
"storageType": "ssd",
"sizeInGB": 40
}
],
"name" : "example",
"imageId": "m-0N8yoUGf",
"networkCapacityInMbps": 0,
"dedicatedHostId": "d-1xU2a1k1",
"purchaseCount": 1
}
Return example
HTTP/1.1 200 OK
x-bce-request-id: 1214cca7-4ad5-451d-9215-71cb844c0a50
Content-Type: application/json;charset=UTF-8
Server: BWS
{
"instanceIds": [
"i-aDrQKA9U"
]
}