简体   繁体   English

AWS IOT-列出事物Cognito用户特定

[英]AWS IOT - List Things Cognito user specific

I want to list the IOT things on a UI logged in with AWS Cognito. 我想在使用AWS Cognito登录的UI上列出IOT内容。 A user can create an IOT thing and should be able to see the IOT thing created by that user only and not by other users. 用户可以创建物联网事物,并且应该只能看到该用户而非其他用户创建的物联网事物。

There are couple of ways to do that, one way would be creating an IoT group for each user and whenever the user add new IoT device, it should be added to that group. 有两种方法可以做到这一点,一种方法是为每个用户创建一个IoT组,每当用户添加新的IoT设备时,都应将其添加到该组中。 In this way you can then get the list of all things which are in the same group using AWS IoT SDKs. 这样,您便可以使用AWS IoT SDK获得同一组中所有事物的列表。 For example, by using AWS SDK for Python (Boto) you can get the list of things in an specific group using list_things_in_thing_group command, you can find more information here . 例如,通过使用适用于Python的AWS开发工具包(Boto),您可以使用list_things_in_thing_group命令获取特定组中的事物列表,您可以在此处找到更多信息。 The other way would be using name/value pair for each IoT thing, say name: [user] . 另一种方法是为每个物联网事物使用名称/值对,例如name: [user] You can then filter things with this pair and list the things that created by specific user. 然后,您可以使用该对过滤内容并列出由特定用户创建的内容。 The third way would be saving the name of IoT devices created by each user in databases (like DynamoDB, RDS,...) and list them on UI. 第三种方法是将每个用户创建的IoT设备的名称保存在数据库中(例如DynamoDB,RDS等),并在UI上列出它们。 Although, for all of these ways, you should consider the correct policy for users. 尽管对于所有这些方式,您都应该为用户考虑正确的策略。

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

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