Instructing ChatGPT to produce TLS code on the ESP32
Now, let us list the necessary information in the ESP32’s main code to access AWS IoT Core:
- TLS certificates, which will be stored in the
SecureCredentials.h
header file - MQTT server address and port, which will be stored in the
Platformio.ini
file, for example,AWS_IOT_MQTT_SERVER=\"xxxxxxxxxxxxxx.iot.your_aws_region.amazonaws.com\", AWS_IOT_MQTT_PORT=8883
deviceID
, which will be populated from theHardwareInfo.h
header file
Be aware that AWS_IOT_MQTT_SERVER
is the endpoint address as shown in the following figure; it is in the settings under AWS IoT. Please remember to remove -ats
from the endpoint address because we use the endpoint type of iot:Data
, not iot:Data-ATS
.
Figure 13.26 – Locate your endpoint information
You can now continue using the code created in the previous chapter and add the TLS MQTT requirement as the following prompt:
Hi, ChatGPT...