AWS CloudFormation
User Guide (API Version 2010-05-15)
AWS 服务或AWS文档中描述的功能,可能因地区/位置而异。请点击 Amazon AWS 入门,可查看中国地区的具体差异

AWS::IoT::Thing

使用 AWS::IoT::Thing 资源声明 AWS IoT 事务。

有关使用事务的信息,请参阅 AWS IoT 开发人员指南 中的 AWS IoT 工作原理AWS IoT 设备注册表

语法

JSON

{ "Type": "AWS::IoT::Thing", "Properties": { "AttributePayload": AttributePayload "ThingName": String } }

YAML

Type: "AWS::IoT::Thing" Properties: AttributePayload: AttributePayload ThingName: String

属性

AttributePayload

属性有效负载。

Required: No

Type: AWS IoT Thing AttributePayload

更新要求无需中断

ThingName

AWS IoT 事务的名称(物理 ID)。

Required: No

Type: String

更新要求替换

返回值

Ref

当向 Ref 内部函数提供此资源的逻辑 ID 时,Ref 将返回事务名称。例如:

{ "Ref": "MyThing" }

对于名为 MyStack 的堆栈,将返回与以下值类似的值:

MyStack-MyThing-AB1CDEFGHIJK

有关使用 Ref 功能的更多信息,请参阅参考

示例

以下示例将声明事务及其属性的值。

JSON

{ "AWSTemplateFormatVersion": "2010-09-09", "Resources": { "MyThing": { "Type": "AWS::IoT::Thing", "Properties": { "ThingName": { "Ref": "NameParameter" }, "AttributePayload": { "Attributes": { "myAttributeA": { "Ref": "MyAttributeValueA" }, "myAttributeB": { "Ref": "MyAttributeValueB" }, "myAttributeC": { "Ref": "MyAttributeValueC" } } } } } }, "Parameters": { "NameParameter": { "Type": "String" }, "MyAttributeValueA": { "Type": "String", "Default": "myStringA123" }, "MyAttributeValueB": { "Type": "String", "Default": "myStringB123" }, "MyAttributeValueC": { "Type": "String", "Default": "myStringC123" } } }

YAML

AWSTemplateFormatVersion: "2010-09-09" Resources: MyThing: Type: "AWS::IoT::Thing" Properties: ThingName: Ref: "NameParameter" AttributePayload: Attributes: myAttributeA: Ref: "MyAttributeValueA" myAttributeB: Ref: "MyAttributeValueB" myAttributeC: Ref: "MyAttributeValueC" Parameters: NameParameter: Type: "String" MyAttributeValueA: Type: "String" Default: "myStringA123" MyAttributeValueB: Type: "String" Default: "myStringB123" MyAttributeValueC: Type: "String" Default: "myStringC123"

本页内容: