-
In the GCP Console, go to the Manage resources page and select or create a new project. The project name will be your
GOOGLE_IOT_PROJECTvariable. -
Make sure that billing is enabled for your project.
- Go to the Google Cloud IoT Core page in GCP Console.
- Click Create a registry.
- Enter
balena-registryfor the Registry ID (this will be yourGOOGLE_IOT_REGISTRYvariable). - Select
us-central1for the Cloud region (this will be yourGOOGLE_IOT_REGIONvariable). - Select
MQTTfor the Protocol. - In the Telemetry topic dropdown list, select Create a topic.
- In the Create a topic dialog, enter
balena-telemetry-topicin the Name field. - Click Create in the Create a topic dialog.
- In the State topic dropdown list, select Create a topic.
- In the Create a topic dialog, enter
balena-state-topicin the Name field. - Click Create in the Create a topic dialog.
- Click Create on the Cloud IoT Core page.
You've just created a device registry with a Cloud Pub/Sub topic for publishing device telemetry events.
- Go to the GCP IAM service accounts page
- Click Create service account
- Name it
balena-service-account - Click Create
- On the Roles dropdown add the following: Cloud IoT Provisioner and Pub/Sub Publisher
- Click Continue
- Click Create Key to create JSON keys for your service account.
- Download the credentials JSON file and click Done to complete the setup.
The contents of the credentials JSON file will be your GOOGLE_IOT_SERVICE_ACCOUNT_TOKEN variable.
- Visit the PubSub subscriptions page
- Click Create Subscription
- Enter
balena-telemetry-test-subfor the Subscription ID - Enter
projects/balenaio/topics/balena-telemetry-topicfor the Topic name - Leave the other settings at the default values and click Create