Create virtual Node on EC2 with Data Simulator
This guide walks you through all the required steps to register a virtual node on EC2 and deploy an edge application with simulated input data.
If you don't have any edge hardware or a Raspberry Pi at hand, you can of course also use any cloud computing service like AWS EC2 or Linode to set up what we call a "virtual" node.
On this node, you can deploy the same applications as you would on real edge computing hardware, however, of course, the input requirements might be different since you wouldn't have any real sensors connected.
For testing and trial purposes, weeve has a data simulation module in the portfolio that let's you explore all capabilities of the platform without the need to onboard and connect to real sensor data and hardware.
For this guide, we will work with AWS EC2, but you can of course use any other provider of your preference.
Log in to your AWS account and navigate to the EC2 Management Console. Find and click "Launch Instance" on this page.
Launch an EC2 Instance set up
Give your instance a unique name, select the OS you want to run on your instance (we go with Debian for now), and select your instance type (t2.micro should do the job for most cases), select or create a new key pair (this will be needed later to SSH into the instance), make sure SSH traffic is ticked and you are good to go!
- 1.Open an SSH client (Terminal e.g.)
- 2.Locate your private key file (xxxx.pem)
- 3.Run this command, if necessary, to ensure your key is not publicly viewable.
$ chmod 400 'add the path to xxxx.pem'
4. Connect to your instance using its Public DNS. You will find this address on the instance page.
Instance overview page
You can also find a detailed guide by selecting "Connect" from the top menu of your instance page.
After successfully connecting to the instance via SSH, we first need to install the Docker to make weeve work on this instance. You can follow this guide to do so:
Run this command to make sure that docker is installed successfully:
$ sudo docker run hello-world
Now, everything is set up to register this instance as a node to your Workspace and install the weeve Agent on it. You can follow the steps in this video. Even though we show how you would do it on a Raspberry Pi, the steps are similar. However, in the case of copying the configuration to the instance, we would recommend creating a new file instead (sudo nano agent-config.json) on the instance and copying the content of the agent-config.json file rather than moving it with "scp". But this is up to you!
How to add a Node?
After running the installer, your EC2 Instance should show up as "Connected" in the list of Nodes in the weeve Manager:
List of Nodes
Use case: I want to collect sensor data in a way that a data spreadsheet is generated for when temperature is greater than 20.
Steps to create an Edge Application with Data Simulator -
- 1.Go to the Edge Application Builder
- 2.Drag and connect the DHT sensor simulator as the Input module, Comparison filter as the Processing module and Airtable as the Output module onto the canvas.
- 3.The next step is to configure the DHT sensor simulator. Set the Temperature Input label as 'temperature'. Ignore the Humidity label, since we are focusing on only getting temperature values in this example. Also, set the Data send interval as 5 seconds. Then click Apply button to save the changes.
- 4.To configure the Comparison filter, set the Input label the same as the output from the previous module i.e. 'temperature'. The condition should be 'greater than' and the comparison value should be 20. So, it will filter temperature values greater than 20. Then click Apply button to save the changes.
- 5.Lastly, we will configure the Airtable output module. We would need to know three values which are Airtable Base ID, API Key and Data Table ID.The base URL on Airtable will look something like this airtable.com/appxxxxxxxxx/tblyyyyyyyyy/viwqAsforVxYwcvbc?blocks=hide In between each backslash, you will find a string that identifies the Base ID and Table ID.- Airtable Base ID: Base IDs begin with "app"- Table ID: Table IDs begin with "tbl"- API Key: To find your API key, navigate to your account page. On your account overview page, under the API heading, there's a button that says "Generate API key."
- 6.Assign a name to your Edge Application and then Save it.
- 7.When the Edge Application is saved, you can then click on Select Nodes for Deployment to deploy this Edge Application, e.g. to your virtual edge. Check your Airtable DB and see the data flowing in.