Virtual Machines

Products

Virtual Machines

createInstances

Description

Create one or more virtual machines with the assigned configuration, with the creation divided into three modes: 1. common mode, 2. using high availability group, and 3. using startup template. In three modes, when the virtual machine instance is created, the required and optional parameters are different. See details in Detailed Instructions of Parameters

  • Creating a VM requires real-name verification
  • Instance Type
    • Can query the API DescribeInstanceTypes to get specification information for a specified region or availability zone.
    • It is not possible to use an off-line, or a sold out instance type.
  • image
    • All Windows Server all image cannot selecte an instance type that has exceeded 64 cores vCPU.
    • Can query the API DescribeImages to get image information for a specified region.
    • The selected image must support the seled instance type. Can query the API DescribeImageConstraints to get instance type limit information for the specified image.
  • Network Instance Type
    • Specify primary network interface configuration information
      • SubnetId must be specified
      • The elastic IP can be restricted by specifying elasticIp specification, with the bandwidth value range of [1-200]Mbps and the stepping of 1Mbps.
      • The primary private IP (primaryIpAddress) of primary network interface can be specified, and then the maxCount can only be 1
      • The security group (securityGroup) needs to be within the same VPC as the the subnet (Subnet)
      • At least one security group must be specified and at most 5 security groups can be specified, when a Virtual Machine is created. The default security group is used by default, when there are no specified security groups
      • The primary network interface deviceIndex will be set to 1
  • Storage
    • System Disk
      • Disk classification, system disk support local or cloud
      • Disk Size
        • local: Unable to specify size, the default size is 40GB
        • cloud: Value range: 40-500GB, and cannot be smaller than the minimum system disk size of image; if not specified, the default is the system disk size in the image
      • Auto-delete
        • In case it is of local type, it will be automatically deleted by default and cannot be modified
        • In case it is Pay By Configuration Cloud Disk Service of cloud type, It is True by default and can be modified
        • In case it is monthly package Cloud Disk Service of cloud type, it is False by default and cannot be modified
    • Data Disk
      • Disk classification, data disks only support cloud
      • The type of cloud disk can be ssd or premium-hdd
      • Disk Size
        • premium-hdd: Range[20, 3000] GB, Step Size: 10G
        • ssd: Range[20, 1000] GB, Step Size: 10G
        • hdd.std1、ssd.gp1、ssd.io1: Scope [20-16000]GB, and the step length is 10GB
      • Auto-delete
        • It is automatically deleted by default. In case of monthly package Cloud Disk Service, the parameter is invalid
      • You can create a disk from a snapshot
    • The VM with a local disk as its system disk can attach with 8 cloud disks
    • The VM with a cloud disk as its system disk can attach with another 7 cloud disks
  • Billing
    • Billing mode of EIP. You may choose pay by consumption separately, or the billing modes will be subject to the VM.
    • The billing mode of the cloud disks is subject to the VM
  • Others
    • After the creation is complete, the VM status is running
    • Only the Linux system VM can specify a key pair
    • maxCount means maximum effort, and it is not guaranteed that the maxCount can be reached
    • The VM's az will replace the az attribute of the cloud disk
  • Password

Request method

POST

Request address

https://vm.jdcloud-api.com/v1/regions/{regionId}/instances

Name Type Required or not Default value Description
regionId String True Region ID

Request parameter

Name Type Required or not Default value Description
instanceSpec InstanceSpec True Describe the VM instance type
maxCount Integer False 1 The number of VMs to be purchased; Value range: [1, 100], 1 by default.
clientToken String False Used to guarantee the idempotence of the request. Generated by the client with a length of no more than 64 characters.

InstanceSpec

Name Type Required or not Default value Description
agId String False High availability group Id. After the parameter is assigned, the virtual machine is created only through instance template associated with high availability group, and the parameters in instance template cannot be replaced. Parameters other than instance template may be also assigned.
instanceTemplateId String False Instance template id, if no high availability group is used, for the information not existing in the instance template, parameters for virtual machine are required for supplementation, or parameters in the replacement startup template are selected.
az String False The Availability Zone to which the VM belongs.
instanceType String False Instance Type. Can query DescribeInstanceTypes API for instance type information of the specified zone or availability zone.
imageId String False Image ID. Can query DescribeImages API for the image information of the specified zone.
name String True VM name, Refer to the public parameter specification.
password String False Password, Refer to the public parameter specification.
keyNames String[ ] False The key pair name currently only supports incoming one.
elasticIp ElasticIpSpec False EIP specification associated with the primary IP of the primary network interface
primaryNetworkInterface InstanceNetworkInterfaceAttachmentSpec False Primary Network Interface Configuration Information
systemDisk InstanceDiskAttachmentSpec False System Disk Configuration Information
dataDisks InstanceDiskAttachmentSpec[ ] False The configuration information of the data disk. The VM with a local disk as its system disk can be attach 8 cloud disks, and the VM with a cloud disk as its system disk can be attach another 7 cloud disks.
charge ChargeSpec False Billing Configuration
The VM does not support pay by consumption. The default value is pay by configuration.
In the case of packaging cloud disks, the billing method of the cloud disks can only be consistent with the VM.
In the case of packaging an EIP, if the EIP is not specified to be paid by consumption, the EIP billing method can only be consistent with the VM.
userdata Userdata[ ] False As for the metadata information, introduction of a key of "launch-script" is only supported, indicating the first enabling script. The value is in the format of base64.
launch-script: The linux system supports bash and python, and before encoding, it is required to take #!/bin/bash and #!/usr/bin/env python as the first line of the content respectively;
The launch-script: windows system supports bat and powershell, and before encoding, it is required to take and as the first and last lines of the content respectively.
description String False VM Description, Refer to the public parameter specification.
noPassword Boolean False The password in the template isn’t used.
The parameter (value: true) is valid, only when no Ag is used, a template is used, and the password parameter is null.
The parameter is invalid, and the newly specified one shall prevail, when a virtual machine is created with templates, and the password parameter has been specified.
noKeyNames Boolean False The key in the template isn’t used.
The parameter (value: true) is valid, only when no Ag is used, a template is used, and the keynames parameter is null.
The parameter is invalid, and the newly specified one shall prevail, when a virtual machine is created with templates, and the keynames parameter has been specified.
noElasticIp Boolean False The Elastic IP in the template isn’t used.
The parameter (value: true) is valid, only when no Ag is used, a template is used, and the elasticIp parameter is null.
The parameter is invalid, and the newly specified one shall prevail, when a virtual machine is created with templates, and the elasticIp parameter has been specified.

Userdata

Name Type Required or not Default value Description
key String False Key
value String False Value

ChargeSpec

Name Type Required or not Default value Description
chargeMode String False postpaid_by_duration Billing model value is prepaid_by_duration, postpaid_by_usage or postpaid_by_duration; prepaid_by_duration means Pay-In-Advance, postpaid_by_usage means Pay-As-You-Go By Consumption and postpaid_by_duration means pay by configuration; is postpaid_by_duration by default. Please refer to the Help Documentation of specific product line to confirm the billing type supported by the production line
chargeUnit String False Billing unit of Pay-In-Advance, the Pay-In-Advance is compulsory, and valid only when chargeMode is prepaid_by_duration, and the value is month or year and month by default
chargeDuration Integer False Pay-In-Advance billing duration, the Pay-In-Advance is compulsory and valid only when the value of chargeMode is prepaid_by_duration. When chargeUnit is month, the value shall be 1~9; when chargeUnit is year, the value shall be 1, 2 or 3

InstanceDiskAttachmentSpec

Name Type Required or not Default value Description
diskCategory String False Disk classification, the local or cloud disk is taken.
The system disk supports local disk or cloud disk. If select the local type for the system disk , and you must use a image of localDisk type; if select the cloud type for the system disk, you must use a image of the cloudDisk type.
The data disk supports cloud disk only.
autoDelete Boolean False Deleting this disk with the VM automatically when the VM is deleted. The default value is true, which cannot be changed for a local disk.
This parameter does not take effect if the billing method of the disk is a monthly package.
cloudDiskSpec DiskSpec False Data Disk Configuration
deviceName String False Logical attach point of data disk, value range: vda,vdb,vdc,vdd,vde,vdf,vdg,vdh,vdi,vmj,vdk,vdl,vdm
noDevice Boolean False Exclude the device, and parameter noDevice is used with deviceName.
Create a entile image that contains all the system disk and attached cloud data disks: deviceName: vdb, noDevice: true, the cloud data disk whose device name is vdb that attached to the VM will not be involved in creating the image.
Create a template: deviceName: vdb, noDevice: true, the data disk whose device name is vdb in the image will not be involved in creating the VM.
Create a VM: deviceName: vdb, noDevice: true, the data disk vdb in the image or the data disk whose device name is vdb in the template (create a VM using the template) will not be involved in creating the machine.

DiskSpec

Name Type Required or not Default value Description
az String True Availability Zone, to which the cloud disk belongs
name String True Name of the cloud disk
description String False Description of the cloud disk
diskType String True Type of the cloud disk, value ssd, premium-hdd, ssd.gp1, ssd.io1 or hdd.std1
diskSizeGB Integer True Size of Cloud Disk Service is in GiB, for ssd type, the value range is [20,1000]GB and the step size is 10G, for premium-hdd type, the value range is [20,3000]GB, and the step size is 10G, for ssd.gp1, ssd.io1 and hdd.std1 types, the value range is [20,16000]GB, and the step size is 10G
iops Integer False The size of Cloud Disk Service IOPS is effective only when the cloud disk type is ssd.io1, and the step size is 10.
snapshotId String False Snapshot ID used to create a cloud disk
charge ChargeSpec False Billing configuration. If not specified, the default billing type is pay-as-you-go - pay by service time by default.
multiAttachable Boolean False Whether the Cloud Disk Service supports the mode that one disk is attached to multiple machines. It is set as false by default (not supported).
encrypt Boolean False Whether a Cloud Disk is encrypted, false (does not encrypt) by default

InstanceNetworkInterfaceAttachmentSpec

Name Type Required or not Default value Description
deviceIndex Integer False Network device Index, and the primary network interface can only be 1
networkInterface NetworkInterfaceSpec False Network Interface API Instance Type

NetworkInterfaceSpec

Name Type Required or not Default value Description
subnetId String True Subnet ID
az String False Availability zone refers to the user’s default availability zone, which is an invalid parameter and shall not be used
networkInterfaceName String False Network interface name, only allow Chinese, numbers, capital and lowercase letters, English underline "_" and line-through "-", must provide a name which cannot exceed 32 characters.
primaryIpAddress String False Network interface primary IP, if it has not been assigned, it will be allocated automatically from the subnet
secondaryIpAddresses String[ ] False Secondary IP List
secondaryIpCount Integer False Amount of Secondary IP Assigned Automatically
securityGroups String[ ] False Security Group ID list to be associated, a maximum of 5 Security Groups can be done
sanityCheck Integer False Source and target IP address verification, with value 0 or 1, default value is 1
description String False Description, allow all characters under UTF-8 coding, which cannot exceed 256 characters

ElasticIpSpec

Name Type Required or not Default value Description
bandwidthMbps Integer True Elastic IP speed limit (unit: Mbps), value range is [1-200]
provider String True IP service provider, values include bgp or no_bgp, cn-north-1: bgp; cn-south-1: [bgp, no_bgp]; cn-east-1: [bgp, no_bgp]; cn-east-2: bgp
chargeSpec ChargeSpec False Billing Configuration

Response parameter

Name Type Description
result Result
requestId String

Result

Name Type Description
instanceIds String[ ]

Response code

Return code Description
200 OK
400 Invalid parameter
401 Authentication failed
404 Not found
429 Quota exceeded
500 Internal server error
503 Service unavailable
Update Time:2019-08-20 17:20:43