Don’t confuse Masala Chai with Chai Latte, no not the same thing! While we make chai during the snowy season, lets connect ESP8266/32 to Amazon’s AWS IoT in less than 5 minutes.

AWS IoT Core Instructions

Goto AWS IoT Core on your AWS console

Create a Policy

  1. Generate a Policy first 1-policy-create

  2. Create a Policy details

  • Provide a Name
  • Action: iot:*
  • Resource ARM: *
  • Effect: Allow 2-policy-create

Create a Thing

  1. Create a Thing first 1-thing-create

  2. Single Thing

  • Create a AWS IoT Thing 2-thing-single
  1. Thing Name
  • Provide a Name to the Thing
  • Copy thing name into THINGNAME
  • Click Next 3-thing-name
  1. Create Certificates
  • Click on Create Certificate 4-thing-create-certs
  1. Download Certificates Download the following
  • Contents for client_cert[] from XXXXXXXXXX.cert.pem
  • Contents for privkey[] from XXXXXXXXXX.private.key
  • Contents for cacert[] from Root CA for AWS 5-thing-download-activate-certs
  1. Download the Root CA Certificate
  • Download the RSA 2048 bit key 6-thing-root-ca-cert
  1. Attached the Policy created from step above 7-thing-policy-attach

  2. Interact with AWs IoT Core

  • look for HTTP end point and copt it into MQTT_HOST[]
  • Copy thing name into THINGNAME (same name from step 3) 8-thing-endpoint

Software requirements

ESP8266

  • Use ESP8266 Arduino Core version 2.5.0-beta2 or greater
  • Will NOT work on ESP8266 Arduino Core v2.4.2 !!!

ESP32

  • Use the latest release version

Libraries Needed

platformio.ini is included, use PlatformIO and it will take care of installing the following libraries.

LibraryLinkPurpose
Arduino MQTThttps://github.com/256dpi/arduino-mqttcommunication (choose 1)
PubSubClienthttps://github.com/knolleary/pubsubclientcommunication (choose 1)
ArduinoJSONhttps://github.com/bblanchon/ArduinoJsonexample-data-formatting