简体   繁体   English

如何更新AWS IoT中的事物证书?

[英]How to update a thing certificate in AWS IoT?

How do I update the certificate of an existing Thing in AWS IoT, assuming I know the thing name and an attribute with the same value? 如何更新AWS IoT中现有Thing的证书,假设我知道事物名称和具有相同值的属性? Ie the thing has name "foo" and attribute "id=foo" . 即事物的名称为"foo" ,属性为"id=foo"

From the limited documentation, I'm assuming I do something like: 从有限的文档中,我假设我做了类似的事情:

Can anyone confirm the correct, most succinct way to do this? 任何人都可以确认正确,最简洁的方法吗?

I welcome better solutions, but this worked for me: 我欢迎更好的解决方案,但这对我有用:

  1. Call RegisterThing again (same ThingName, same policy, different cert). 再次调用RegisterThing (相同的ThingName,相同的策略,不同的证书)。 This seems to attach a new certificate to my thing. 这似乎附加了我的东西的新证书。
  2. Called ListThingPrincipals , filtering on ThingName. 调用ListThingPrincipals ,过滤ThingName。 The result will be a list of ARNs representing the certificates associated with the thing, of the form arn:aws:iot:<region>:<account id>:cert/<cert id> . 结果将是表示与该事物相关联的证书的ARN列表,形式为arn:aws:iot:<region>:<account id>:cert/<cert id>
  3. Iterative through the list, strip out the certificate id and call DescribeCertificate , with the certificate id as parameter. 迭代列表,删除证书ID并调用DescribeCertificate ,并将证书ID作为参数。
  4. Compare the result (which includes the PEM form of the certificate) with the new certificate. 将结果(包括证书的PEM形式)与新证书进行比较。 If it's not a match, this is one of the previous certificates. 如果它不匹配,这是以前的证书之一。 Consequently, call UpdateCertificate and mark that certificate as INACTIVE . 因此,请调用UpdateCertificate并将该证书标记为INACTIVE

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM