Exploring Aws Iot

Device to AWS Cloud integration: Programming Embedded Devices and managing data in AWS IoT

Last updated 2022-01-10 | 4.6

- Program the ESP8266
- ESP32
- or Raspberry Pi 3 to send data to AWS IoT Core
- Connect to AWS free Tier and use relevant AWS services
- Understand MQTT
- JSON
- IoT
- and the AWS cloud

What you'll learn

Program the ESP8266
ESP32
or Raspberry Pi 3 to send data to AWS IoT Core
Connect to AWS free Tier and use relevant AWS services
Understand MQTT
JSON
IoT
and the AWS cloud
Become familair with device to cloud communication
Place IoT data into Dynamo DB by creating a table and data fields
Gain competency designing graphs and using analytics on IoT data
Code with basic programming structures in JavaScript
Python
and C
Use Node-Red to connect devices to AWS IoT
Get experience with many AWS services vital to IoT like DynamoDB and S3
Learn to Create Security certificates and policy's in AWS IoT

* Requirements

* Comfortable using a PC
* Mac
* or a Linux computer
* Some knowledge of the Internet of Things ( IoT)
* Desire to understand device to cloud communication
* Experience with a basic IDE like Arduino
* Amazon AWS familiarity is helpful

Description

This course explores the various features of device to cloud communication using Amazon AWS IoT Core on a AWS  free tier account.  


Before the course starts we need an AWS free tier account, a local installation of the AWS CLI tool, and installation of the MQTT.fx testing tool (all free).  After this is set up we will program inexpensive, WiFi enabled embedded devices such as the ESP8266, ESP32, and Raspberry Pi to communicate with AWS IoT Core with MQTT. 
 

We will take advantage of free "Internet of Things" (IoT)  development environments, like Mongoose OS in JavaScript, Arduino in C, Zernyth in Python, AWS FreeRTOS in C,  and the AWS IoT SDK in both JavaScript and Python for the Raspberry Pi to program our inexpensive WiFi devices.
 

You will need at least one or more of the following devices to transmit data to AWS IoT.  Alternately, you can send JSON test payloads from IoT Core directly, imitating a IoT device.  The course continues on with programming our embedded devices to send data from the device to the AWS cloud.  To transmit our data we will use the built in MQTT broker on our devices firmware, sending JSON encoded sensor data, to the AWS IoT console.
 

Device                                     Development Environment                Programming Language

ESP8266 12-E                           Mongoose OS, Arduino/Node-RED       JavaScript, Arduino

ESP32                                       Arduino, Zerynth, FreeRTOS                   JavaScript, Python, Arduino, C

Raspberry Pi 3 Model B           AWS IoT SDK                                          JavaScript, Python


From within the IoT console we will create AWS IoT “Rules” and “Actions” to explore many of the built in AWS IoT enabled services that are integrated in the AWS IoT Core console on the AWS cloud. Creating rules-based actions to AWS services we will send, store, file, manipulate, graph and analyze our sensor data through a variety of important AWS applications.   Some of these integrated applications, using these rule-based actions, are Dynamo Database, S3, SNS, Lambda, Data Pipeline, Glue,  QuickSight, AWS IoT Analytics, and SageMaker.


IoT is largely the fusion of devices and the web, specifically the cloud; all sending and recording data, ubiquitously and continually, everywhere. Understanding and being able to  prototype and implement an end-to-end, device to cloud path communication is a much in demand career skill. 


Having the skills to build a prototyping IoT solution in the cloud is already an important and highly demanded skill set for those wanting to call themselves IoT developers, and this is more true as time goes on and IoT exponentially expands as cheap connected devices become wide-spread. 
 

Remember! 30 days money-back guarantee with no questions asked. I want you to be happy with the value I believe this course provides. 

Who this course is for:

  • Engineers interested in the Internet of Things (IoT)
  • Electronic Hobbyists wanting to acquire more IoT skills
  • Web or Cloud Programmers interested in Embedded Devices
  • Embedded device Programmers interested in learning AWS Cloud

Course content

21 sections • 85 lectures

Welcome to the Course Preview 08:03

Introduction to the course materials covering hardware devices used for the course as well as a brief walk-through of the IoT process on AWS.

IoT Devices used for the Course Preview 07:12

A discussion of the technical specifications for the ESP8266, ESP32, and Raspberry Pi 3 Model B+.  We explain what they are used for and their IoT capabilities relevant to AWS IoT.

Software and Languages used for the Course Preview 07:06

In this lecture we discuss all the free software used for the course, as well as OS's, testing tools, IDE's and languages used to program our IoT devices to talk to the AWS IoT Core gateway.  We start with the MQTT.fx tool to test our connection then move on to testing with Node-Red with a static IP.  Then Arduino with a provided script for sending data to Node-Red to AWS IoT core as a HTTP/MQTT relay.  Then move on to using Mongoose OS in JavaScript, Zerynth in Python, and finally the AWS IoT SDK in both JavaScript and Python. At the end of the course we introduce the AWS FreeRTOS on the ESP32 DevKitC as an advanced topic in bare metal C.

The MQTT protocol for IoT and the Publish/Subscribe model Preview 02:13

A discussion of communication protocols for IoT focusing on the MQTT broker both used from the device side and on AWS IoT Core to handle messaging using the Publish and Subscribe model.

Quiz on AWS and IoT

A quiz to test your knowledge on AWS, IoT, and introductory cloud topics

AWS Free Tier and Configuring the AWS CLI Preview 05:16

AWS IoT Actions and Core related services Preview 05:42

In this lecture we discuss the AWS IoT Core service, using the 'monitor' and 'test' consoles, and linking actions from AWS IoT Core to other important AWS IoT related services.

Introducing IAM for IoT policys and Roles Preview 04:27

A short introduction to the often confusing concept of IAM policy's and roles.  Here we create a super expansive IoT policy with the automatic configuration tool in AWS IAM as a test case before creating an real IoT policy in AWS IoT core the simple way.

Creating Security Credentials and composing an IoT policy from AWS IoT Core Preview 05:25

Here we use the abbreviated policy creating tool in AWS IoT core, then configure our three required security certificates for the testing tool and our devices.  After we download and activate our credentials we attach the inclusive IoT policy we just created to those credentials.

Communication protocols and security for devices on AWS Preview 07:04

A lecture going over the basic communication protocols and security considerations enabling devices to talk to AWS. We specifically discuss MQTT, HTTPS, SigV4, and SS/TLS requirements for device to cloud communication.  Also added important troubleshooting information.

Sending JSON test payloads from the AWS CLI and the IoT Core console Preview 03:27

In this video I show two different methods for sending fake test data in JSON format to AWS IoT Core. These methods are useful if either you don't have your device yet or you don't want to set up your device just to send some quick data for testing purposes.

Download the MQTT.fx test tool Preview 00:55

How to download free MQTT.fx tool to test our certificates

Using the MQTT.fx tool to test our MQTTs connection and send data to AWS IoT Preview 08:12

After downloading the MQTT.fx tool we link our security credentials, configure the client broker with our custom endpoint, and open port 8883 with MQTT+TLS1.2  to send a test JSON package to AWS IoT core.

Troubleshooting MQTT.fx connection error Preview 01:46

How to solve the connection issue caused by the "mqttfx-config.xml" file.

Using the cURL tool to test our AWS IoT certificates via HTTPS to IoT Core Preview 05:14

In this lecture we use the cURL tool to test our certificates by communication over HTTPS via port 8443 to AWS IOT Core.  The cURL tool is super easy to use on Linux and Mac but in this video I show an easy way to use it in Windows in a Mingw Unix simulated environment that's easy to install.



curl --tlsv1.2 ^

    --cacert Amazon-root-CA-1.pem ^

    --cert client.pem.crt ^

    --key private.pem.key ^

    --request POST ^

    --data "{\"Temperature\": 77, \"Humidity\": 88, \"Time\": 12349876,\"Device_ID\": \"device_4\"}" ^

    "https://<INSERT-YOUR-IOT-DATA-ENDPOINT-HERE>:8443/topics/outTopic?qos=1"

Automated testing using a bash script and the AWS CLI Preview 02:38

In this lecture I demonstrate a simple bash script you can use to automate publishing IoT test payloads from your computer to your AWS IoT Core console.  The bash script utilizes the AWS CLI to send automated commands with sample data to IoT Core.  It can be configured for different regions, payload iterations, variables names, and values.

AWS Setup quiz

A quiz that will ensure you have the fundamental concepts for setting up your embedded IoT device to communicate with the AWS Cloud

AWS Device connect quiz

Essential AWS to device troubleshooting

Arduino Sketch to connect your ESP8266/ESP32 directly to AWS IoT Core Preview 10:05

Modified ESP8266/ESP32 Arduino Sketch to deliver JSON payload to AWS IoT Core Preview 06:16

ESP8266 Updated sketch changes for Board Manager 3+ Preview 02:14

Updated ESP8266 Sketch to work with Board manager 3+.  How he BearSSL certificates are set and anchored has changed.

Quiz on the Sketchs and the ESP devices

A quick quiz to help you understand topics related to our Arduino sketches for the ESP devices and how they communicate with AWS.

A word about Node-Red and the Arduino Sketch. Preview 01:52

Here I discuss how Node-Red on the IBM cloud now requires a credit card although it is still technically "free" for experimental use cases.  Because of this I have moved it to the appendix of the course as optional material.  I have developed an HTTPS to AWS IoT Core Arduino Sketch for the ESP8266 and ESP32 which accomplishes that which I was previously using Node-Red for.

The Arduino HTTPS Sketch to connect your device to AWS IoT Core Preview 08:13

In this lecture I explain details of my HTTPS to AWS IoT Core Sketch on Arduino.  I have two different versions for the Board manager 2-3 on the ESP8266 and for board manager 3+.  The ESP32 doesn't require an extra sketch as it works with all board support packages.

Programming Quiz

Introduction to Mongoose OS Preview 03:43

In this lecture we introduce the free Mongoose programming tool to upload code to our embedded devices and transmit data from our device to AWS IoT Core.

Reviewing the init.js demo code for our device Preview 16:02

In this lecture we build and flash the firmware from the Mongoose OS tool to our embedded device.  For this lecture we use the init.js code provided as the default example in Mongoose OS, then we examine how it transmits data to AWS IoT core after automatically creating  TLS 1.2 compliant certificates for us.

Programming our own init.js firmware with Mongoose OS in Javascript Preview 09:26

In this lecture we reprogram our embedded device with a new init.js firmware package Included in course resources) that better suits our needs.  Later in this course, when we start using different IoT related AWS services, this new modified data package will satisfy the requirements of our applications.

Quiz on Mongoose OS

Registering your Device and Installing the virtual machine Preview 02:25

Configuring Zerynth to AWS IoT Preview 07:36

Running the Test program Preview 05:49

Customizing the test program Preview 05:05

Quiz on Zerynth for AWS IoT

A short quiz covering this section on using Zerynth for AWS IoT on our embedded devices.

Provisioning AWS IoT to receive our JSON sensor data from our RaspberryPi-3 Preview 08:46

Setting up our RaspberryPi3 with the AWS SDK in Python, and the AWS CLI tool. Preview 10:54

Modifying the basicPubSub.py program to send our data to AWS IoT with our Rpi3. Preview 12:57

Set up a text notification for our sensor data Preview 07:30

Set up an email notification for our sensor data Preview 05:13

Using conditional data testing for notifications Preview 02:30

Saving a data object driectly to S3 Preview 05:58

Exporting data to CSV or JSON Preview 02:13

Creating an open and accessible public S3 data bucket in 2022 Preview 03:11

Below are the needed policy and rule to make your bucket easily accessible from anywhere with a static IP.


Public read-only Bucket Policy:

{

    "Version": "2012-10-17",

    "Statement": [

        {

            "Sid": "PublicRea2411145d",

            "Effect": "Allow",

            "Principal": "*",

            "Action": [

                "s3:GetObject",

                "s3:GetObjectVersion"

            ],

            "Resource": "arn:aws:s3:::<Paste-Your-Bucket-Name-Here>/*"

        }

    ]

}


Easily accessible CORS Rule:


[

    {

        "AllowedHeaders": [

            "Authorization"

        ],

        "AllowedMethods": [

            "GET"

        ],

        "AllowedOrigins": [

            "*"

        ],

        "ExposeHeaders": [],

        "MaxAgeSeconds": 3000

    }

]


Introduction to Kinesis Firehose from the AWS IoT panel Preview 01:49

Configuring Kinesis Firehose for data transfer Preview 09:10

Introduction to the AWS Data Pipeline Preview 01:44

Configure and implement the Data Pipeline for data transfer to S3 Preview 09:28

Introduction to AWS Glue Preview 03:08

Using Glue to crawl our data file Preview 03:30

Using a Glue ETL job to transform our JSON data to CSV Preview 06:01

Introduction to AWS Quicksight Preview 01:58

Editing permissions and S3 bucket access Preview 05:41

Creating a proper manifest to import the CSV file from S3 Preview 05:34

Cleaning our data with QuickSight functions Preview 04:17

Further cleaning with functions Preview 03:49

Designing a Line Chart with our data Preview 03:32

Introduction to AWS Lambda for IoT Preview 02:24

Creating a Cloudlogger.js function in Lambda Preview 06:30

Advanced Lambda: IoT Publisher from Lambda Preview 13:07

In this advanced Lambda example we invoke the AWS-SDK in Node.js to ingest an incoming IoT data payload from IoT Core, and then republish that JSON data to another topic on a different device.  The receiving device simply needs to subscribe to a matching MQTT topic sent from lambda to receive the data payload on the device.

IoT Data Publisher from Lambda Preview 02:55

I present a data publishing program written in Python that can be used to send fake data from Lambda to AWS IoT Core.  Useful for testing purposes.

AWS IoT Analytics: Setup Channel, Pipeline, and Datastore Preview 09:50

AWS IoT Anlytics: Ingesting and Displaying our IoT Data Preview 05:21

AWS IoT analytics: Using AWS Sagemaker on our Dataset Preview 07:31

Intro to Shadow devices and duplex Pub/Sub Preview 07:22

In this lecture we introduce AWS Shadow device service and the Pub/sub model that allows communication between multiple devices with various publish and subscribe topics.  We then discus creating a 'Thing'  shadow topic group on AWS IoT Core and I then show how to emulate the physical devices on the cloud with $aws/.../shadow/update and $aws/.../shadow/update/accepted

Aruino PubSub sketch with $aws/../shadow/update topics Preview 10:07

In this lecture we go over our ESP sketch in which we demonstrate how to publish and subscribe to our shadow topics, specifically $aws/.../shadow/update and $aws/.../shadow/update/accepted.  This allows two or more devices to communicate with each other as well as update and hold the shadow state on the AWS Cloud.  We demonstrate how we can also publish from the cloud to change state and publish topics to the devices from the cloud.

Using Multiple Topics with AWS Shadow Sate Preview 03:11

Introduction to multiple subscription and publishing topics to multiple devices.  We cover how to use the AWS 'Topic Republish' based on SQL from our incoming JSON payload.  We then demonstrate  how to use tokenization with the 'strtok' and 'atoi' C functions to parse our incoming JON payload from our publishing device(s) to our subscription device(s).

Arduino sketchs with multiple topics and subscription repsonses Preview 10:54

We examine our Arduino sketch on our ESP device to show three different methods discussed previously to act on incoming data from our published JSON payload to affect physical actions on the device.  Here we will blink the LED's on the ESP based on the manner and content of the incoming subscription IoT data payload.

Intro into Shadow/Get and Shadow/Get/Accepted Preview 02:27

Introduction to our truck company example in which we can use $aws/.../shadow/get and $aws/.../shadow/get/accepted to retain and retrieve the current device state on the cloud even when the device is offline.  This is extremely useful for devices with intermittent IoT service and resetting the device with a good state from a lost state.

Setting up shadow multiple 'Things' representing devices in the wild Preview 04:08

We emulate multiple trucks as thing groups in the cloud and demonstrate how to use $aws/.../shadow/get and $aws/.../shadow/get/accepted to update our device shadow on the cloud as well as communicate between connected devices with shadow publish and shadow subscribe topics.

Our Arduino Sketch to maintain state on multiple trucks as IoT devices. Preview 03:32

In this lecture we examine a Arduino sketch which utilizes multiple shadow topics to publish and subscribe to the current state of other trucks in the wild.  This sketch shows how one truck can retrieve the last known good state of another truck whether they are online or not utilize multiple reserved shadow topic.

Shadow Device and Shadow Topic Quiz

A Quiz on using Shadow Device topics and MQTT PubSub

Create a Timestream database and send IoT data from IoT Core to the new database Preview 16:16

In this lecture we create an action in IoT Core to send our incoming JSON IoT data payload to AWS Timestream.  First we must create our database and then our data table in Timestream, which we can do directly from IoT Core.  Now that Timestream is set up and able to accept data we input or data through IoT Core and then query the data in Timestream using basic SQL statements.

Connect the free Grafana online visualization tool to our Timestream database Preview 10:52

Now that our Timestream data ledger is full of our IoT data we can query it and create visualizations with Grafana.


First we make a free Grafana online account, then we download the Timestream 'connector' designed to allow Grafana to read from Timestream in our account.   We will create some limited credentials (SigV4) in AWS IAM to give Grafana the privilege's needed to read our Timestream data in AWS.  Finally, now that we have formed the connection between Grafana and Timestream, we can do a few visualizations using the built in query capability of Grafana on our Timestream data. 

Amazon FreeRTOS Part 1 Intro Preview 04:58

Describing the thoughts and reasons for Amazon buying FreeRTOS as a OS for AWS IoT connectivity based around mid-level Microprocessors using C code.

Amazon FreeRTOS Part 2 Setting up the environment and programming files Preview 09:15

Setting up the msys32 toolchain and importing the  ESP32 AWS C files from The AWS Github for AWS freeRTOS.  Then going on to show the functionality of the "Hello" echo program communicating with AWS IoT and relaying a published topic from the ESP32 device.

Amazon FreeRTOS Part 3 Exploring the code Preview 03:59

AWS FreeRTOS Quiz

A quiz about the AWS FreeRTOS

Intro to using Node-Red with Arduino and AWS IoT Preview 02:48

Introduction to Node-Red and using a static webhost as a thrid party cloud proxy for enhancing data and AWS authorization to IoT Core

Creating an IBM Cloudant account and Node-Red App Preview 08:09

An optional video going over how to set up the Node-Red App in a static website on IBM Cloudant.  Included in the resources are the official documentation.  This video is meant to clarify the confusing tool set up process.

Configuring our Node-Red application Preview 13:52

In this lecture we configure our Node Red application with an outgoing MQTT Node on port 8883 where we can authorize via our AWS security credentials to communicate with IoT Core on AWS.   We use Node-Red as a cloud proxy to authorize and enhance our data, and then dispatch the enhanced data to AWS IoT Core.

interfacing our Arduino Sketch with Node-Red Preview 09:22

We finish connecting our Node-Red app with HTTP on the input node, processing a JavaScript Node enhancement to our JSON  data payload to an MQTT(s) endpoint to AWS IoT Core.  After this we can use our HTTP Arduino script with a Restful GET to send our IoT data to Node-Red. 

Arduino and Node-Red Quiz

Test your  knowledge and important concepts in this section.