Recently we posted an article
to the balena blog on Google's retirement of its IoT Core product, which is scheduled for August 2023. For a user of IoT Core, one way to adapt is to keep using Google Cloud, but replace only the IoT Core functionality. ClearBlade
provides such a replacement, including a migration tool. This article describes how we used ClearBlade IoT Core to replace Google IoT Core in balena's own Cloud Relay tool.
Cloud Relay uses only the telemetry feature of IoT Core to send event messages from a balena device to Google Pub/Sub. See ClearBlade's documentation for more on configuration
, and command
support, and differences
with Google IoT Core.
IoT Core summary
IoT Core provides three main services for Cloud Relay: secure, scalable messaging, a device registry, and integration with Google Cloud via Pub/Sub. The device registry stores the public key for each device to validate device identity. Google also provides other organizational and security resources.
ClearBlade IoT Core
ClearBlade replaces the cloud MQTT broker for messaging and provides its own device registry and resources. ClearBlade also provides a migration facility that primarily copies devices from Google's registry to its own. With this migration, our devices in the field can simply start sending messages to ClearBlade's own MQTT broker endpoint without the need to re-register.
Cloud Relay migration
Balena's Cloud Relay tool is implemented as a container on a balena IoT device, and manages MQTT messaging and registration with an IoT Core service. It handles this work for your application containers so they only need to expect a local MQTT connection. The present need to migrate away from Google IoT Core shows the value of this separation of work. You can refer to our earlier blog post
for more background on Cloud Relay.
In this blog post, we will demonstrate migrating a fleet of 5 devices currently on Google IoT Core. There are three steps to the ClearBlade migration:
- Setup ClearBlade account and resources
- Run ClearBlade's migration tool to register existing IoT Core devices with ClearBlade
- Reconfigure migrated devices to connect to ClearBlade IoT Core
Additionally, we must setup provisioning for new devices to use ClearBlade's SDK.
Setup ClearBlade Account
ClearBlade provides a migration tutorial
that includes account setup. Balena's device provisioning tool
for ClearBlade also provides links to the important steps. You need to create the following resources, which should be familiar to a Google Cloud administrator:
- GCP service account to permit the migration
- ClearBlade project to contain other resources
- ClearBlade device registry
- ClearBlade service account to connect device messaging to GCP Pub/Sub
When complete, you should see a ClearBlade device registry like below.
Let's create a fleet using the cloud-relay-starter example
, assuming we already have a GCP IoT Core registry. We can create virtual devices with balena's easy to use balenaVirt tool
on a DigitalOcean droplet, your workstation, or an Intel NUC. See the link for installation options.
ClearBlade's migration tool
is an executable file with a command line interface. You provide the parameters that define your resources. Run the tool on any computer with a good network connection. Here is the run for our 5 devices.
And now our devices appear in ClearBlade's registry, ready for use:
Send Data to ClearBlade Broker
Now that our devices are fully registered with ClearBlade, the user app on the device can start to send data through it. We only need to create a MESSAGING_HOST variable for the Cloud Relay service to connect to the ClearBlade MQTT broker endpoint
Be sure your devices use a recent release of the Cloud Relay block, at least v0.3.5, that supports the MESSAGING_HOST variable.
Provision New Devices with ClearBlade
For ongoing use of ClearBlade with Cloud Relay, we must configure a provisioning tool
, to securely register new devices with its IoT Core service. This tool is similar to the existing device provisioning tool
for Google IoT Core, but uses ClearBlade's own NodeJS SDK
. ClearBlade's SDK reuses much of the interface from Google's IoT Core SDK, but uses it to manage its own resources. This reuse strategy meant that we at balena only needed to make a few changes to generate our new provisioning tool.
If you use Cloud Relay and have any questions about the migration, post a message on the balena forums. For more general questions about ClearBlade, contact their support
We have described how ClearBlade provides a replacement Google's deprecated IoT Core service, including a cloud MQTT broker, device registry, and telemetry events. We then showed how to use ClearBlade tooling to migrate some balena devices that use the Cloud Relay messaging tool. In our experience the ClearBlade tools made for a smooth migration, and we encourage other IoT Core users to take a closer look.