Updated on 2024-12-02 GMT+08:00

Create an IoTDA Instance

Function

This API is used to create an IoTDA instance. For details about the supported instance specifications, see Specifications.

[Constraints:

  • Ensure that your account balance is sufficient. This API cannot pay with coupons. When you create a yearly/monthly instance, if your account balance is insufficient, a pending order will be created.

  • To use a coupon, set is_auto_pay in the request to false and pay for the order by referring to Paying Yearly/Monthly Product Orders, or pay for the order on the Huawei Cloud official website.

  • For details about how to unsubscribe from yearly/monthly resources, see .

Debugging

You can debug this API through automatic authentication in API Explorer or use the SDK sample code generated by API Explorer.

URI

POST /v5/iot/{project_id}/iotda-instances

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Parameter description: project ID. For details, see Obtaining a Project ID.

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

No

String

Parameter description: user token. You can obtain the token by calling the IAM API Obtaining a User Token Through Password Authentication. In the returned response header, X-Subject-Token is the desired user token. For details about how to obtain the token, see Token Authentication.

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

instance_type

Yes

String

Parameter description: type of the instance to be created. For details about instance types, see Specifications.

Options:

  • standard

  • enterprise

flavor

Yes

Flavor object

Parameter description: specifications of an IoTDA instance.

name

Yes

String

Parameter description: instance name.

Value: Enter 1 to 64 characters, including letters, digits, underscores (_), and hyphens (-).

charge_info

Yes

ChargeInfo object

Parameter description: billing information of an IoTDA instance.

description

No

String

Parameter description: description of an IoTDA instance.

Value: The value can contain a maximum of 256 characters. Use only letters, digits, and special characters (_,.&-).

enterprise_project_id

No

String

Parameter description: enterprise project ID. If this parameter is set to a specific enterprise project ID or 0 (default enterprise project ID), the enterprise project feature is supported. You can obtain the value from Enterprise Project Management Service (EPS).

Value: Enter up to 36 characters, including lowercase letters (a-f), digits, and hyphens (-).

tags

No

Array of Tag objects

Parameter description: tag information of an IoTDA instance.

additional_params

No

AdditionalParams object

Additional parameter information of the enterprise edition.

Table 4 Flavor

Parameter

Mandatory

Type

Description

type

Yes

String

Parameter description: specification name of the IoTDA instance to create. For details, see Specifications.

size

No

Integer

Parameter description: unit number of the standard IoTDA instances to create. For details, see Specifications. This parameter is mandatory when instance_type is set to standard.

Table 5 ChargeInfo

Parameter

Mandatory

Type

Description

charge_mode

Yes

String

Parameter description: payment mode of the instance.

Options:

  • prePaid: yearly/monthly

  • postPaid: pay-per-use

period_type

No

String

Parameter description: period type of the subscribed IoTDA instance. This parameter is valid and mandatory only when charge_mode is set to prePaid.

Options:

  • month

  • year

period_num

No

Integer

Parameter description: number of periods for subscribing to an IoTDA instance. This parameter is valid and mandatory only when charge_mode is set to prePaid.

Value: If period_type is set to month, the value ranges from 1 to 9. If period_type is set to year, the value ranges from 1 to 3.

is_auto_renew

No

Boolean

Parameter description: whether to automatically renew the subscription, specified during yearly/monthly instance creation. The renewal period is the same as the original period, and the payment is automatically made during the renewal.

Options:

  • true

  • false (default value)

is_auto_pay

No

Boolean

Parameter description: whether to automatically pay from the customer's account. This parameter can be specified when a yearly/monthly instance is created. This parameter does not affect the payment mode of automatic renewal.

Value: true: automatic payment. Fees are automatically deducted from the account balance. false: default value. Orders are submitted but not paid. [Pay for the order by referring to Paying Yearly/Monthly Product Orders or on the Huawei Cloud official website.] (tag:hws)

Table 6 Tag

Parameter

Mandatory

Type

Description

key

Yes

String

Parameter description: tag key. Use letters, digits, spaces, and special characters (_.:=+-@). No space is allowed at the beginning or end.

value

No

String

Parameter description: tag value, which can be an empty string or null. Use letters, digits, spaces, and special characters (_.:=+-@).

Table 7 AdditionalParams

Parameter

Mandatory

Type

Description

vpc_id

Yes

String

Parameter description: VPC ID of the instance of the enterprise edition.

subnet_id

Yes

String

Parameter description: subnet ID of the instance of the enterprise edition.

security_group_id

Yes

String

Parameter description: security group ID of the instance of the enterprise edition. Ensure that port 22 (Linux SSH login), port 3389 (Windows remote login), and ICMP (Ping) have been enabled for the selected security group.

smn_topic_urn

No

String

Parameter description: SMN topic URN. When an instance of the enterprise edition is successfully created, the platform sends notifications through this topic.

ciphering_algorithm

No

String

Parameter description: encryption algorithm supported by the instance.

Options:

  • COMMON_ALGORITHM: common encryption algorithm (international cryptographic algorithms such as RSA and SHA-256)

  • SM_ALGORITHM: SM series commercial encryption algorithms (Chinese cryptographic algorithms such as SM2, SM3, and SM4)

port_info

Yes

Port object

Port information of the enterprise edition. This parameter is mandatory when you create an enterprise instance.

Table 8 Port

Parameter

Mandatory

Type

Description

app_https_port

No

Integer

Parameter description: HTTPS port for application access. The default value is 443.

app_amqps_port

No

Integer

Parameter description: AMQP port for application access. The default value is 5671.

device_coap_port

No

Integer

Parameter description: CoAP port for device access. The default value is 5683.

device_coaps_port

No

Integer

Parameter description: CoAPS port for device access. The default value is 5684.

device_mqtt_port

No

Integer

Parameter description: MQTT port for device access. The default value is 1883.

device_mqtts_port

No

Integer

Parameter description: MQTTS port for device access. The default value is 8883.

device_https_port

No

Integer

Parameter description: HTTPS port for device access. The default value is 443.

Response Parameters

Status code: 200

Table 9 Response body parameters

Parameter

Type

Description

instance_type

String

Parameter description: instance type.

Options:

  • standard

  • enterprise

instance_id

String

Parameter description: instance ID.

Value: Enter up to 36 characters, including lowercase letters (a-f), digits, and hyphens (-).

name

String

Parameter description: instance name.

Value: Enter 1 to 64 characters, including letters, digits, underscores (_), and hyphens (-).

flavor

Flavor object

Parameter description: specifications of an IoTDA instance.

status

String

Parameter description: instance status.

Options:

  • CREATING: The instance is being created.

  • ACTIVE: The instance is normal.

  • FROZEN: The instance is frozen.

  • TRADING: The instance is in a transaction.

  • MODIFYING: The instance class is being changed.

  • FAILED: The instance fails to be created.

charge_info

ChargeInfo object

Parameter description: billing information of an IoTDA instance.

description

String

Parameter description: description of an IoTDA instance.

Value: The value can contain a maximum of 256 characters. Use only letters, digits, spaces, and special characters (_,.&-).

enterprise_project_id

String

Parameter description: enterprise project ID.

tags

Array of Tag objects

Parameter description: tag information of an IoTDA instance. This field has values if the instance has tags. Or, it is left empty.

order_id

String

Parameter description: order ID. This parameter is returned when a yearly/monthly instance is created. For details about how to check the order details, see [Querying Order Details]. (tag:hws)

additional_params

AdditionalParams object

Additional parameter information of the enterprise edition.

Table 10 Flavor

Parameter

Type

Description

type

String

Parameter description: specification name of the IoTDA instance to create. For details, see Specifications.

size

Integer

Parameter description: unit number of the standard IoTDA instances to create. For details, see Specifications. This parameter is mandatory when instance_type is set to standard.

Table 11 ChargeInfo

Parameter

Type

Description

charge_mode

String

Parameter description: payment mode of the instance.

Options:

  • prePaid: yearly/monthly

  • postPaid: pay-per-use

period_type

String

Parameter description: period type of the subscribed IoTDA instance. This parameter is valid and mandatory only when charge_mode is set to prePaid.

Options:

  • month

  • year

period_num

Integer

Parameter description: number of periods for subscribing to an IoTDA instance. This parameter is valid and mandatory only when charge_mode is set to prePaid.

Value: If period_type is set to month, the value ranges from 1 to 9. If period_type is set to year, the value ranges from 1 to 3.

is_auto_renew

Boolean

Parameter description: whether to automatically renew the subscription, specified during yearly/monthly instance creation. The renewal period is the same as the original period, and the payment is automatically made during the renewal.

Options:

  • true

  • false (default value)

is_auto_pay

Boolean

Parameter description: whether to automatically pay from the customer's account. This parameter can be specified when a yearly/monthly instance is created. This parameter does not affect the payment mode of automatic renewal.

Value: true: automatic payment. Fees are automatically deducted from the account balance. false: default value. Orders are submitted but not paid. [Pay for the order by referring to Paying Yearly/Monthly Product Orders or on the Huawei Cloud official website.] (tag:hws)

Table 12 Tag

Parameter

Type

Description

key

String

Parameter description: tag key. Use letters, digits, spaces, and special characters (_.:=+-@). No space is allowed at the beginning or end.

value

String

Parameter description: tag value, which can be an empty string or null. Use letters, digits, spaces, and special characters (_.:=+-@).

Table 13 AdditionalParams

Parameter

Type

Description

vpc_id

String

Parameter description: VPC ID of the instance of the enterprise edition.

subnet_id

String

Parameter description: subnet ID of the instance of the enterprise edition.

security_group_id

String

Parameter description: security group ID of the instance of the enterprise edition. Ensure that port 22 (Linux SSH login), port 3389 (Windows remote login), and ICMP (Ping) have been enabled for the selected security group.

smn_topic_urn

String

Parameter description: SMN topic URN. When an instance of the enterprise edition is successfully created, the platform sends notifications through this topic.

ciphering_algorithm

String

Parameter description: encryption algorithm supported by the instance.

Options:

  • COMMON_ALGORITHM: common encryption algorithm (international cryptographic algorithms such as RSA and SHA-256)

  • SM_ALGORITHM: SM series commercial encryption algorithms (Chinese cryptographic algorithms such as SM2, SM3, and SM4)

port_info

Port object

Port information of the enterprise edition. This parameter is mandatory when you create an enterprise instance.

Table 14 Port

Parameter

Type

Description

app_https_port

Integer

Parameter description: HTTPS port for application access. The default value is 443.

app_amqps_port

Integer

Parameter description: AMQP port for application access. The default value is 5671.

device_coap_port

Integer

Parameter description: CoAP port for device access. The default value is 5683.

device_coaps_port

Integer

Parameter description: CoAPS port for device access. The default value is 5684.

device_mqtt_port

Integer

Parameter description: MQTT port for device access. The default value is 1883.

device_mqtts_port

Integer

Parameter description: MQTTS port for device access. The default value is 8883.

device_https_port

Integer

Parameter description: HTTPS port for device access. The default value is 443.

Example Requests

  • Create an instance. Specifications: standard intermediate-frequency units, 2 units, and yearly billing.

    POST https://{endpoint}/v5/iot/{project_id}/iotda-instances
    
    {
      "instance_type" : "standard",
      "flavor" : {
        "type" : "iotda.standard.s1",
        "size" : 2
      },
      "name" : "iotda_instance",
      "charge_info" : {
        "charge_mode" : "prePaid",
        "period_type" : "year",
        "period_num" : 1,
        "is_auto_renew" : "true",
        "is_auto_pay" : "false"
      },
      "description" : "IoTDA instance for production.",
      "enterprise_project_id" : "d22e47e9-cfad-4254-8a29-d2a56a07681d",
      "tags" : [ {
        "key" : "testTagName",
        "value" : "testTagValue"
      } ]
    }
  • Create an instance. Specifications: standard intermediate-frequency units, 2 units, and pay-per-use billing.

    POST https://{endpoint}/v5/iot/{project_id}/iotda-instances
    
    {
      "instance_type" : "standard",
      "flavor" : {
        "type" : "iotda.standard.s2",
        "size" : 2
      },
      "name" : "iotda_instance",
      "charge_info" : {
        "charge_mode" : "postPaid"
      },
      "description" : "IoTDA instance for production.",
      "enterprise_project_id" : "d22e47e9-cfad-4254-8a29-d2a56a07681d"
    }
  • Create an instance. Specifications: enterprise edition and yearly billing.

    POST https://{endpoint}/v5/iot/{project_id}/iotda-instances
    
    {
      "instance_type" : "enterprise",
      "flavor" : {
        "type" : "iotda.enterprise.1000tps.10wonlinedevice"
      },
      "name" : "iotda_enterprise_instance",
      "charge_info" : {
        "charge_mode" : "prePaid",
        "period_type" : "year",
        "period_num" : 1,
        "is_auto_renew" : "true",
        "is_auto_pay" : "false"
      },
      "description" : "IoTDA instance for production.",
      "enterprise_project_id" : "d22e47e9-cfad-4254-8a29-d2a56a07681d",
      "additional_params" : {
        "vpc_id" : "40926909-d411-45dd-a8b4-1ebc36512345",
        "subnet_id" : "088c7d8a-f49e-4f5f-bd33-ce9b6b712345",
        "security_group_id" : "55980b43-f006-4dbf-ab58-9b0d9e712345",
        "smn_topic_urn" : "urn:smn:cn-north-7:08aaee8ae000d5182f26c00199812345:iotda_instance_create",
        "ciphering_algorithm" : "COMMON_ALGORITHM",
        "port_info" : {
          "app_https_port" : "443",
          "app_amqps_port" : "5671",
          "device_coap_port" : "5683",
          "device_coaps_port" : "5684",
          "device_mqtt_port" : "1883",
          "device_mqtts_port" : "8883",
          "device_https_port" : "443"
        }
      }
    }

Example Responses

Status code: 200

OK

{
  "instance_type" : "standard",
  "instance_id" : "8561675c-d8a3-4956-9884-9cf9cbdd3134",
  "flavor" : {
    "type" : "iotda.standard.s2",
    "size" : 2
  },
  "status" : "CREATING",
  "charge_info" : {
    "charge_mode" : "prePaid",
    "period_type" : "year",
    "period_num" : 1,
    "is_auto_renew" : true,
    "is_auto_pay" : false
  },
  "description" : "IoTDA instance for production.",
  "enterprise_project_id" : "d22e47e9-cfad-4254-8a29-d2a56a07681d",
  "tags" : [ {
    "key" : "testTagName",
    "value" : "testTagValue"
  } ],
  "order_id" : "CS22121614500ABCD",
  "additional_params" : null
}

Status Codes

Status Code

Description

200

OK

400

Bad Request

401

Unauthorized

403

Forbidden

Error Codes

See Error Codes.