百度智能云

All Product Document

          Cloud Compute Service

          Create Instance (By Specifying Instance Package Specifications)

          Precondition

          The creation of instances requires identity authentication. If you failing to pass the identity authentication, you can go to the Individual Authentication or Enterprise Authentication in the console of the official website of Baidu AI Cloud for authentication.

          BCC instance

          • Billing precautions:

            • The instance with the billing mode of postpaid as created requires that the sum of cash balance of the account plus the general voucher is greater than 100; the instance of pre-paid mode requires that the cash balance of the account is greater than or equal to the instance costs.
            • For the creation of the specified public network IP bandwidth, the charging mode is charging according to the bandwidth.
          • Instance precautions:

            • Specify the virtual machine type to be created according to the spec field, and view the available instance package and the package specification by the package specification list interface. 。
            • We can't purchase GPU card and FPGA card simultaneously for the same instance. We must specify the number of GPU cards or FPGA cards carried by virtual machines to be purchased by cardCount when purchasing the instances with GPU card or FPGA card.
          • Storage precautions:

            • When creating an instance, we can specify the size of system disk, and the size scope of the specified system disk is [40,500] GB. The free 40GB CDS of hp1 type is used as the system disk by default. For the system disk types you can specify, please refer to StorageType.
            • Baidu AI Cloud offers a 40GB system disk for free. The fees are charged according to the corresponding CDS cloud disk when the free 40GB limit is exceeded.
            • The system disk added in instance creation can't be changed after creation. The separate creation or addition of system disks is not supported.
            • The system disk doesn't support mounting, unloading and deletion.
            • In the creation of CDS system disk and data disk, the selection of disk size according to 1GB step size is supported.
            • By default, one instance can mount a maximum of 5 cloud disks.
            • The maximum size of the system disk of BCC instance can't exceed 500G.
            • One temporary data disk can be purchased only for each instance. The type of temporary data disk is hp1 only by default.
            • When creating the storage optimization instances, we must purchase temporary data disks, and specify the temporary data disk size by ephemeralDisks. The default disk is the data disk of nvme type and may not be specified.
          • Network precautions:

            • The BCC instance supports custom security group and subnet. The custom security group and subnet should be specified under the same VPC simultaneously. If the security group and subnet are not specified, the created exclusive instance are automatically added in the default security group and subnet in the system.
          • Other precautions:

            • The batch creation is supported. And if the creation of one instance fails in the creation process, all the instances are rolled back and their creation fails. And the instances are also rolled back if CDS and CDS are included in the creation.
            • The interface is created asynchronously. You can query the instance status by the Query Specified Instance Details interface.

          Request

          Request structure

          POST /v{version}/instanceBySpec?clientToken={clientToken} HTTP/1.1 
          Host: bcc.bj.baidubce.com 
          Authorization: authorization string 
          
          { 
              "spec": spec, 
              "rootDiskSizeInGb":rootDiskSizeInGb, 
              "rootDiskStorageType":"rootDiskStorageType", 
              "ephemeralDisks": [ 
                  { 
                      "storageType": storageType, 
                      "sizeInGB": size 
                  }, 
                  { 
                      "storageType": storageType, 
                      "sizeInGB": size 
                  } 
              ], 
              "createCdsList": [ 
                  { 
                      "storageType": storageType, 
                      "cdsSizeInGB": cdsSizeInGB, 
                      "snapshotId": snapshotId 
                  } 
              ], 
              "name": "name", 
              "imageId": "imageId", 
              "networkCapacityInMbps": networkCapacityInMbps, 
              "autoRenewTimeUnit": "autoRenewTimeUnit", 
              "autoRenewTime": autoRenewTime, 
              "cdsAutoRenew": cdsAutoRenew, 
              "internetChargeType": internetChargeType, 
              "dedicatedHostId": dedicatedHostId, 
              "purchaseCount": purchaseCount, 
              "billing":{ 
                  "paymentTiming": paymentTiming, 
                  "reservation": { 
                      "reservationLength": reservationLength 
                  } 
              }, 
              "zoneName": zoneName, 
              "subnetId": subnetId, 
              "securityGroupId": securityGroupId, 
              "relationTag": relationTag, 
              "tags": [ 
                 { 
                    "tagKey": tagKey, 
                    "tagValue": tagValue 
                 } 
              ], 
              "keypairId": keypairId 
          } 

          Request header

          There are no special headers except the common header.

          Request parameter

          Parameter name Type Required or not Parameter position Description
          version String Yes URL parameter API version number
          clientToken String Yes Query parameter The idempotence Token is an ASCII string with a length not exceeding 64 bits.
          imageId String Yes RequestBody parameter For the image ID of the virtual machine instance to be created, you can select to acquire the required image ID by calling Query Image List.
          spec String No RequestBody parameter For the package specifications of virtual machine instance to be created (you can use this parameter and may not fill in instanceType, cpuCount, memoryCapacityInGB, gpuCard, fpgaCard, cardCount and ephemeralDisks parameters), you can view the available instance packages and package specifications by using the instance package specification list interface.
          rootDiskSizeInGb int No RequestBody parameter The system disk size of virtual machine instance to be created is 40GB by default. The size range is [40,100] GB. Fees are charged according to the cloud disk price when the 40GB is exceeded. Please note that the specified system disk size should satisfy the minimum disk space restriction of the used image.
          rootDiskStorageType String No RequestBody parameter For the system disk medium of the virtual machine instance to be created, the cloud disk of SSD type is used by default. For the system disk types you can specify, please refer to StorageType.
          ephemeralDisks List<EphemeralDisk> No RequestBody parameter The BCC instance can use a maximum of one local disk. When using the default disk type, you should specify the disk size. This parameter is invalid in creation of FPGA instance or GPU instance. The local disk with a specified size is used by default.
          createCdsList List<CreateCdsModel> No RequestBody parameter For the CDS disk list to be created, refer to the following CreateCdsModel for the specific data format.
          networkCapacityInMbps int No RequestBody parameter Public network bandwidth, in Mbps. It must be an integer between 0~200. The value of 0 means not to distribute the public network IP. The default value is 0Mbps.
          internetChargeType String No RequestBody parameter Charging mode for the public network bandwidth. Refer to internetChargeType for details of the optional parameter. If the internetChargeType is not specified, the default charging mode is the same as BCC. The prepaid mode is annual/monthly charging according to bandwidth, and the postpaid mode is annual/monthly charging according to the utilized bandwidth by default.
          purchaseCount int No RequestBody parameter The number of virtual machine instances created (purchased) in batch must be an integer greater than 0. It is an optional parameter and the 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 not specified: The name is used as the prefix of name in batch. A suffix is added at the backend and the suffix generation method is as below: name{ - S/N }. If the name is not specified, it is generated automatically: {instance- 8-bit random string - serial number }. Note: The random string is generated from 0~9a~z; the serial numbers increase in turn according to the order of magnitude of count. If the count is 100, the serial numbers increased from 000~100. If the count is 10, the serial numbers increased from 00~10. The scaling group name supports upper and lower case letters numbers, Chinese and -_/. special characters. It must start with letters, with a length of 1-65.
          adminPass String No RequestBody parameter Instance administrator password to be specified (8-16 characters among which English, numbers and symbols must coexist, and the symbols are only limited to! @#$%^*(), the password requires encrypted transmission.
          billing Billing Yes RequestBody parameter Order, billing related parameters
          zoneName String No RequestBody parameter Specify zone information, which is null by default and selected automatically by the system, and the list of available zone can be queried by calling Query Available Zone List interface. The naming specifications for zoneName are shown as "state-region-available zone sequence" in lowercase; for example, the available zone A in Beijing is shown as "cn-bj-a". The zone where the exclusive instance uses the exclusive server does not specify this field.
          subnetId String No RequestBody parameter Specify the subnet information. The default subnet is used when it is empty.
          securityGroupId String No RequestBody parameter Specify the securityGroup information. The default security group is used when it is empty.
          relationTag boolean No RequestBody parameter Whether the specified tag of the instance to be created should be associated with the existing tag key. The default value is false. Note that you should ensure the tag key already exists when the value is true.
          tags List<TagModel> No RequestBody parameter List of labels to be Creat, please refer to TagModel below for the specific data format
          keypairId String No RequestBody parameter Key pair ID to be bound to the instance to be created
          autoRenewTimeUnit String No RequestBody parameter Monthly payment or annual payment, the former is "month" and the latter is "year".
          autoRenewTime int No RequestBody parameter The automatic renewal time is 1-9 by the month and 1-3 by the year.
          cdsAutoRenew boolean No RequestBody parameter Whether cds is automatically renewed, Yes: true No: false
          aspId String No RequestBody parameter Automatic snapshot policy ID
          bidModel String No RequestBody parameter Bid model of bidding instance, market price: "market"; custom: "custom". Refer to BidModel
          bidPrice String No RequestBody parameter For the bid price of bidding instance, if the bid is custom bid and the bid price is lower than the market price, the creation is not allowed. Valid only when bidModel='custom'
          dedicatedHostId String No RequestBody parameter Exclusive server id, specify the value when specifying the placement location of the virtual machine.
          deployId String No RequestBody parameter Specify the deployment set id where the instance is located

          Return

          Return header

          There are no special headers except the common header.

          Return parameter

          Parameter name Type Description
          instanceIds List<String> For the set of virtual machine instance IDs, the ID conforms to the BCE specification and must be a string with a fixed length. It may only include upper and lower case letters, numbers, hyphens (-), and underlines (_).

          Error code

          Error code Error description HTTP status code Chinese explanation
          Instance.InsufficientRootDiskSize Not enough root disk size. 400 The used image size is too large, and the system disk size is not enough.
          Instance.InvalidateRootDiskStorageType Invalidate root disk storage type. 400 Invalid system disk medium
          Instance.InstanceBeBanned The instance is banned, contact technical support for assistance. 403 The Bcc service has been 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 presale quota limit of 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 limit in the merger purchase
          Instance.InvalidateConfiguration Invalidate cpu memory configuration. 400 Invalid virtual machine configuration
          BadRequest spec is invalid. 400 The package specification parameter of the virtual machine instance to be created is invalid.
          Instance.MKTImageInstanceNotSupportCreateSnapshotException Instance with mkt image not support create system snapshot. 403 The cloud market image doesn't support the creation of system snapshot.

          Example

          Request example (create an instance by specifying the instance package specification spec)

          POST /v2/instanceBySpec?clientToken=be31b98c-5e41-4838-9830-9be700de5a20 HTTP/1.1 
          Host: bcc.bj.baidubce.com 
          ContentType: application/json    
          Authorization: bce-auth-v1/f81d3b34e48048fbb2634dc7882d7e21/2015-08-11T04:17:29Z/3600/host/74c506f68c65e26c633bfa104c863fffac5190fdec1ec24b7c03eb5d67d2e1de 
          
          { 
              "spec": "bcc.g3.c4m12", 
              "createCdsList": [ 
                  { 
                      "storageType": "std1", 
                      "cdsSizeInGB": 5 
                  } 
              ], 
              "name": "example", 
              "imageId": "m-mRjO3cjs", 
              "networkCapacityInMbps": 0, 
              "purchaseCount": 1, 
              "billing":{ 
                  "paymentTiming":"Prepaid", 
                  "reservation": { 
                      "reservationLength": 1 
                  } 
              } 
          } 

          Return example

          HTTP/1.1 200 OK 
          x-bce-request-id: 1214cca7-4ad5-451d-9215-71cb844c0a50
          Date: Wed, 03 Dec 2014 06:42:19 GMT 
          Content-Type: application/json;charset=UTF-8 
          Server: BWS 
          
          { 
              "instanceIds": [ 
                  "i-T1I3OtUO"
              ] 
          }
          Previous
          Create an Instance
          Next
          Query the Instance List