Through Node-RED, you create a program (called a flow) using supplied building blocks (called nodes). Within the browser, Node-RED presents a canvas area alongside a palette of available nodes. You then drag and drop nodes from the palette onto the canvas and link those nodes together by drawing connecting wires. The flow describes the desired logic to be performed by specifying the steps and their execution order, and can then be deployed to the Node-RED execution engine.
One of the key features that has made Node-RED successful is its ability to be easily extended with additional custom nodes. Whenever a new API or technology becomes available, it can be encapsulated as a new Node-RED node and added to the list of available nodes found in the palette. From the palette, it can then be added into a flow for use in exactly the same way that the base supplied nodes are used. These additional nodes can then be published by their authors as contributions to the Node-RED community and made available for use in other projects. There is a searchable and indexed catalog of contributed Node-RED nodes.
A node hides how it internally operates and exposes a clean consumable interface allowing the new function to be used faster.
Now, let’s take a look at how to run Node-RED on GCP and use it with GCP services.
You can use the Node Package Manager (
npm) to install Node-RED on any environment that has a Node.JS runtime. For GCP, this includes Compute Engine, Google Kubernetes Engine (GKE), Cloud Run, Cloud Shell as well as other GCP environments. There’s also a publically available Docker image, which is what we’ll use for this example.
Now, let’s create a Compute Engine instance using the Google Cloud Console and specify the public Node-RED docker image for execution.
Visit the Cloud Console and navigate to Compute Engine. Create a new Compute Engine instance. Check the box labeled “
Deploy a container image to this VM instance“. Enter “
nodered/node-red” for the name of the container image: