This folder contains NodeJS samples that demonstrate an overview of the Google Cloud IoT Core platform.
-
Install the Google Cloud SDK as described in the Cloud IoT Core documentation.
-
Create a Cloud Pub/Sub topic:
gcloud beta pubsub topics create projects/my-iot-project/topics/device-events
-
Add the service account
[email protected]
with the rolePublisher
to that Cloud Pub/Sub topic from the Cloud Developer Console or by setting theGOOGLE_CLOUD_PROJECT
environment variable and using the helper script in thescripts/
folder. -
Create a registry:
gcloud iot registries create "your-registry-id" \ --project=<your-project-id> \ --region=us-central1 \ --event-notification-config=topic=projects/<your-project-id>/topics/<pubsub-topic-name>
-
Use the
generate_keys.sh
script to generate your signing keys:./scripts/generate_keys.sh
-
Create a device.
gcloud iot devices create my-node-device \ --project=my-iot-project \ --region=us-central1 \ --registry=my-registry \ --public-key path=rsa_cert.pem,type=rs256
-
Connect a sample device using the sample app in the
mqtt_example
folder. -
Learn how to manage devices programatically with the sample app in the
manager
folder.