Menu
AWS CloudFormation
User Guide (API Version 2010-05-15)

AWS::IoT::Thing

Use the AWS::IoT::Thing resource to declare an AWS IoT thing.

For information about working with things, see How AWS IoT Works and Device Registry for AWS IoT in the AWS IoT Developer Guide.

Syntax

JSON

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

YAML

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

Properties

AttributePayload

A JSON string that contains up to three key-value pairs, for example: { "attributes": { "string1":"string2" } }.

Required: No

Type: String to string map

Update requires: No interruption

ThingName

The name (the physical ID) of the AWS IoT thing.

Required: No

Type: String

Update requires: Replacement

Return Value

Ref

When you provide the logical ID of this resource to the Ref intrinsic function, Ref returns the thing name. For example:

Copy
{ "Ref": "MyThing" }

For a stack named MyStack, a value similar to the following is returned:

Copy
MyStack-MyThing-AB1CDEFGHIJK

For more information about using the Ref function, see Ref.

Example

The following example declares a thing and the values of its attributes.

JSON

Copy
{ "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

Copy
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"