This folder contains Python samples that demonstrate an overview of the Google Cloud IoT Core platform.
- Install the gCloud CLI as described in the Cloud IoT Core documentation.
- Create a PubSub topic:
gcloud beta pubsub topics create projects/my-iot-project/topics/device-events
-
Add the service account
cloud-iot@system.gserviceaccount.comwith the rolePublisherto that PubSub topic from the Cloud Developer Console or by using the helper script in the /scripts folder. -
Create a registry:
gcloud beta iot registries create my-registry \
--project=my-iot-project \
--region=us-central1 \
--event-pubsub-topic=projects/my-iot-project/topics/device-events
- Use the
generate_keys.shscript to generate your signing keys:
./generate_keys.sh
- Register a device:
gcloud beta iot devices create my-python-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_examplefolder. - Learn how to manage devices programmatically with the sample app in the
managerfolder.

