provision by claim with same ThingName

0

Hello there AWS team!

I'm doing provision by claim with the ESP32. Everything works as expected. I send a SerialNumber in the parameters and AWS created a ThingName with that SerialNumber.

Problem: What happens if I send a SerialNumber that is already created in aws iot core? I want AWS to reply to me back with a "fail" message or something like that.

In this post: https://docs.aws.amazon.com/iot/latest/developerguide/provision-template.html I can see that is done with the OverrideSettings. I'm trying adding "ThingName" : FAIL in the OverrideSettings but it seems it is not doable.

I'm on the right track or I'm missing something?

Thanks a lot in advance

질문됨 일 년 전330회 조회
1개 답변
0

Can you please share your template if possible here, did you try something like below? example ** "ThingTypeName": "FAIL",**

{
  "Resources": {
    "thing": {
      "Type": "AWS::IoT::Thing",
      "Properties": {
        "ThingName": {
          "Ref": "ThingName"
        },
        "AttributePayload": {
          "version": "v1",
          "serialNumber": {
            "Ref": "SerialNumber"
          }
        },
        "ThingTypeName": "lightBulb-versionA",
        "ThingGroups": [
          "v1-lightbulbs",
          {
            "Ref": "Location"
          }
        ]
      },
      "OverrideSettings": {
        "AttributePayload": "MERGE",
       ** "ThingTypeName": "FAIL",**
        "ThingGroups": "DO_NOTHING"
      }
    },
    "policy": {
      "Type": "AWS::IoT::Policy",
      "Properties": {
        "PolicyDocument": "{ \"Version\": \"2012-10-17\", \"Statement\": [{ \"Effect\": \"Allow\", \"Action\":[\"iot:Publish\"], \"Resource\": [\"arn:aws:iot:us-east-1:123456789012:topic/foo/bar\"] }] }"
      }
    }
  }
}
profile pictureAWS
전문가
답변함 일 년 전
  • the JSON is the default in the fleet provisioning by default.

    I tried that option but it doesn't work because is thingtypename is different than thingname. It seems the correct way to do it is with a lambda function

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠