Published
- 2 min read
Esp8266 to aws IoT core

🤖 Introduction
We combine the power of Amazon Web Services’ (AWS) Internet of Things (IoT) platform with the versatile ESP8266 microcontroller in this project. Here’s how to connect an ESP8266 device to AWS IoT Core using the MQTT (Message Queuing Telemetry Transport) protocol, enabling secure bidirectional communication between the device and the cloud.
This integration provides a solid foundation for building scalable and secure IoT applications. We’ll learn how to establish WiFi connection, synchronize time with NTP servers, configure SSL/TLS certificates for secure communication, and send and receive data in JSON format via MQTT.
⚙️ Tech Stack
💎 ESP8266
💎 Arduino Framework
💎 AWS IoT Core
💎 MQTT Protocol
💎 ArduinoJson Library
🔋 Features
👉 WiFi Connection: It connects to the internet using WiFi, enabling communication with other devices and services.
👉 Secure Connection to AWS IoT: It securely connects to AWS IoT, a cloud service, to exchange data without unauthorized access.
👉 Sending Random Data: It sends randomly generated temperature and humidity data in a format that’s easy for other devices to understand.
🎬 Youtube tutorial
See tutorial video here
🤸 Quick Start
Follow these steps to set up the project locally on your machine.
Prerequisites
Make sure you have the following installed on your machine:
Make sure you have the following installed on your machine:
Install Board:
Install library:
Cloning the Repository
git clone https://github.com/rch-goldsnaker/aws-esp8266
cd aws - esp8266
Set Up certificates from AWS
//Amazon trust services endpoint
static const char cacert[] PROGMEM = R"EOF(
----- BEGIN CERTIFICATE-----
----- END CERTIFICATE-----
)EOF";
//Device certificate
static const char client_cert[] PROGMEM = R"KEY(
----- BEGIN CERTIFICATE-----
----- END CERTIFICATE-----
)KEY";
//Private key file
static const char privkey[] PROGMEM = R"KEY(
----- BEGIN RSA PRIVATE KEY-----
----- END RSA PRIVATE KEY-----
)KEY";
Set Up your Device name and MQTT broker host
// Device name from AWS
const char THINGNAME[] = "********";
// MQTT broker host address from AWS
const char MQTT_HOST[] = "********";
Set Up your Wifi Credential
// WiFi credentials
const char WIFI_SSID[] = "********";
const char WIFI_PASSWORD[] = "********";
Copy the code to Arduino IDE and Upload
⌨️ Code
See repository here