Internet of Things, a term coined by the British technology pioneer Kevin Ashton, back in 1999 has now become one of the hottest topics in tech. However, 20 years have passed, and considering the rate of change in the world of technology, the current state of IoT’s mass acceptance is quite dismal.
Nevertheless, current changes and developments in the industry are showing the potential to boost IoT adoption. Emerging technologies such as the serverless Lambda function and lightweight GraphQL querying concept are breaking down the barriers that currently stand in the way of IoT’s full adoption in the industry. However, the potential of a serverless platform for IoT systems, with GraphQL backed querying of data stores, is not fully recognized. One of the major reasons is the lack of literature and samples in the community. This greatly impedes the ability of the tech community to easily incorporate IoT devices with cloud compute services, especially serverless services with their multitude of benefits.
Therefore, taking into consideration the sparse and scattered resources on the topic, the purpose of this piece is to consolidate the bare-bone knowledge to provide a platform for like-minded IoT developers and enthusiasts to launch from. The end goal is a beginners guide demonstrating the simulation of an IoT system, connecting it to the cloud and supporting it on a serverless compute platform.
The Technology Stack
Considering the capabilities of Node-Red, there is a multitude of Node types, ranging from basic input Nodes to advanced Nodes that monitor changes in file systems. As a result, one can simply drag and drop these nodes to build an IoT system.
Some of the most common nodes that can be used are as listed below:
AWS IoT is the IoT service provided by AWS. Simply put it allows you to connect an IoT thing to all the goodies in the cloud. One of those benefits involves AWS Lambda, the poster boy FaaS service in the field of serverless. Connecting IoT devices to serverless compute platforms means that your entire architecture can now benefit from the principles of serverless. This includes the following:
- The abstraction of server responsibility.
- Pay-as-you-go model
Therefore, you can now fully focus on building your IoT device and worry little about the operations of the compute capabilities and potentially reduce cost by paying for only the resources that you use.
The allure of serverless AWS Lambda is one of the main motivations of deploying your IoT architecture with AWS IoT. By benefitting from the potentially lower costs of serverless, and the ease of operations across the AWS stack, the adoption of IoT can further be advanced.
The reason why AWS IoT is greatly preferred is because any traffic that can be received by your IoT device can be routed to another AWS resource depending on the IoT rules created. This involves serverless Lambda functions. The AWS console allows you to create your Lambda function as you go about creating the AWS IoT rule to route incoming messages from your Node-Red MQTT broker to the AWS Lambda function.
AWS Lambda is not the only service to which IoT traffic can be routed to via these IoT rules. There are 16 services in total that can be facilitated by AWS IoT rules. Hence increasing the scope of our IoT capabilities and impact. All of this only requires a few basic configurations.
A Wider Impact with AWS Lambda
Using AWS IoT and Node-Red we can quickly build and connect IoT systems to the cloud. However, the main motive of doing so is to process out IoT traffic on AWS Lambda functions. This is because there are several benefits of AWS Lambda that can propel the development of IoT systems.
One of the major benefits as already stated is the serverless factor. one of the most important benefits of serverless is the pricing model, where you pay for only those resources you consume at a specific time. That means if one IoT device is not being used, it will not be billed just because it is still available.
Additionally, with AWS Lambda, you can practically interact with any other service, all with minimal configuration, thanks to a lot of the complexity being abstracted away. For example we can go much further and communicate with many other AWS resources. One such service could be AWS AppSync, allowing us to have a GraphQL query-based data store. The benefits of connecting GraphQL with IoT have already been explored, demonstrating better performance and reliability for your IoT systems.
The current developing technology such as AWS Lambda functions and the cloud, in general, have been very successful in abstracting complexity away from the vendors. One of the major barriers to IoT was the difficulty of setting up the network and compute architecture. However, as discussed, that no longer is the status quo.
Thanks to Node-Red and AWS IoT, building an IoT system and wiring up all its components has now become easier than ever. This ease in complexity acts as a major push for IoT adoption. However, another major advantage is the ability to benefit from the serverless stack of AWS, especially AWS Lambda.
Now all that remains is a detailed guide demonstrating the building of an IoT system in Node-Red, connecting it with AWS IoT and routing traffic to a dedicated Lambda. So stay tuned!