【发布时间】:2020-03-02 09:16:24
【问题描述】:
我正在尝试在 AWS IoT 中为我的 CA 证书添加registrationConfig。我想对事物属性的数据进行一些操作。但是,如果模板正文中包含 Fn::Join,我似乎无法让该 JITP 工作。
以下是模板正文的摘录(为了阅读目的,字符串未转义)
不工作:
"Resources": {
"thing": {
"Type": "AWS::IoT::Thing",
"Properties": {
"ThingName": {
"Ref": "AWS::IoT::Certificate::CommonName"
},
"ThingTypeName" : "w2-device",
"ThingGroups" : ["w2-devices"],
"AttributePayload": {
"location": {
"Fn::Join":["",["ThingPrefix_",{"Ref":"SerialNumber"}]]
},
"organization": {
"Ref": "AWS::IoT::Certificate::Organization"
},
"version": "w2",
"country": {
"Ref": "AWS::IoT::Certificate::Country"
}
}
}
},
在上面,当我在 AttributePayload/location 中有 Fn::Join 时,它无法在 JITP 期间创建事物。我也没有在 CloudWatch 中看到任何错误。
工作:
"Resources": {
"thing": {
"Type": "AWS::IoT::Thing",
"Properties": {
"ThingName": {
"Ref": "AWS::IoT::Certificate::CommonName"
},
"ThingTypeName" : "w2-device",
"ThingGroups" : ["w2-devices"],
"AttributePayload": {
"location": {
"Ref": "AWS::IoT::Certificate::StateName"
},
"organization": {
"Ref": "AWS::IoT::Certificate::Organization"
},
"version": "w2",
"country": {
"Ref": "AWS::IoT::Certificate::Country"
}
}
}
},
注意:我也在aws forum 中问过这个问题,但还没有任何答案。
【问题讨论】:
-
如果参数中有
SerialNumber和/或使用完整参考AWS::IoT::Certificate::SerialNumber会怎样?您的模板与docs.aws.amazon.com/iot/latest/developerguide/… 的示例有多接近? -
与该页面中的示例非常相似。参考 AWS::IoT::Certificate::SerialNumber 有效。
-
我添加了一个答案,描述了
AWS::IoT::Certificate::SerialNumber工作的原因
标签: aws-iot