This post presents a run-through of the Google Cloud Platform (GCP) Internet of Things (IoT) Core Quickstart at [link].
Before you begin
1. In the GCP Console, go to the Manage resources page and select or create a new project.
1. Go to the Manage Resources page at [link]
2. Log in with email@example.com
3. Click CREATE PROJECT
4. (A) Name the project Guppy 0001 and (B) click CREATE
...(A) click the pull-down to (B) select my project: Guppy 0001.
... to see the dashboard:
2. Make sure that billing is enabled for your project.
1. Read the steps posted at [link]
2. Select Billing
I see my billing dashboard:
3. Enable the Cloud IoT Core and Cloud Pub/Sub APIs.
1. Make sure firstname.lastname@example.org is selected:
2. (A) With Guppy 0001 selected, scroll down and (B) click IoT Core under BIG DATA
3. Click Enable API
4. Click Create a device registry
Registry ID: test-reg.0
Both MQTT and HTTP protocols
Default telemetry topic: test-topic.0
And Debug level debugging
...and click Create
Generate a device key pair
Open a terminal window and run the following multi-line command to create an RS256 key:
1. (A) Click to launch a Google Cloud Shell Environment shell, (B) paste command above to create a key
2. Type ls in the shell to see the files with the keys:
3. Save the keys
(A) Click the 3 vertical dots icon, the (B) click Download file
...enter: /home/google_cloud/rsa_cert.pem and click DOWNLOAD
...do the same thing for: /home/google_cloud/rsa_private.pem
Add a device to the registry
1. Click Create device
2. Enter my-device for the Device ID
3. Click the Allow radio button under Device communication
4. Select the RS256_X509 radio button under Public key format
5. Type cat rsa_cert.pem in the Google Cloud Shell
6. (A) Use you mouse to select the key (it will be copied), (B) then click the Public key value box and (C) press Ctrl-v (to paste).
7. Leave Public key expiration data unset
8. Leave Device metadata blank
9. Click Debug level Stackdriver Logging
10. Click Create
Continuing from Google Cloud Internet of Things Core: Using the MQTT Bridge at [link]
The Cloud IoT Core service supports the MQTT protocol by running a managed broker that listens to the port mqtt.googleapis.com:8883. Port 8883 is the standard TCP port reserved with IANA for secure MQTT connections. Connections to this port must use TLS transport, which is supported by open source clients like Eclipse Paho.
If port 8883 is blocked by your firewall, you can also use port 443: mqtt.googleapis.com:443.
When the MQTT client connects, it must specify the device by setting the MQTT client ID to the full device path:
In this case:
...and the device state topic is:
Continuing from Google Cloud Internet of Things Core: Using JSON Web Tokens (JWTs) [link]
When connecting over MQTT, the JWT must be set in the password field of the CONNECT message. When connecting over HTTP, a JWT must be included in the header of each HTTP request.
Google Cloud logo found with a Google image search, image from [link]