ALIYUN::IOT::Device类型用于注册设备。

阿里云支持在以下地域注册设备:
  • 中国(上海)
  • 新加坡
  • 日本(东京)
  • 德国(法兰克福)
  • 美国(硅谷)
  • 美国(弗吉尼亚)

语法

{
  "Type": "ALIYUN::IOT::Device",
  "Properties": {
    "DeviceName": String,
    "IotInstanceId": String,
    "ProductKey": String,
    "PinCode": String,
    "DevEui": String,
    "Nickname": String
  }
}

属性

属性名称 类型 必须 允许更新 描述 约束
DeviceName String 待注册设备的名称。如果不指定该参数,则由系统随机生成设备名称。 长度为4~32个字符,可包含英文字母、数字和以下特殊字符:

-._@:

DeviceName通常与ProductKey组合使用,用作设备标识。
IotInstanceId String 实例ID 公共实例不指定此参数
ProductKey String 待注册设备所属产品的ProductKey。ProductKey是物联网平台为新建产品颁发的产品的标识符,是全局唯一标识符。您可以在物联网平台控制台查看或调用QueryProductList查看当前账号下所有产品的信息。
PinCode String LoRaWAN设备的PIN Code,用于校验DevEUI的合法性。 创建LoRaWAN设备时,该参数必须指定。
DevEui String LoRaWAN设备的DevEUI 创建LoRaWAN设备时,该参数必须指定。
Nickname String 待注册设备的备注名称。如果不指定该参数,系统不会为设备生成备注名称。 长度为4~64个字符,可包含汉字、大写字母、小写字母、数字和下划线(_)。
说明 一个汉字占2个字符。

返回值

Fn::GetAtt

  • DeviceName:设备名称。
  • NodeType:产品的节点类型。
  • IotInstanceId:实例ID。
  • ProductKey:设备所属产品的ProductKey。
  • NickName:备注名称。
  • IotId:物联网平台为该设备颁发的设备ID,作为该设备的唯一标识符。
  • ProductName:产品的名称。
  • DeviceSecret:设备密钥。
  • IpAddress:IP地址。

示例

JSON格式

{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Resources": {
    "Device": {
      "Type": "ALIYUN::IOT::Device",
      "Properties": {
        "DeviceName": {
          "Ref": "DeviceName"
        },
        "IotInstanceId": {
          "Ref": "IotInstanceId"
        },
        "ProductKey": {
          "Ref": "ProductKey"
        },
        "PinCode": {
          "Ref": "PinCode"
        },
        "DevEui": {
          "Ref": "DevEui"
        },
        "Nickname": {
          "Ref": "Nickname"
        }
      }
    }
  },
  "Parameters": {
    "DeviceName": {
      "Type": "String",
      "Description": "The name of the device that you want to register. The device name must consist of\n4 to 32 characters, including English letters, digits, and special characters, for\nexample, hyphens (-), underscores (_), at signs (@), periods (.) , and colons (:).\nDeviceName is used with ProductKey to identify a specified device.\nNote If you do not specify this parameter, the system will generate a name for the device."
    },
    "IotInstanceId": {
      "Type": "String",
      "Description": "Public instance does not pass this parameter; instance that you need to buy the incoming instance ID."
    },
    "ProductKey": {
      "Type": "String",
      "Description": "The identifier of the product to which the device to be registered belongs."
    },
    "PinCode": {
      "Type": "String",
      "Description": "PIN Code LoRaWAN device for checking the legitimacy of DevEUI.\nWhen you create a LoRaWAN devices, this will pass."
    },
    "DevEui": {
      "Type": "String",
      "Description": "DevEUI LoRaWAN equipment.\nWhen you create a LoRaWAN devices, this will pass."
    },
    "Nickname": {
      "Type": "String",
      "Description": "Add a nickname for the device. A nickname can be 4-64 characters in length, and can\ncontain Chinese characters, English letters, numbers and underscores (_). A Chinese\ncharacter counts as two characters."
    }
  },
  "Outputs": {
    "DeviceName": {
      "Description": "Device name.",
      "Value": {
        "Fn::GetAtt": [
          "Device",
          "DeviceName"
        ]
      }
    },
    "NodeType": {
      "Description": "Node type.",
      "Value": {
        "Fn::GetAtt": [
          "Device",
          "NodeType"
        ]
      }
    },
    "IotInstanceId": {
      "Description": "IOT instance ID.",
      "Value": {
        "Fn::GetAtt": [
          "Device",
          "IotInstanceId"
        ]
      }
    },
    "ProductKey": {
      "Description": "Product key.",
      "Value": {
        "Fn::GetAtt": [
          "Device",
          "ProductKey"
        ]
      }
    },
    "IpAddress": {
      "Description": "IP address.",
      "Value": {
        "Fn::GetAtt": [
          "Device",
          "IpAddress"
        ]
      }
    },
    "DeviceSecret": {
      "Description": "Device key.",
      "Value": {
        "Fn::GetAtt": [
          "Device",
          "DeviceSecret"
        ]
      }
    },
    "ProductName": {
      "Description": "Product name.",
      "Value": {
        "Fn::GetAtt": [
          "Device",
          "ProductName"
        ]
      }
    },
    "IotId": {
      "Description": "Things internet device ID issued for the device, as the unique identifier of the device.\nDescription Keep, do not leak.",
      "Value": {
        "Fn::GetAtt": [
          "Device",
          "IotId"
        ]
      }
    },
    "NickName": {
      "Description": "Nick name.",
      "Value": {
        "Fn::GetAtt": [
          "Device",
          "NickName"
        ]
      }
    }
  }
}

YAML格式

ROSTemplateFormatVersion: '2015-09-01'
Resources:
  Device:
    Type: 'ALIYUN::IOT::Device'
    Properties:
      DeviceName:
        Ref: DeviceName
      IotInstanceId:
        Ref: IotInstanceId
      ProductKey:
        Ref: ProductKey
      PinCode:
        Ref: PinCode
      DevEui:
        Ref: DevEui
      Nickname:
        Ref: Nickname
Parameters:
  DeviceName:
    Type: String
    Description: >-
      The name of the device that you want to register. The device name must
      consist of

      4 to 32 characters, including English letters, digits, and special
      characters, for

      example, hyphens (-), underscores (_), at signs (@), periods (.) , and
      colons (:).

      DeviceName is used with ProductKey to identify a specified device.

      Note If you do not specify this parameter, the system will generate a name
      for the device.
  IotInstanceId:
    Type: String
    Description: >-
      Public instance does not pass this parameter; instance that you need to
      buy the incoming instance ID.
  ProductKey:
    Type: String
    Description: >-
      The identifier of the product to which the device to be registered
      belongs.
  PinCode:
    Type: String
    Description: |-
      PIN Code LoRaWAN device for checking the legitimacy of DevEUI.
      When you create a LoRaWAN devices, this will pass.
  DevEui:
    Type: String
    Description: |-
      DevEUI LoRaWAN equipment.
      When you create a LoRaWAN devices, this will pass.
  Nickname:
    Type: String
    Description: >-
      Add a nickname for the device. A nickname can be 4-64 characters in
      length, and can

      contain Chinese characters, English letters, numbers and underscores (_).
      A Chinese

      character counts as two characters.
Outputs:
  DeviceName:
    Description: Device name.
    Value:
      'Fn::GetAtt':
        - Device
        - DeviceName
  NodeType:
    Description: Node type.
    Value:
      'Fn::GetAtt':
        - Device
        - NodeType
  IotInstanceId:
    Description: IOT instance ID.
    Value:
      'Fn::GetAtt':
        - Device
        - IotInstanceId
  ProductKey:
    Description: Product key.
    Value:
      'Fn::GetAtt':
        - Device
        - ProductKey
  IpAddress:
    Description: IP address.
    Value:
      'Fn::GetAtt':
        - Device
        - IpAddress
  DeviceSecret:
    Description: Device key.
    Value:
      'Fn::GetAtt':
        - Device
        - DeviceSecret
  ProductName:
    Description: Product name.
    Value:
      'Fn::GetAtt':
        - Device
        - ProductName
  IotId:
    Description: >-
      Things internet device ID issued for the device, as the unique identifier
      of the device.

      Description Keep, do not leak.
    Value:
      'Fn::GetAtt':
        - Device
        - IotId
  NickName:
    Description: Nick name.
    Value:
      'Fn::GetAtt':
        - Device
        - NickName