CloudFormation模板中的Thing类型

时间:2017-10-31 23:24:04

标签: amazon-cloudformation aws-iot

documentation中,有一种在AWS IoT中创建内容的语法,但我找不到如何将其连接到Things Type。有可能像这样写吗?

AWSTemplateFormatVersion: "2010-09-09"
Resources: 
  MyThing: 
    Type: "AWS::IoT::Thing"
    Properties: 
      ThingName: "coffeemachine-12"
      ThingType: "coffeemachine"
      AttributePayload: 
        Attributes: 
          temp: "celcius"

如何在AWS CloudFormation模板中配置/创建AWS IoT Thing类型?

2 个答案:

答案 0 :(得分:1)

您目前无法通过CloudFormation管理事物类型。但是,您可以在创建事物时引用现有的事物类型。

事物类型的语义不适合通过CloudFormation实现自动化。例如:

  • 他们是不可改变的
  • 删除需要弃用,然后是5分钟的冷却期。

这无疑是CloudFormation不支持的原因。

答案 1 :(得分:-1)

您是否在询问如何在更新CloudFormation堆栈时配置ThingType?

如果是这样,您可能想要执行以下操作:

Parameters:
  ThingType:
    Description: 'Description for ThingType'
    Type: String

Resources: 
  MyThing: 
    Type: "AWS::IoT::Thing"
    Properties: 
      ThingName: "coffeemachine-12"
      ThingType: !Ref ThingType
      AttributePayload: 
        Attributes: 
          temp: "celcius"

基本上,您将ThingType声明为参数,并在创建资源时添加对此变量的引用。

希望有所帮助