AWS CloudFormation
User Guide (Version )

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

To declare this entity in your AWS CloudFormation template, use the following syntax:

JSON

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

YAML

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

Properties

AttributePayload

A string that contains up to three key–value pairs. Maximum length of 800. Duplicates not allowed.

Required: No

Type: AttributePayload

Update requires: No interruption

ThingName

The name of the thing to update.

Required: No

Type: String

Update requires: Replacement

Return Values

Ref

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

{ "Ref": "MyThing" }

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

MyStack-MyThing-AB1CDEFGHIJK

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

Examples

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

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"