Should IoT things be used as an AppSync data source?

0

Our system has IoT things (devices), and a web frontend in Amplify. An example user story in the browser: "Search for a device by the county it belongs to, then show all telemetry readings created by this device."

For storage, the county could be an Attribute on the Thing. Telemetry readings could be DynamoDB Items in a Table.

It would seem that the solution would be an AppSync query layer which queries both DynamoDB, and a custom lambda which queries the IoT registry.

Questions: Is splitting data sources an antipattern? It feels like leveraging the IoT registry for business logic queries isn't intended.

Is there a better AppSync resolver strategy? I don't like adding extra layers that require maintenance and monitoring. In this case, the lambda to translate queries and the AppSync queries.

This feels like it should be a very common scenario, but I haven't found solutions for dynamic data access to IoT things in an application.

1 Answer
1
Accepted Answer

I agree with you - splitting data sources (DynamoDB and IoT registry) with AppSync and a Lambda function is not necessarily an anti-pattern, but it can add complexity. Potential Performance Impact.

Alternative Solution Options:

1/ AWS IoT Core Thing Groups

Leverage AWS IoT Core Thing Groups to categorize devices by county (attribute).

Store telemetry readings directly in DynamoDB with a foreign key referencing the Thing Group (county).

Use AppSync resolvers to directly query DynamoDB based on county (Thing Group) and filter telemetry readings for the specific device ID.

Cons : Requires additional configuration and management of Thing Groups.

2/ Or Maybe

Combine Thing Groups for coarse-grained filtering by county.

Use GSIs(Global Secondary Indexes) within DynamoDB for efficient retrieval of specific device telemetry data.

Remember, there's no one-size-fits-all solution.

Evaluate your specific needs and choose the approach that offers the best balance between simplicity, performance, and cost.

profile pictureAWS
cloudyy
answered 4 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions