Create multiple devices at a time
A product is a collection of devices that share the same features. After creating a product, you must add devices and obtain their certificates. You can create multiple devices at a time in the IoT Platform console.
Prerequisites
A product is created. For more information, see Create a product.
Bulk add: Standard, Premium, and public instances
-
Log on to the IoT Platform console.
On the Overview page, find the instance that you want to manage and click the instance ID or instance name.
-
In the left-side navigation pane, choose .
-
On the Devices page, click Batch Add.
-
Select a product. The new devices inherit the features of this product.
ImportantIf the product is associated with other platforms, make sure that your account has a sufficient quota of activation codes to create devices.
Set Add Method to Auto Generate, set Device Quantity to
100, then click OK. -
Select a method to specify DeviceNames.
-
Auto Generate: Enter the number of devices. IoT Platform generates a random DeviceName that consists of letters and digits for each device.
-
Batch Upload: Specify a name for each device. Click Download .csv Template, enter the DeviceName and Nickname for each device in the template, and then upload the file to the IoT Platform console.
Important-
Do not modify the first row. Start entering data from cell A2.
-
A DeviceName must be 4 to 32 characters long and can contain letters, digits, hyphens (-), underscores (_), at signs (@), periods (.), and colons (:). A DeviceName must be unique within a product.
-
Nickname is an optional alias for the device. An alias must be 4 to 64 characters long and can contain Chinese characters, Japanese characters, letters, digits, and underscores (_). A Chinese or Japanese character counts as two characters.
-
A file can contain up to 10,000 records and must not exceed 2 MB.
-
-
-
Click OK.
If the uploaded list contains invalid device names, an error message appears. Click Download Invalid Device Name List to view the invalid names, correct them, and upload the file again.
-
After the devices are created, click Download Device Certificate to download the certificates of the devices. You can burn the certificates on the devices.
NoteIf you selected X.509 certificate as the authentication method when you created the product, the download URL (CertUrl) for the X.509 certificates is valid for 180 days after the devices are created in bulk. Download the certificates in a timely manner.
The downloaded package contains the generated X.509 certificates and keys, and a .txt file that lists the devices for which certificate generation failed. If no devices failed to generate a certificate, this .txt file is not included.
A device certificate consists of a ProductKey, a DeviceName, and a DeviceSecret. A device requires this credential to communicate with IoT Platform. Store the certificate securely.
Parameter
Description
ProductKey
The ProductKey of the product to which the device belongs. The ProductKey is the GUID that is issued by IoT Platform to the product.
DeviceName
The DeviceName of the device, which is the unique identifier of the device within the product. A combination of the DeviceName and ProductKey is used as the device identifier. IoT Platform authenticates the device and communicates with the device based on the device identifier.
DeviceSecret
The DeviceSecret of the device, which is issued by IoT Platform for device authentication and encryption. The DeviceSecret must be used in combination with the DeviceName.
Bulk add: MQTT-based instances
Log on to the IoT Platform console.
-
On the Instance Overview page, find the MQTT-based instance and click the instance to go to the Instance Details page.
In the left-side navigation pane, choose .
-
On the device page, click Batch Add.
-
In the Batch Add Devices dialog box, select a product and click Download .csv Template to download the template.
-
In the template, fill in the SN, MQTT username, and MQTT password, and then save the file.
Important-
The MQTT username and MQTT password are required. The SN is optional.
-
An MQTT username must be 4 to 32 characters long and can contain letters, digits, hyphens (-), underscores (_), at signs (@), periods (.), and colons (:). Each MQTT username must be unique per product.
-
An MQTT password must be 1 to 32 characters long and can contain letters, digits, hyphens (-), underscores (_), at signs (@), periods (.), and colons (:).
-
A single file can contain a maximum of 10,000 device records. Do not import duplicate devices.
-
-
Return to the Batch Add Devices dialog box, click Upload File to upload the completed file to the IoT Platform console, then click OK.
If the uploaded file contains invalid information, an error message appears. Click Download Invalid List to view the invalid information, correct it, and upload the file again.
After you import the device identities, IoT Platform creates the corresponding devices and uses the uploaded MQTT Username values as the device names.
The status of the new devices is Inactive, and they are enabled by default.
Result
After the devices are created, go to the Batch Management tab on the Devices page. Find the corresponding product and click one of the following:
-
Details: View the Number of Added Devices and the device list for the batch. The list includes information such as device certificates and status.
If some devices failed to be created, the error codes and causes are displayed in the device list. The following table describes the error codes.
Error code
Message
Description
460
duplicated deviceName
The device name is duplicated.
invalid deviceName
The device name is invalid.
6251
device exist
The device already exists.
6760
insufficient activation code
You do not have enough activation codes.
64003
device creation failed
The device was not created due to concurrent operations.
6293
device has been distributed
The device has been distributed.
-
DownloadCSV: Download the certificates of the devices in this batch.
What to do next
You can view the device information. For more information, see View device information.
After you create a device, the device is in the Inactive state. To activate the device, you must use a device SDK to connect the device to IoT Platform. For more information, see Use a device SDK to connect a device to IoT Platform.
For more information about how to connect a device to IoT Platform, see the following topics:
Related API operations
BatchRegisterDevice: Registers multiple devices at a time.
For Enterprise Edition MQTT-based instances, the BatchRegisterDevice operation is not supported. You can call the BatchImportDevice operation to register devices in bulk.