AWS IoT Hands-On — A Practical Tutorial

STM32 Discovery kit IoT node in front of the data sent to AWS IoT cloud

In short what this is about

What is AWS IoT about?

  • AWS IoT Core for managing IoT devices or device fleets
  • AWS Greengrass (Won’t cover it in this article, but it’s awesome!)
  • AWS IoT 1-Click — the Dash Button’s services
The AWS IoT User Interface — A view of the Monitor dashboard

Starting off with this Thing — STM32L4

STMicroelectronics STM32 Discovery kit IoT Node — connected to my Mac
The Mbed OS Online Compiler

Creating your first Thing in AWS IoT

The AWS console’s “Creating AWS IoT things” screen
“Add your device to the thing registry” screen on AWS IoT
AWS IoT Thing certificate successfully created
“Advanced mode” of the “Create a policy” screen
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "iot:Connect",
"Resource": "*"
},
{
"Effect": "Allow",
"Action": "iot:Publish",
"Resource": "*"
},
{
"Effect": "Allow",
"Action": "iot:Subscribe",
"Resource": "*"
},
{
"Effect": "Allow",
"Action": "iot:Receive",
"Resource": "*"
}
]
}

Adding the Thing certificate and key to the program

const char MQTT_SERVER_HOST_NAME[] = "INSERT_THING_ENDPOINT_HERE.iot.eu-central-1.amazonaws.com";

const char* SSL_CLIENT_CERT_PEM = "-----BEGIN CERTIFICATE-----\n"
"INSERT YOUR THING CERTIFICATE HERE!\n"
"-----END CERTIFICATE-----\n";

const char* SSL_CLIENT_PRIVATE_KEY_PEM = "-----BEGIN RSA PRIVATE KEY-----\n"
"INSERT YOUR THING PRIVATE KEY HERE!\n"
"-----END RSA PRIVATE KEY-----\n";
“Settings” screen with the AWS IoT endpoint domain name

Compile your IoT program for the STM32L4

Mbed online compiler while compiling the program code

Run the program on your STM32L4

STM32L4 USB console debug information

Checking your MQTT messages in the AWS IoT monitor

AWS IoT Monitor showing a chart with incoming MQTT messages

Act — Doing things with the Thing’s things

AWS IoT Rule to forward message to Lambda

Pushing the Thing’s data onto S3

AWS IoT pushing MQTT message date to S3 with an AWS IoT Rule
S3 Bucket with MQTT message data from AWS IoT as JSON — and an HTML frontend

Serving the AWS IoT data on S3 through CloudFront

{
"Version": "2012-10-17",
"Id": "IotS3DataBucketPolicy",
"Statement": [
{
"Sid": "AllObjectAccess",
"Effect": "Allow",
"Principal": {
"AWS": "*"
},
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::iotsensordata/*"
}
]
}
Custom IoT Frontend on S3 served through CloudFront

Review of AWS IoT and what it can do

STM32L4 with a USB battery pack in a water-proof case for outdoor use

I love technology, programming, computers, mobile devices and the world of tomorrow.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Sign in with Google using Laravel Api.

Augmented Reality Starters Guide

Flash Stock Rom on Spice Mi-514

11111

LPI DAO X Platinum Engineering Partnership

Why new developers should learn Full Stack Development first and then go for specialisation

Global Variable Basics

Data model for Restaurant online ordering -Part 1

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Jan Kammerath

Jan Kammerath

I love technology, programming, computers, mobile devices and the world of tomorrow.

More from Medium

AWS EMR Memory Scaling

Deploying Spring Boot application on AWS ECS

AWS Lambda : The Base Image Matters

Connect to AWS Aurora Serverless DB using DBeaver