Real-time monitoring of IoT sensor data

0

Hi,

Is there any standard architectural pattern (with code sample) that I can use for monitoring real-time sensor data in a web app?

I found this for monitoring real-time sensor data in mobile apps. https://aws.amazon.com/blogs/mobile/iot-with-aws-appsync/

Regards, Ashish

3 Answers
1

These links would also help and give you some ideas:

The filters on the right will help to find a better match here: https://aws.amazon.com/iot/blog/

https://aws.amazon.com/blogs/architecture/category/internet-of-things/aws-iot-analytics/

Kishan
answered 2 years ago
1

Hi Ashish. AppSync is one of the major options to consider for real-time applications. That blog and code should be relatively easy to apply to a web application instead of mobile.

One of the main alternatives (for real-time data) to AppSync is to have your application publish and subscribe directly to AWS IoT Core. This is often best achieved using the Amplify pubsub library. You could also use one of the AWS IoT Device SDKs instead. This example uses Amplify and Cognito to authenticate and retrieve credentials, but then the IoT Device SDK to publish and subscribe: https://github.com/aws-samples/aws-amplify-react-iot-pub-sub-using-cp

profile pictureAWS
EXPERT
Greg_B
answered 2 years ago
0

Thanks Greg_B for your reply. On following the same lines, I found this blog for implementing a React web app to monitor real-time sensor data. https://theskenengineering.com/building-a-react-js-app-with-aws-iot/ I think it mentions the same steps as mentiond in Amplify PubSub tutorial. https://docs.amplify.aws/lib/pubsub/getting-started/q/platform/js/

But I am still not able to see real-time data when publishing from AWS IoT Core test client.

Can you help me with this? Question 1: When we create the policy how do I get the resource arn to be filled in the Resource ARN field?

Question 2: I am getting this error in browser console logs for React app. I think this error comes when IoT Policy is not properly attached. Error: 'AMQJS0008I Socket closed.'

Any guidance on this would be helpful?

Regards, Ashish

answered 2 years ago
  • Hi Ashish. The policy in the tutorial has placeholders for the Account ID and region. You can find this information by clicking your IAM user name and region near the top right corner of the screen when in the AWS Management Console. For example, if your region is N. Virginia, then it's us-east-1. Your account ID is a 12-digit number. So the resource ARN ends up looking something like arn:aws:iot:us-east-1:012345678901:*

  • The policy in the tutorial is very permissive and not intended for production. You should create a least privilege policy in due course: https://docs.aws.amazon.com/iot/latest/developerguide/example-iot-policies.html

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