-
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_PROJECT
variable. -
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-registry
for the Registry ID (this will be yourGOOGLE_IOT_REGISTRY
variable). - Select
us-central1
for the Cloud region (this will be yourGOOGLE_IOT_REGION
variable). - Select
MQTT
for the Protocol. - In the Telemetry topic dropdown list, select Create a topic.
- In the Create a topic dialog, enter
balena-telemetry-topic
in 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-topic
in 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-sub
for the Subscription ID - Enter
projects/balenaio/topics/balena-telemetry-topic
for the Topic name - Leave the other settings at the default values and click Create