SlideShare a Scribd company logo
AWS IOT
BOOTCAMP
MASTERING AMAZON
WEB SERVICES
Emiliano Pecis, Andrea Mercanti, Stefano Rosini, Gabriele Stella
Storm Reply
MASTERING AWS SERIES
AGENDA
AWS AI as a Service
AWS IoT Foundations
AWS Database-as-a-service
AWS IoT Advanced
Bootcamp "Mastering AWS IoT»
October 27th in Rome
AWS IOT BOOTCAMP
OVERVIEW
AWS IOT
PLATFORM
IoT
topic
IoT
MQTT
protocol
IoT
shadow
IoT
certificate
SNS
IoT
rule
IoT
policy
Elastic Search
KinesisLambda
Machine
Learning
DynamoDB
Grove Sensors
Raspberry Pi + Grove Board
AWS IoT Button Python IoT SDK
AGENDA
AWS IoT
LAB 1-2: IoT HighTemp Alarm
Lunch Break
LAB 3: Streaming IoT
Coffee Break
LAB 4: Predictive Maintenance
Wrap-up
09:00 – 10:00
10:00 – 13:00
13:00 – 14:00
14:00 – 16:30
16:30 – 16:45
16:45 – 17:50
17:50 – 18:00
AWS GIVES YOU SUPERPOWERS
STORM REPLY
THE REPLY’S COMPANY FOCUSED ON AWS
70 Experts
CloudArchitects, DevOps, Microservices Architects
50 Top Brand Customers
Enel, Vodafone, Ferrero, Volkswagen, ePrimo, Grohe, etc
AWS Premier Consulting Partner
The only Italian company to have the highest level of
certification
STORM REPLY
THE REPLY’S COMPANY FOCUSED ON AWS
Design Services
Design and development of
solutions in both traditional
environment, supplying them
as a service-in-the-cloud
(providing and managing
IaaS), and directly on the
cloud, using service
architecture (PaaS) and cloud
native applications
Advisory Services
Supply of consulting services
for IaaS, SaaS & PaaS
solutions: analysis, setup,
development, customization,
maintenance and, above all,
migration from on premises to
the cloud. Storm Reply is able
to provide both a vision and a
strategy for the cloud
Managed Services
Storm Reply provides Managed
Services on top of Cloud
Services: System Monitoring,
Security Monitoring, System
Management, Patch & Change
Management. Everything
customers need to manage and
control can be done by Storm
Reply
WHAT IS AWS?
AMAZON WEB SERVICES
AWS GLOBAL INFRASTRUCTURE
AWS CLOUD OPERATES 44 AVAILABILITY ZONES WITHIN 16
GEOGRAPHIC REGIONS AROUND THE WORLD
EUROPE
Ireland
Frankfurt
London
Paris
Stockholm
ARTIFICIAL INTELLIGENCE ON AWS
LEARN, SEE, SPEAK, WRITE
MACHINE
LEARNING
REKOGNITION POLLY LEX
DATABASES ON AWS
STORE, ORDER, RETRIEVE, MIGRATE
RDS DYNAMODB ELASTICACHE REDSHIFT
DATABASE
MIGRATION
SERVICE
INTERNET OF THINGS ON AWS
HEAR, FEEL, CONTROL, COMMUNICATE
IOT GREENGRASS
IOT INTRODUCTION
WHAT IS IOT?
“The Internet of Things
(IoT) is a system of
interrelated computing
devices, mechanical and
digital machines, objects
with the ability to transfer
data over a network
without requiring human
interaction“
IOT INTRODUCTION
“A thing, in the Internet
of Things, can be a
person with a heart
monitor implant, a farm
animal with a biochip
transponder, an
automobile or any other
natural or man-made
object that can be
connected.“
WHERE IS IOT?
IOT INTRODUCTION
“Cloud computing and the IoT have a complimentary
relationship. The IoT generates massive amounts of data,
and cloud computing provides all the computational
resources to store and elaborate this big amount of data“
WHY IOT AND CLOUD?
DEVICE SDK
Set of client libraries to
connect, authenticate and
exchange messages
DEVICE GATEWAY
Communicate with devices via
MQTT and HTTP
AUTHENTICATION
AUTHORIZATION
Secure with mutual
authentication and encryption
RULES ENGINE
Transform messages
based on rules and
route to AWS Services
AWS Services
- - - - -
3P Services
DEVICE SHADOW
Persistent thing state
during intermittent
connections
APPLICATIONS
DEVICE REGISTRY
Identity and Management of
your things
AWS IOT PLATFORM OVERVIEW
MQTT
MQTT PROTOCOL
MQ Telemetry Transport:
 Lightweight protocol designed to optimize the use of resources.
 Publish-Subscribe Topic based protocol.
 Client-Broker based protocol.
OVERVIEW
Note:
“MQ” does not stand for “Message Queue”. It comes from “MQseries”, the product
name of IBM original project.
MQTT PROTOCOL
FEATURES OVERVIEW – 01 0F 02
Defined Methods
 Connect: connect to the broker.
 Disconnect: disconnect from the
broker.
 Subscribe: subscribe to a topic.
 Unsubscribe: unsubscribe from a topic.
 Publish: publish a message on a topic.
Additional Features
 Keep Alive: keep the connection to the
broker alive
 Session Persistence: restore session
and topic subscription on a reconnection
MQTT PROTOCOL
FEATURES OVERVIEW – 02 0F 02
Quality of Service
 QoS Level 0: At most once.
It guarantees a best effort delivery.
 QoS Level 1: At least once.
It guarantees that the message will be
delivered at least once.
 Qos Level 2: Exactly once.
It guarantees that the message will be
delivered only once.
Topic Wildcards
 Topic path.
home/livingroom/groundfloor/temperature
 “+”: Single-level wildcard.
home/+/groundfloor/temperature
 “#”: Multi-level wildcard.
home/#
 “$”: Topic reserved for the broker
$aws/things/groudfloor/shadow/get
DEVICE SDK
Set of client libraries to
connect, authenticate and
exchange messages
AUTHENTICATION
AUTHORIZATION
Secure with mutual
authentication and encryption
RULES ENGINE
Transform messages
based on rules and
route to AWS Services
AWS Services
- - - - -
3P Services
DEVICE SHADOW
Persistent thing state
during intermittent
connections
APPLICATIONS
DEVICE REGISTRY
Identity and Management of
your things
AWS IOT DEVICE GATEWAY
DEVICE GATEWAY
Communicate with devices via
MQTT and HTTP
DEVICE GATEWAY
Powerful Message Broker
 Standard Protocol (No Lock-In)
MQTT, HTTP, WebSockets
 Elastic Pub-Sub Brocker
from one to one bilion of connections
 Long Live connections
support for long-live connection
 Secure by default
x509 Certs, TLS 1.2, Client Mutual Auth
AWS IOT MESSAGE BROKER
Subscribers
Publishers
DEVICE SDK
Set of client libraries to
connect, authenticate and
exchange messages
AUTHENTICATION
AUTHORIZATION
Secure with mutual
authentication and encryption
DEVICE GATEWAY
Communicate with devices via
MQTT and HTTP
AWS Services
- - - - -
3P Services
DEVICE SHADOW
Persistent thing state
during intermittent
connections
APPLICATIONS
DEVICE REGISTRY
Identity and Management of
your things
AWS IOT RULES ENGINE
RULES ENGINE
Transform messages
based on rules and
route to AWS Services
AWS IOT RULES ENGINE
Select DATA from TOPIC where FILTER
SQL LIKE CODE
Functions:
 String manipulation with regex
 Mathematical operations
 Context-based helper function
 Crypto support
 UUID, timestamp, rand, etc.
Json Collection:
 get(array, int) - get item at index
 get(string, int) - get char at position
 get(object, key) - get value of key
Nested Query:
 Select (select v from e) From …
AWS IOT RULES ENGINE
SEND DATA TO OTHER SYSTEMS
DEVICE SDK
Set of client libraries to
connect, authenticate and
exchange messages
AUTHENTICATION
AUTHORIZATION
Secure with mutual
authentication and encryption
RULES ENGINE
Transform messages
based on rules and
route to AWS Services
AWS Services
- - - - -
3P Services
APPLICATIONS
DEVICE SHADOW
Persistent thing state
during intermittent
connections
DEVICE GATEWAY
Communicate with devices via
MQTT and HTTP
AWS IOT REGISTRY
DEVICE REGISTRY
Identity and Management of
your things
AWS IOT REGISTRY
Devices connected to AWS IoT are
represented by things in the thing registry
Thing
 Representation of a specific IoT Device.
Thing Type
 Representation of a family of IoT Devices.
STATIC REPRESENTATION OF THINGS
Thing Example
{
"version": 3,
"thingName": "MyLightBulb”,
"thingTypeName": "StopLight",
"attributes": {
"model": "123",
"wattage": "75"
}
}
DEVICE SDK
Set of client libraries to
connect, authenticate and
exchange messages
RULES ENGINE
Transform messages
based on rules and
route to AWS Services
DEVICE REGISTRY
Identity and Management of
your things
AWS Services
- - - - -
3P Services
APPLICATIONS
DEVICE SHADOW
Persistent thing state
during intermittent
connections
DEVICE GATEWAY
Communicate with devices via
MQTT and HTTP
AWS IOT SECURITY
AUTHENTICATION
AUTHORIZATION
Secure with mutual
authentication and encryption
AWS IOT SECURITY
STRONG THING IDENTITY
Mutual Auth TLS
 One-Click Certificate Creation
 Bring Your Own CSR
 Bring Your Own CA
DEVICE SDK
Set of client libraries to
connect, authenticate and
exchange messages
AUTHENTICATION
AUTHORIZATION
Secure with mutual
authentication and encryption
RULES ENGINE
Transform messages
based on rules and
route to AWS Services
AWS Services
- - - - -
3P Services
APPLICATIONS
DEVICE REGISTRY
Identity and Management of
your things
DEVICE GATEWAY
Communicate with devices via
MQTT and HTTP
AWS IOT DEVICE SHADOW
DEVICE SHADOW
Persistent thing state
during intermittent
connections
AWS IOT DEVICE SHADOW
DYNAMIC REPRESENTATION OF THINGS
{
"state" : {
"desired" : {
"lights": { "color": "RED" },
"engine" : "ON”
},
"reported" : {
"lights" : { "color": ”BLUE" },
"engine" : "ON”
},
"delta" : {
"lights" : { "color": "RED" }
}
}
DEVICE
Report its current state to one or multiple
shadows and retrieve its desired state
from shadow.
SHADOW
Shadow reports delta, desired, and
reported states.
AWS IOT DEVICE SHADOW
DEVICE SHADOW UPDATE FLOW - STEP 07 0F 07
PRICING
AWS IOT PRICING
 Pay as you go, no minimum fees.
 5$ per million messages published or
delivered.
 Free Tier of 250K messages per month
free
(for the first 12 month)
PRICING MODEL
AWS IOT
PLATFORM
IOT HIGH-TEMP
ALARM
- LAB 1 -
AWS IOT BOOTCAMP – LAB 1
OVERVIEW
W E L C O M E T O
T H E S T O R M
S M A R T H O M E
AWS IOT BOOTCAMP – LAB 1
OVERVIEW
“We want to Configure an alarm from different
temperature and humidity sensors placed in every room,
to alert us when the temperature of a certain place goes
over a configurable threshold. A buzzer will inform us if
we are close and a message will be sent with a
notification to our device“
AWS IOT BOOTCAMP – LAB 1
OVERVIEW
AWS IOT BOOTCAMP – LAB 1
OVERVIEW
AWS IOT
PLATFORM
IoT
topic
IoT
MQTT
protocol
IoT
certificate
SNS
IoT
rule
IoT
policy
Grove Sensors
Raspberry Pi + Grove Board
AWS IOT BOOTCAMP – LAB 1
LAB GOALS
1. Assemble the IoT Demo Architecture
2. Familiarize with the AWS IoT Console
3. Create the Thing on AWS IoT
4. Configure the Raspberry Pi
5. Test the environment
6. Understand the Python Code
7. Create Rule on AWS IoT Rules Engine
8. Create SNS Topic
9. Make it Work!
AWS IOT BOOTCAMP – LAB 1
1. ASSEMBLE THE IOT DEMO ARCHITECTURE
1. Assemble the Grove Sensors as
follows:
• A1: TEMP & HUMIDITY SENSOR
• D2: RED LED
• D3: BUZZER
• D4: BUTTON
2. Connect the GrovePi+ to the
Raspberry Pi
3. Configure your LAN interface
• 192.168.0.100/24
4. Ping the Raspberry via LAN cable
• 192.168.0.X0 (X IS YOUR GROUP)
AWS IOT BOOTCAMP – LAB 1
2. FAMILIARIZE WITH THE AWS IOT CONSOLE
1. kj
https://stormroma.signin.aws.amazon.com/console - Users have been provided to each group
Select AWS
IoT service
Go to
Ireland
regionIoT usage
dashboard
Quickstarts
Manage things
and types
Certificates
and policies
Manage rules
MQTT Client
test
AWS IOT BOOTCAMP – LAB 1
1. Click on Manage  Things
2. Thing Name
• 000x (x = group id)
3. Thing Type
• Raspberry_pi_bootcamp
4. Thing Attributes
• DEVICE_ID
• GROUP
5. Create Thing!
3. CREATE THE THING ON AWS IOT
AWS IOT BOOTCAMP – LAB 1
6. Click on Security tab
7. Create Certificate
3. CREATE THE THING ON AWS IOT
AWS IOT BOOTCAMP – LAB 1
3. CREATE THE THING ON AWS IOT
8. Download:
• CERTIFICATE
• PRIVATE KEY
• PUBLIC KEY
9. Rename the Files in (X = group id):
• 000x.cert.pem
• 000x.private.key
• 000x.public.key
10. Activate the certificate
11. Click on Attach Policy
AWS IOT BOOTCAMP – LAB 1
3. CREATE THE THING ON AWS IOT
12. Copy the number of the Certificate
13. Attach Policy
• IOT-POLICY
14. CLICK DONE!
This is a very
open policy!
Usually, you
would provide
more rescrictive
rules
AWS IOT BOOTCAMP – LAB 1
4. CONFIGURE THE RASPBERRY PI
1. SSH Connect to your Raspberry using the LAN cable
• IP: 192.168.0.X
• USER: pi
• PASSWORD: raspberry
2. Copy certificate, public & private key to:
• /home/pi/bootcamp_iot/certs/
3. Set Date On Raspberry (Cause It Doesn’t Have A HW
Clock)
• sudo date -s "27 OCT 2017 10:00:00"
AWS IOT BOOTCAMP – LAB 1
5. TEST THE ENVIRONMENT
1. Go back to the Console
2. Click on Test
3. Subscribe to topic
• iot/000x/# (# is the wildcard)
AWS IOT BOOTCAMP – LAB 1
5. TEST THE ENVIRONMENT
4. SSH Connect to your Raspberry using the LAN cable
• IP: 192.168.0.X
• USER: pi
• PASSWORD: raspberry
5. Navigate to /home/pi/bootcamp_iot/
6. Start the Publish Service
• ./start.sh 000X (x is your group)
AWS IOT BOOTCAMP – LAB 1
5. TEST THE ENVIRONMENT
7. After few seconds, Check the
presence of MQTT messages
published in the topics:
8. iot/000X/dht
• DATA ABOUT TEMPERATURE
AND HUMIDITY
9. iot/000X/stats
• STATS ABOUT YOUR DEVICE
AWS IOT BOOTCAMP – LAB 1
6. UNDERSTAND THE PYTHON CODE
• It uses the AWS IoT Python SDK
• Create the AWS IoT Endpoint
o Publish in 3 Topic: iot/000x/dht, stats, button
o Subscribe in 1 Topic: iot/000x/listen
o Define Actions for interact with sensors
• BUZZER
• BUTTON
• BLINKREDLED
AWS IOT BOOTCAMP – LAB 1
6. UNDERSTAND THE PYTHON CODE
1. To test the logic behind the Python code, go to Test and try to publish a message to the topic:
• iot/000x/listen
• «action»: «BLINKREDLED» The raspberry is subscribed to the topic
/listen and will react to your message!
AWS IOT BOOTCAMP – LAB 1
6. UNDERSTAND THE PYTHON CODE
We will now learn how to create a
Rule to interact with the sensors
2. Subscribe to Topic iot/000x/button
3. Go to Act and Create Rule to Republish
the Topic to iot/000x/listen
4. Push the Button!
LET’S CONFIGURE
THE ALARM
AWS IOT BOOTCAMP – LAB 1
7. CREATE RULE ON AWS IOT RULES ENGINE
1. Go back to the Console
2. Click on Act  Create
• NAME: Tempalarmgroup6
• ACTION: REPUBLISH TO iot/000x/listen
• STATEMENT:
AWS IOT BOOTCAMP – LAB 1
7. CREATE RULE ON AWS IOT RULES ENGINE
BONUS PART
1. Click on «Add Action»
• TYPE: SNS
Note: Test this feature
only if you’re on-time!
AWS IOT BOOTCAMP – LAB 1
8. CREATE SNS TOPIC
2. Create a new Topic specific to your group on SNS Service
AWS IOT BOOTCAMP – LAB 1
8. CREATE SNS TOPIC
3. Subscribe to Topic by:
• E-MAIL (Your E-mail)
• SMS (39xxxxxx)
4. Check your e-mail and confirm the
subscription
AWS IOT BOOTCAMP – LAB 1
8. CREATE SNS TOPIC
5. Configure The Action
• SNS TARHET: Your New Sns Topic
• MESSAGE FORMAT: RAW
• IAM Role: raspberry-iot-bootcamp-role
6. Add the rule
TEST THE SENSOR INCREASING THE
TEMPERATURE AND…
… PAY ATTENTION TO YOUR EARS! 
Continue to LAB 2
WELL DONE!
target
11:30
IOT DASHBOARD
- LAB 2 -
AWS IOT BOOTCAMP – LAB 2
OVERVIEW PART 2
“We want to store the data gathered from the temperature
and humidity sensors, to create a dashboard with real-time
and historical data and the main metrics of our sensors.
We will use Kibana to create appealing Dashboards.“
AWS IOT BOOTCAMP – LAB 2
OVERVIEW PART 2
AWS IOT
PLATFORM
IoT
topic
IoT
MQTT
protocol
IoT
certificate
IoT
rule
IoT
policy
Elastic Search
Grove Sensors
Raspberry Pi + Grove Board
AWS IOT BOOTCAMP – LAB 2
LAB GOALS
1. What is ElasticSearch
2. From IoT to ElasticSearch
3. Rules and Actions
4. Meet Kibana
5. Create your first Dashboard!
AWS IOT BOOTCAMP – LAB 2
WHAT IS ELASTICSEARCH?
• Elasticsearch is a popular open-source search and analytics engine
It is often coupled with Kibana, its natural visualization tool
• Amazon Elasticsearch Service (Amazon ES) is a managed service
that makes it easy to create a domain and deploy, operate, and
scale Elasticsearch clusters in the AWS Cloud.
AWS IOT BOOTCAMP – LAB 2
FROM IOT TO ELASTICSEARCH
• We need to create three different IoT Rules to manage three Topics:
• TEMPERATURE /iot/000x/dht
• HUMIDITY /iot/000x/dht
• RASPBERRY STATISTICS /iot/000x/stats
3 ELASTICSEARCH INDEXES
AWS IOT BOOTCAMP – LAB 2
TEMPERATURE RULE
1. Go back to IoT Console
2. Click on Act  Create
• NAME:
000x_iot_to_es_temperature
• ATTRIBUTE: id, timestamp,
temperature
• TOPIC FILTER: iot/000x/dht
AWS IOT BOOTCAMP – LAB 2
TEMPERATURE RULE ES ACTION
3. Click on Add Action  Send
Message to Amazon
Elasticsearch
• DOMAIN NAME: bootcamp
• ENDPOINT: https://search-
bootcamp-
dubcwlclatdifvomglc3kmq3ze.eu-
west-1.es.amazonaws.com
• Id: ${newuuid()}
• Index: iot-dht
• Type: temperature
• IAM Role Name: iot-device
4. Click on Add Action
AWS IOT BOOTCAMP – LAB 2
HUMIDITY RULE
5. Do the same for the other two
rules…
6. Click on Act  Create
• NAME: 000x_iot_to_es_humidity
• ATTRIBUTE: id, timestamp,
humidity
• TOPIC FILTER: iot/000x/dht
AWS IOT BOOTCAMP – LAB 2
HUMIDITY RULE ES ACTION
7. Click on Add Action  Send
Message to Amazon
Elasticsearch
• DOMAIN NAME: bootcamp
• ENDPOINT: https://search-
bootcamp-
dubcwlclatdifvomglc3kmq3ze.eu-
west-1.es.amazonaws.com
• ID: ${newuuid()}
• INDEX: iot-dht
• Type: humidity
• IAM Role Name: iot-device
8. Click on Add Action
AWS IOT BOOTCAMP – LAB 2
RASPBERRY STATS RULE
9. Click on Act  Create
• NAME: 000x_iot_to_es_stats
• ATTRIBUTE: id, timestamp,
cpuPercent00, cpuPercent01,
cpuPercent02, cpuPercent03,
cpuPercentAvg, cpuFreq,
memAvail, memTotal, memUsed,
memPercent, netBytesRecv,
netBytesSent, netConnections,
bootTime
• TOPIC FILTER: iot/000x/stats
AWS IOT BOOTCAMP – LAB 2
RASPBERRY STATS RULE ES ACTION
10. Click on Add Action  Send
Message to Amazon
Elasticsearch
• DOMAIN NAME: bootcamp
• ENDPOINT: https://search-
bootcamp-
dubcwlclatdifvomglc3kmq3ze.eu-
west-1.es.amazonaws.com
• ID: ${newuuid()}
• INDEX: iot-stats
• Type: stats
• IAM Role Name: iot-device
11. Click on Add Action
AWS IOT BOOTCAMP – LAB 2
MEET KIBANA
1. Open your browser and go to
URL:
• https://search-bootcamp-
dubcwlclatdifvomglc3kmq3ze.
eu-west-
1.es.amazonaws.com/_plugin/
kibana/
2. Set the time filter on the top-
right to  this_month
3. Discover: shows your
indexes
4. Visualize: browse your
charts or create new ones
5. Dashboard: aggregate your
charts and information
AWS IOT BOOTCAMP – LAB 2
MEET KIBANA
6. Click on Visualize  + (Create
New Visualization)  Line
7. Select iot-dht index
8. Choose the metric for Y axis, in
our case the average
temperature
9. Choose the metric for X axis, in
our case the timestamp (Date
Histogram)
10. Click on Play Button and Voilà
AWS IOT BOOTCAMP – LAB 2
CREATE YOUR FIRST DASHBOARD
• Dashboards can hold many
different charts, giving you a wide
insight about your system
• For our IoT system we can keep
track of:
• Temperature and Humidity
Changements Over Time
• Average Temperature and
Humidity Values
• Max Humidity and Temperature
Values
• Total Number of Samples in Our
Analysis
You’re almost half-way!
GOOD JOB!
target
13:00
STREAMING IOT
- LAB 3 -
AWS IOT BOOTCAMP – LAB 3
OVERVIEW
“Now that we have raw metrics from sensors, we would
need to enrich the data with information from other
sources, like a NoSQL Database. We can do that by
adding a Kinesis stream that triggers a pre-processing
lambda function where our business logic is
implemented. We want also to use our custom IoT button
to interact with the shadow of our Raspberry“
AWS IOT BOOTCAMP – LAB 3
OVERVIEW PART 3
AWS IOT
PLATFORM
IoT
topic
IoT
MQTT
protocol
IoT
shadow
IoT
certificate
IoT
rule
IoT
policy
Elastic Search
KinesisLambda
DynamoDB
AWS IoT Button
Grove Sensors
Raspberry Pi + Grove Board
Python IoT SDK
AWS IOT BOOTCAMP – LAB 3
LAB GOALS
1. What is the IoT Button
2. Configure our IoT Button
3. Configure the rule
4. Play with the Button
5. What is DynamoDB
6. Create Kinesis Delivery Stream
7. Create the IoT Rules
8. Review the Kibana Dashboard!
IOT BUTTON
AWS IOT BUTTON
PROGRAMMABLE VERSION OF AMAZON DASH BUTTON
AWS IOT BUTTON
IoT Complete Hardware Device
Characteristics:
 Code in the Cloud
 Learn IoT Rules, Shadow and Topics
Features:
 Wi-Fi Connectivity
 One multi-click Button
 One RGB Led
SAMPLES WITH AND WITHOUT BULLETED TEXT
Device message:
{
"serialNumber": "GXXXXXXXXXXXXXXX",
"batteryVoltage": "mV",
"clickType": "type"
}
Click Type:
 Single
 Double
 Long
AWS IOT BUTTON
AWS IOT BUTTON EXAMPLE WORKFLOW
Private Key
& Certificate
Thing/Device
SDK
AWS Services
Execution Role PolicyPermissionPolicy Rule
AWS IoT
Action
Lambda Function
Rules
Engine
SNS Topic
AWS IOT BOOTCAMP – LAB 3
To configure the IoT Button:
• Create the Thing on the IoT console and Download the certificates
• Press and hold the button until a blue blinking light appears (around 6 sec)
• The button acts as a Wi-Fi access point, so when your computer searches for Wi-Fi
networks, it will find one called Button ConfigureMe - XXX where XXX is a three-
character string generated by the button. Use your computer to connect to the
button's Wi-Fi access point
• The first time you connect to the button's Wi-Fi access point, you will be prompted for
the WPA2-PSK password. Type the last 8 characters of the device serial number
(DSN)
• You can navigate to http://192.168.0.1/index.html in a browser to configure your
button.
CONFIGURE THE IOT BUTTON
AWS IOT BOOTCAMP – LAB 3
MANUAL SETUP PANEL
AWS IOT BOOTCAMP – LAB 3
CONFIGURE THE RULES
1. Create a Rule for each feature of
the IoT Button
• SINGLE CLICK
• DOUBLE CLICK
• LONG CLICK
2. Click on Act  Create
• NAME:
000x_iot_button_to_RedLedON
• ATTRIBUTE: «000x» as deviceId,
«redled» as sensor, «ON» as status
• TOPIC FILTER: iotbutton/xxxxxx
• CONDITION: clickType=«SINGLE»
• ACTION: Invoke a Lambda function
AWS IOT BOOTCAMP – LAB 3
CONFIGURE THE RULES
3. Select the Lambda
function:
• NAME: bootcamp-
lambda-shadow
4. Check the Code of
the Lambda to
understand the
scope
AWS IOT BOOTCAMP – LAB 3
CONFIGURE THE RULES
5. Repeat for Double and Long Click
6. Click on Act  Create
• NAME: 000x_iot_button_to_RedLedOFF
• ATTRIBUTE: «000x» as deviceId,
«redled» as sensor, «OFF» as status
• TOPIC FILTER: iotbutton/xxxxxx
• CONDITION: clickType=«DOUBLE»
• ACTION: Invoke a Lambda function
AWS IOT BOOTCAMP – LAB 3
CONFIGURE THE RULES
7. Select the Lambda
function:
• NAME: bootcamp-
lambda-shadow
AWS IOT BOOTCAMP – LAB 3
CONFIGURE THE RULES
8. Click on Act  Create
• NAME: 000x_iot_button_to_Buzzer
• ATTRIBUTE: «000x» as deviceId,
«BUZZER» as action
• TOPIC FILTER: iotbutton/xxxxxx
• CONDITION: clickType=«LONG»
• ACTION: Invoke a Lambda function
AWS IOT BOOTCAMP – LAB 3
CONFIGURE THE RULES
9. Select the Lambda
function:
• NAME: bootcamp-
lambda-topic
10. Check the Code of
the Lambda to
understand the
scope
You’re almost done!
TAKE A BREATH
AND KEEP GOING!
target
15:00
AMAZON DYNAMODB
FAST AND FLEXIBLE NOSQL DATABASE SERVICE
Partition key Sort key
AMAZON DYNAMODB
STRUCTURE OF A TABLE
Items
PARTITION KEY
• Mandatory
• Key-value
access pattern
• Determines data
distribution
SORT KEY
• Optional
• Model 1:N
relationship
• Enables rich
query capabilities
(==, <, >, contains,..)
AMAZON DYNAMODB
EXAMPLE OF ITEMS IN MUSIC TABLE
{
TableName: "Music",
Item: {
"Artist": "No One You Know",
"SongTitle": "My Dog Spot",
"AlbumTitle":"Hey Now",
"Price": 1.98,
"Genre": "Country",
"CriticRating": 8.4
}
}
{
TableName: "Music",
Item: {
"Artist": "The Acme Band",
"SongTitle": "Still In Love",
"AlbumTitle":"The Buck Starts Here",
"Price": 2.47,
"Genre": "Rock",
"PromotionInfo": {
"RadioStationsPlaying":[
"KHCR", "KBQX", "WTNR", "WJJH"
],
"TourDates": {
"Seattle": "20150625",
"Cleveland": "20150630" },
"Rotation": "Heavy«
}
}
}
{
TableName: "Music",
Item: {
"Artist": "The Acme Band",
"SongTitle": "Look Out, World",
"AlbumTitle":"The Buck Starts Here",
"Price": 0.99,
"Genre": "Rock"
}
}
AWS IOT BOOTCAMP – LAB 3
KINESIS FIREHOSE STREAM TO ES
1. Starting from our Data Source
(AWS IoT), we can create stream
with Amazon Kinesis Firehose.
2. Data can be processed with
Lambda functions before being
send to Elasticsearch
3. Elasticsearch will hold our
enriched data and show them
through Kibana
AWS IOT BOOTCAMP – LAB 3
TEMPERATURE FIREHOSE STREAM
1. Select Kinesis Service in AWS
Console
2. Choose Firehose (Go to the
Firehose Console)
3. Click on Create Delivery Stream
4. Choose stream name
(bootcamp-000x-temperature-
stream)
5. Iot Service will put data directly
in our Stream so choose as
source Direct PUT or other
sources
AWS IOT BOOTCAMP – LAB 3
TEMPERATURE FIREHOSE STREAM
6. Enable record transformation to
allow data enrichment
7. Choose the appropriate lambda
function bootcamp-lambda-
firehose
8. Select $LATEST version of
lambda function
AWS IOT BOOTCAMP – LAB 3
TEMPERATURE FIREHOSE STREAM
9. Choose our stream destination:
Elasticsearch Cluster
 Domain: bootcamp
 Index: iot-kinesis-dht
 Type: temperature
 Retry Duration: 300
AWS IOT BOOTCAMP – LAB 3
TEMPERATURE FIREHOSE STREAM
10. Setup S3 bucket that will hold
data sent to Elasticsearch in
case of failures
 Backup Mode: Failed record
Only
 Backup S3 bucket: bootcamp-
iot-kinesis-firehose
 Backup S3 Bucket Prefix:
000x/temperature/
AWS IOT BOOTCAMP – LAB 3
TEMPERATURE FIREHOSE STREAM
11. Select the Role
 bootcamp-0001-temperature-
stream-role
AWS IOT BOOTCAMP – LAB 3
TEMPERATURE FIREHOSE STREAM
12. Check all details of your new
Kinesis Firehose stream
13. You can jump to our data
processing lambda and to your
S3 bucket
AWS IOT BOOTCAMP – LAB 3
HUMIDITY FIREHOSE STREAM
14. Repeat same steps to create
humidity stream named
bootcamp-000x-humidity-stream
15. Check details on the Detail page
to ensure everything is as
expected
AWS IOT BOOTCAMP – LAB 3
STATS FIREHOSE STREAM
16. Repeat same steps to create
humidity stream named
bootcamp-000x-stats-stream
17. Check details on the Detail page
to ensure everything is as
expected
AWS IOT BOOTCAMP – LAB 3
TEMPERATURE RULE FH ACTION
1. Go back to IoT Console  Click
on Acts  Select
000x_iot_to_es_temperature rule
2. Click on Add Action  Send
Message to an Amazon Kinesis
firehose Stream
• STREAM NAME: bootcamp-000x-
temperature-stream
• SEPARATOR: n (newline)
• IAM Role Name: iot-device
3. Click on Add Action
AWS IOT BOOTCAMP – LAB 3
RASPBERRY STATS RULE FH ACTION
4. Go back to IoT Console  Click
on Acts  Select
000x_iot_to_es_stats rule
5. Click on Add Action  Send
Message to an Amazon Kinesis
firehose Stream
• STREAM NAME: bootcamp-000x-
stats-stream
• SEPARATOR: n (newline)
• IAM Role Name: iot-device
6. Click on Add Action
AWS IOT BOOTCAMP – LAB 3
HUMIDITY RULE FH ACTION
7. Go back to IoT Console  Click
on Acts  Select
000x_iot_to_es_humidity rule
8. Click on Add Action  Send
Message to an Amazon Kinesis
firehose Stream
• STREAM NAME: bootcamp-000x-
humidity-stream
• SEPARATOR: n (newline)
• IAM Role Name: iot-device
9. Click on Add Action
But you’ve not finished yet!
YOU’RE NOW AN
IOT MASTER!
target
16:30
PREDICTIVE
MAINTENANCE
- LAB 4 -
AWS IOT BOOTCAMP – LAB 4
WHAT IS PREDICTIVE MAINTENANCE?
“Predictive maintenance is one of many appealing use
cases for the Internet of Things (IoT). Using sensors to
predict the health of a fleet of machines in the field can
prevent down time without conducting unnecessary
maintenance. Further, predictive maintenance allows for
maintenance to be conducted at the most cost effective
time. Allowing you to shift your operations from being
reactive to proactive.“
AWS IOT BOOTCAMP – LAB 4
OVERVIEW
AWS IOT
PLATFORM
IoT
topic
IoT
MQTT
protocol
IoT
certificate
IoT
rule
IoT
policy
COLLECTED
DATA
Machine
Learning
AWS IOT BOOTCAMP – LAB 4
LAB GOALS
1. Create the Datasource
2. Verify the Schema
3. Select the target to evaluate
4. Create the ML Model
5. Configure the ML model
6. Review Model Performances
7. Create the Real-time Endpoint
8. Configure Alarms and Start the Prediction!
AMAZON MACHINE LEARNING (ML)
CREATING MACHINE LEARNING (ML) MODELS WITHOUT HAVING TO
LEARN COMPLEX ML ALGORITHMS AND TECHNOLOGY.
Will the customer buy this Product?
Is this email spam?
What will the temperature be tomorrow?
Is this book a romance, thriller or adventure story?
AMAZON MACHINE LEARNING (ML)
MACHINE LEARNING PROBLEM TYPES
BINARY
CLASSIFICATION
MULTICLASS
CLASSIFICATION
REGRESSION
28
AMAZON MACHINE LEARNING (ML)
STEPS TO SOLVE A ML PROBLEM
STEP 1: PREPARE YOUR DATA AND LOADING THE DATASET
STEP 2: SPLITTING DATA INTO TRAINING AND TESTING SUBSETS
STEP 3: CREATING ML MODEL USING TRAINING SET
STEP 4: TESTING ML MODEL AGAINST THE TESTING SET
STEP 5: EVALUATING MODEL PERFORMANCE
STEP 6: USE THE ML MODEL TO GENERATE PREDICTIONS
AWS
TASKS
AWS IOT BOOTCAMP – LAB 4
CREATE THE DATASOURCE
AWS IOT BOOTCAMP – LAB 4
VERIFY THE SCHEMA
AWS IOT BOOTCAMP – LAB 4
SELECT THE TARGET TO EVALUATE
AWS IOT BOOTCAMP – LAB 4
CREATE THE MODEL FROM THE DATASOURCE
AWS IOT BOOTCAMP – LAB 4
CONFIGURE THE ML MODEL
AWS IOT BOOTCAMP – LAB 4
REVIEW THE PERFORMANCES OF THE MODEL
AWS IOT BOOTCAMP – LAB 4
CREATE REAL-TIME ENDPOINT
AWS IOT BOOTCAMP – LAB 4
CONFIGURE ALARMS ON CLOUDWATCH
aws cloudwatch put-metric-alarm --alarm-name maintenanceNotification --metric-name maintenance-status --
namespace "pm-metrics" --statistic Maximum --period 60 --evaluation-periods 1 --threshold 1 --
comparison-operator GreaterThanOrEqualToThreshold
aws cloudwatch put-metric-data --metric-name maintenance-status --namespace "pm-metrics" --value 0
To create an alarm based on our predictions, we first need to create an Amazon CloudWatch
metric, then attach an alarm to that metric to let us know when a unit is in need of maintenance.
This can be done through the console or through the AWS CLI (Command Line Inteface)
The alarm will go off if at least one of our units is predicted to need maintenance. It is possible to
configure the alarm to notify via text or email when status is set to ALARM
AWS IOT BOOTCAMP – LAB 4
CONFIGURE ALARMS ON CLOUDWATCH
aws iam create-role --role-name cw_role --assume-role-policy-document file://cw_role.json
Next, we need to create a role with permission to write to Amazon CloudWatch metrics. This role
gives the AWS IoT Rules Engine rule permission to forward our AML predictions to Amazon
CloudWatch.
We create the policy and attach the role to the policy
Finally, we create the Topic Rule, to route the observations to ML Endpoint
aws iot create-topic-rule --rule-name cwAlarm --topic-rule-payload file://cw_rule.json
aws iam create-policy --policy-name cw_policy --policy-document file://cw_policy.json
aws iam attach-role-policy --role-name cw_role --policy-arn arn:aws:iam::192878198312:policy/cw_policy
AWS IOT BOOTCAMP – LAB 4
REVIEW DATA ON CLOUDWATCH
GREENGRASS
AWS IOT GREENGRASS
SAMPLES WITH AND WITHOUT BULLETED TEXT
Respond to Local Events
in Near Real-time
Operate Offline Secure Comunications
Simplified Device Programming
with AWS Lambda
Reduce the Cost of
Running IoT Applications
AWS IOT GREENGRASS
GREENGRASS COMPONENTS
GreenGrass is software, not hardware.
You can use your standard hardware
Components:
 AWS GreenGrass Core
 AWS IoT Device SDK
 AWS GreenGrass Cord SDK
AWS IOT GREENGRASS
GREENGRASS CORE FEAUTRES
GreenGrass Core is responsible for:
 Local Lambda execution
 Local messaging
 Local Device Shadow
 Local Security
 Interacting with the AWS Cloud
AWS IOT GREENGRASS
GREENGRASS CORE REQUIREMENTS
GreenGrass Core requirements:
 Min 1 Single-Core 1GHz
 Min 128MB RAM
 x86 or ARM architecture
 Linux OS
AWS IOT GREENGRASS
GREENGRASS CORE REQUIREMENTS
GreenGrass Core v1.1.0
 x86_64
 ARMv8
 ARMv7
GreenGrass SDK v1.0.0:
 Python 2.7
 Java 8
 Node.js 6.10
THANK YOU
www.reply.com
STORM REPLY IT
Torino – Milano – Roma
STORM REPLY IT
Torino – Milano – Roma
Reply Bootcamp Rome - Mastering AWS - IoT Bootcamp

More Related Content

PPTX
Reply Webinar Online - Mastering AWS - IoT Foundations
PPTX
Reply Webinar Online - Mastering AWS - IoT Advanced
PPTX
Reply Webinar Online - Mastering AWS - DB as a Service
PDF
AWS IoT 및 Mobile Hub 서비스 소개 (김일호) :: re:Invent re:Cap Webinar 2015
PDF
Amazon AWS IoT 利用 AWS IoT 開發智慧家居解決方案
PDF
AWS IoT Services Overview- IoT Core, Monitoring, Analytics by Jake Scherrer
PPTX
AWS IoT introduction
PDF
AWS Innovate: Building an Internet Connected Camera with AWS IoT- Tim Cruse
Reply Webinar Online - Mastering AWS - IoT Foundations
Reply Webinar Online - Mastering AWS - IoT Advanced
Reply Webinar Online - Mastering AWS - DB as a Service
AWS IoT 및 Mobile Hub 서비스 소개 (김일호) :: re:Invent re:Cap Webinar 2015
Amazon AWS IoT 利用 AWS IoT 開發智慧家居解決方案
AWS IoT Services Overview- IoT Core, Monitoring, Analytics by Jake Scherrer
AWS IoT introduction
AWS Innovate: Building an Internet Connected Camera with AWS IoT- Tim Cruse

Similar to Reply Bootcamp Rome - Mastering AWS - IoT Bootcamp (12)

PDF
Connecting the Unconnected: IoT Made Simple
PPTX
IoT Smart Home
PDF
서버리스 IoT 백엔드 개발 및 구현 사례 : 윤석찬 (AWS 테크에반젤리스트)
PDF
AWS IoT 핸즈온 워크샵 - AWS IoT 소개 및  AWS 서비스 연동 방법 (김무현 솔루션즈 아키텍트)
PDF
An Introduction to AWS IoT
PDF
Internet der Ingenieure - reale und virtuelle Welten verschmelzen - AWS IoT W...
PPTX
AWS IoT
PDF
A Smarter World: The Mesh of Interconnected Devices and Artificial Intelligen...
PPTX
Jeremy Cowan's AWS user group presentation "AWS Greengrass & IoT demo"
PDF
Keynote @ IoT World Paris
PDF
AWS NYC Meetup - May 2017 - "AWS IoT and Greengrass"
PDF
Hands-on with AWS IoT
Connecting the Unconnected: IoT Made Simple
IoT Smart Home
서버리스 IoT 백엔드 개발 및 구현 사례 : 윤석찬 (AWS 테크에반젤리스트)
AWS IoT 핸즈온 워크샵 - AWS IoT 소개 및  AWS 서비스 연동 방법 (김무현 솔루션즈 아키텍트)
An Introduction to AWS IoT
Internet der Ingenieure - reale und virtuelle Welten verschmelzen - AWS IoT W...
AWS IoT
A Smarter World: The Mesh of Interconnected Devices and Artificial Intelligen...
Jeremy Cowan's AWS user group presentation "AWS Greengrass & IoT demo"
Keynote @ IoT World Paris
AWS NYC Meetup - May 2017 - "AWS IoT and Greengrass"
Hands-on with AWS IoT
Ad

More from Andrea Mercanti (8)

PPTX
AWS Summit Berlin 2018 - Love is in the Cloud - MassMigration to AWS
PPTX
Reply Xchange Milan - Cloud Automation Services - How to Automate Cloud Servi...
PPTX
Reply Xchange Munich - Love is in the Cloud - MassMigration to AWS
PPTX
AWS Dev Days Tour Germany - Berlin, Cologne, Munich, Frankfurt - Containers T...
PPTX
Reply Webinar Online - Mastering AWS - AI as a Service
PPTX
Reply Xchange Milan - AI as a Service - AWS AI Services
PPTX
Reply Netcamp PoliTo - AWS IoT - Grohe and Caleffi Case Studies
PPTX
Reply Labcamp Rome - AWS Zombie - Serverless and Microservices
AWS Summit Berlin 2018 - Love is in the Cloud - MassMigration to AWS
Reply Xchange Milan - Cloud Automation Services - How to Automate Cloud Servi...
Reply Xchange Munich - Love is in the Cloud - MassMigration to AWS
AWS Dev Days Tour Germany - Berlin, Cologne, Munich, Frankfurt - Containers T...
Reply Webinar Online - Mastering AWS - AI as a Service
Reply Xchange Milan - AI as a Service - AWS AI Services
Reply Netcamp PoliTo - AWS IoT - Grohe and Caleffi Case Studies
Reply Labcamp Rome - AWS Zombie - Serverless and Microservices
Ad

Recently uploaded (20)

PDF
Empathic Computing: Creating Shared Understanding
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Modernizing your data center with Dell and AMD
PPTX
MYSQL Presentation for SQL database connectivity
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
KodekX | Application Modernization Development
PDF
Spectral efficient network and resource selection model in 5G networks
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Network Security Unit 5.pdf for BCA BBA.
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Empathic Computing: Creating Shared Understanding
Understanding_Digital_Forensics_Presentation.pptx
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Chapter 3 Spatial Domain Image Processing.pdf
Modernizing your data center with Dell and AMD
MYSQL Presentation for SQL database connectivity
20250228 LYD VKU AI Blended-Learning.pptx
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Unlocking AI with Model Context Protocol (MCP)
NewMind AI Weekly Chronicles - August'25 Week I
KodekX | Application Modernization Development
Spectral efficient network and resource selection model in 5G networks
Digital-Transformation-Roadmap-for-Companies.pptx
Advanced methodologies resolving dimensionality complications for autism neur...
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Network Security Unit 5.pdf for BCA BBA.
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
How UI/UX Design Impacts User Retention in Mobile Apps.pdf

Reply Bootcamp Rome - Mastering AWS - IoT Bootcamp

  • 1. AWS IOT BOOTCAMP MASTERING AMAZON WEB SERVICES Emiliano Pecis, Andrea Mercanti, Stefano Rosini, Gabriele Stella Storm Reply
  • 2. MASTERING AWS SERIES AGENDA AWS AI as a Service AWS IoT Foundations AWS Database-as-a-service AWS IoT Advanced Bootcamp "Mastering AWS IoT» October 27th in Rome
  • 3. AWS IOT BOOTCAMP OVERVIEW AWS IOT PLATFORM IoT topic IoT MQTT protocol IoT shadow IoT certificate SNS IoT rule IoT policy Elastic Search KinesisLambda Machine Learning DynamoDB Grove Sensors Raspberry Pi + Grove Board AWS IoT Button Python IoT SDK
  • 4. AGENDA AWS IoT LAB 1-2: IoT HighTemp Alarm Lunch Break LAB 3: Streaming IoT Coffee Break LAB 4: Predictive Maintenance Wrap-up 09:00 – 10:00 10:00 – 13:00 13:00 – 14:00 14:00 – 16:30 16:30 – 16:45 16:45 – 17:50 17:50 – 18:00
  • 5. AWS GIVES YOU SUPERPOWERS
  • 6. STORM REPLY THE REPLY’S COMPANY FOCUSED ON AWS 70 Experts CloudArchitects, DevOps, Microservices Architects 50 Top Brand Customers Enel, Vodafone, Ferrero, Volkswagen, ePrimo, Grohe, etc AWS Premier Consulting Partner The only Italian company to have the highest level of certification
  • 7. STORM REPLY THE REPLY’S COMPANY FOCUSED ON AWS Design Services Design and development of solutions in both traditional environment, supplying them as a service-in-the-cloud (providing and managing IaaS), and directly on the cloud, using service architecture (PaaS) and cloud native applications Advisory Services Supply of consulting services for IaaS, SaaS & PaaS solutions: analysis, setup, development, customization, maintenance and, above all, migration from on premises to the cloud. Storm Reply is able to provide both a vision and a strategy for the cloud Managed Services Storm Reply provides Managed Services on top of Cloud Services: System Monitoring, Security Monitoring, System Management, Patch & Change Management. Everything customers need to manage and control can be done by Storm Reply
  • 8. WHAT IS AWS? AMAZON WEB SERVICES
  • 9. AWS GLOBAL INFRASTRUCTURE AWS CLOUD OPERATES 44 AVAILABILITY ZONES WITHIN 16 GEOGRAPHIC REGIONS AROUND THE WORLD EUROPE Ireland Frankfurt London Paris Stockholm
  • 10. ARTIFICIAL INTELLIGENCE ON AWS LEARN, SEE, SPEAK, WRITE MACHINE LEARNING REKOGNITION POLLY LEX
  • 11. DATABASES ON AWS STORE, ORDER, RETRIEVE, MIGRATE RDS DYNAMODB ELASTICACHE REDSHIFT DATABASE MIGRATION SERVICE
  • 12. INTERNET OF THINGS ON AWS HEAR, FEEL, CONTROL, COMMUNICATE IOT GREENGRASS
  • 13. IOT INTRODUCTION WHAT IS IOT? “The Internet of Things (IoT) is a system of interrelated computing devices, mechanical and digital machines, objects with the ability to transfer data over a network without requiring human interaction“
  • 14. IOT INTRODUCTION “A thing, in the Internet of Things, can be a person with a heart monitor implant, a farm animal with a biochip transponder, an automobile or any other natural or man-made object that can be connected.“ WHERE IS IOT?
  • 15. IOT INTRODUCTION “Cloud computing and the IoT have a complimentary relationship. The IoT generates massive amounts of data, and cloud computing provides all the computational resources to store and elaborate this big amount of data“ WHY IOT AND CLOUD?
  • 16. DEVICE SDK Set of client libraries to connect, authenticate and exchange messages DEVICE GATEWAY Communicate with devices via MQTT and HTTP AUTHENTICATION AUTHORIZATION Secure with mutual authentication and encryption RULES ENGINE Transform messages based on rules and route to AWS Services AWS Services - - - - - 3P Services DEVICE SHADOW Persistent thing state during intermittent connections APPLICATIONS DEVICE REGISTRY Identity and Management of your things AWS IOT PLATFORM OVERVIEW
  • 17. MQTT
  • 18. MQTT PROTOCOL MQ Telemetry Transport:  Lightweight protocol designed to optimize the use of resources.  Publish-Subscribe Topic based protocol.  Client-Broker based protocol. OVERVIEW Note: “MQ” does not stand for “Message Queue”. It comes from “MQseries”, the product name of IBM original project.
  • 19. MQTT PROTOCOL FEATURES OVERVIEW – 01 0F 02 Defined Methods  Connect: connect to the broker.  Disconnect: disconnect from the broker.  Subscribe: subscribe to a topic.  Unsubscribe: unsubscribe from a topic.  Publish: publish a message on a topic. Additional Features  Keep Alive: keep the connection to the broker alive  Session Persistence: restore session and topic subscription on a reconnection
  • 20. MQTT PROTOCOL FEATURES OVERVIEW – 02 0F 02 Quality of Service  QoS Level 0: At most once. It guarantees a best effort delivery.  QoS Level 1: At least once. It guarantees that the message will be delivered at least once.  Qos Level 2: Exactly once. It guarantees that the message will be delivered only once. Topic Wildcards  Topic path. home/livingroom/groundfloor/temperature  “+”: Single-level wildcard. home/+/groundfloor/temperature  “#”: Multi-level wildcard. home/#  “$”: Topic reserved for the broker $aws/things/groudfloor/shadow/get
  • 21. DEVICE SDK Set of client libraries to connect, authenticate and exchange messages AUTHENTICATION AUTHORIZATION Secure with mutual authentication and encryption RULES ENGINE Transform messages based on rules and route to AWS Services AWS Services - - - - - 3P Services DEVICE SHADOW Persistent thing state during intermittent connections APPLICATIONS DEVICE REGISTRY Identity and Management of your things AWS IOT DEVICE GATEWAY DEVICE GATEWAY Communicate with devices via MQTT and HTTP
  • 22. DEVICE GATEWAY Powerful Message Broker  Standard Protocol (No Lock-In) MQTT, HTTP, WebSockets  Elastic Pub-Sub Brocker from one to one bilion of connections  Long Live connections support for long-live connection  Secure by default x509 Certs, TLS 1.2, Client Mutual Auth AWS IOT MESSAGE BROKER Subscribers Publishers
  • 23. DEVICE SDK Set of client libraries to connect, authenticate and exchange messages AUTHENTICATION AUTHORIZATION Secure with mutual authentication and encryption DEVICE GATEWAY Communicate with devices via MQTT and HTTP AWS Services - - - - - 3P Services DEVICE SHADOW Persistent thing state during intermittent connections APPLICATIONS DEVICE REGISTRY Identity and Management of your things AWS IOT RULES ENGINE RULES ENGINE Transform messages based on rules and route to AWS Services
  • 24. AWS IOT RULES ENGINE Select DATA from TOPIC where FILTER SQL LIKE CODE Functions:  String manipulation with regex  Mathematical operations  Context-based helper function  Crypto support  UUID, timestamp, rand, etc. Json Collection:  get(array, int) - get item at index  get(string, int) - get char at position  get(object, key) - get value of key Nested Query:  Select (select v from e) From …
  • 25. AWS IOT RULES ENGINE SEND DATA TO OTHER SYSTEMS
  • 26. DEVICE SDK Set of client libraries to connect, authenticate and exchange messages AUTHENTICATION AUTHORIZATION Secure with mutual authentication and encryption RULES ENGINE Transform messages based on rules and route to AWS Services AWS Services - - - - - 3P Services APPLICATIONS DEVICE SHADOW Persistent thing state during intermittent connections DEVICE GATEWAY Communicate with devices via MQTT and HTTP AWS IOT REGISTRY DEVICE REGISTRY Identity and Management of your things
  • 27. AWS IOT REGISTRY Devices connected to AWS IoT are represented by things in the thing registry Thing  Representation of a specific IoT Device. Thing Type  Representation of a family of IoT Devices. STATIC REPRESENTATION OF THINGS Thing Example { "version": 3, "thingName": "MyLightBulb”, "thingTypeName": "StopLight", "attributes": { "model": "123", "wattage": "75" } }
  • 28. DEVICE SDK Set of client libraries to connect, authenticate and exchange messages RULES ENGINE Transform messages based on rules and route to AWS Services DEVICE REGISTRY Identity and Management of your things AWS Services - - - - - 3P Services APPLICATIONS DEVICE SHADOW Persistent thing state during intermittent connections DEVICE GATEWAY Communicate with devices via MQTT and HTTP AWS IOT SECURITY AUTHENTICATION AUTHORIZATION Secure with mutual authentication and encryption
  • 29. AWS IOT SECURITY STRONG THING IDENTITY Mutual Auth TLS  One-Click Certificate Creation  Bring Your Own CSR  Bring Your Own CA
  • 30. DEVICE SDK Set of client libraries to connect, authenticate and exchange messages AUTHENTICATION AUTHORIZATION Secure with mutual authentication and encryption RULES ENGINE Transform messages based on rules and route to AWS Services AWS Services - - - - - 3P Services APPLICATIONS DEVICE REGISTRY Identity and Management of your things DEVICE GATEWAY Communicate with devices via MQTT and HTTP AWS IOT DEVICE SHADOW DEVICE SHADOW Persistent thing state during intermittent connections
  • 31. AWS IOT DEVICE SHADOW DYNAMIC REPRESENTATION OF THINGS { "state" : { "desired" : { "lights": { "color": "RED" }, "engine" : "ON” }, "reported" : { "lights" : { "color": ”BLUE" }, "engine" : "ON” }, "delta" : { "lights" : { "color": "RED" } } } DEVICE Report its current state to one or multiple shadows and retrieve its desired state from shadow. SHADOW Shadow reports delta, desired, and reported states.
  • 32. AWS IOT DEVICE SHADOW DEVICE SHADOW UPDATE FLOW - STEP 07 0F 07
  • 34. AWS IOT PRICING  Pay as you go, no minimum fees.  5$ per million messages published or delivered.  Free Tier of 250K messages per month free (for the first 12 month) PRICING MODEL AWS IOT PLATFORM
  • 36. AWS IOT BOOTCAMP – LAB 1 OVERVIEW W E L C O M E T O T H E S T O R M S M A R T H O M E
  • 37. AWS IOT BOOTCAMP – LAB 1 OVERVIEW “We want to Configure an alarm from different temperature and humidity sensors placed in every room, to alert us when the temperature of a certain place goes over a configurable threshold. A buzzer will inform us if we are close and a message will be sent with a notification to our device“
  • 38. AWS IOT BOOTCAMP – LAB 1 OVERVIEW
  • 39. AWS IOT BOOTCAMP – LAB 1 OVERVIEW AWS IOT PLATFORM IoT topic IoT MQTT protocol IoT certificate SNS IoT rule IoT policy Grove Sensors Raspberry Pi + Grove Board
  • 40. AWS IOT BOOTCAMP – LAB 1 LAB GOALS 1. Assemble the IoT Demo Architecture 2. Familiarize with the AWS IoT Console 3. Create the Thing on AWS IoT 4. Configure the Raspberry Pi 5. Test the environment 6. Understand the Python Code 7. Create Rule on AWS IoT Rules Engine 8. Create SNS Topic 9. Make it Work!
  • 41. AWS IOT BOOTCAMP – LAB 1 1. ASSEMBLE THE IOT DEMO ARCHITECTURE 1. Assemble the Grove Sensors as follows: • A1: TEMP & HUMIDITY SENSOR • D2: RED LED • D3: BUZZER • D4: BUTTON 2. Connect the GrovePi+ to the Raspberry Pi 3. Configure your LAN interface • 192.168.0.100/24 4. Ping the Raspberry via LAN cable • 192.168.0.X0 (X IS YOUR GROUP)
  • 42. AWS IOT BOOTCAMP – LAB 1 2. FAMILIARIZE WITH THE AWS IOT CONSOLE 1. kj https://stormroma.signin.aws.amazon.com/console - Users have been provided to each group Select AWS IoT service Go to Ireland regionIoT usage dashboard Quickstarts Manage things and types Certificates and policies Manage rules MQTT Client test
  • 43. AWS IOT BOOTCAMP – LAB 1 1. Click on Manage  Things 2. Thing Name • 000x (x = group id) 3. Thing Type • Raspberry_pi_bootcamp 4. Thing Attributes • DEVICE_ID • GROUP 5. Create Thing! 3. CREATE THE THING ON AWS IOT
  • 44. AWS IOT BOOTCAMP – LAB 1 6. Click on Security tab 7. Create Certificate 3. CREATE THE THING ON AWS IOT
  • 45. AWS IOT BOOTCAMP – LAB 1 3. CREATE THE THING ON AWS IOT 8. Download: • CERTIFICATE • PRIVATE KEY • PUBLIC KEY 9. Rename the Files in (X = group id): • 000x.cert.pem • 000x.private.key • 000x.public.key 10. Activate the certificate 11. Click on Attach Policy
  • 46. AWS IOT BOOTCAMP – LAB 1 3. CREATE THE THING ON AWS IOT 12. Copy the number of the Certificate 13. Attach Policy • IOT-POLICY 14. CLICK DONE! This is a very open policy! Usually, you would provide more rescrictive rules
  • 47. AWS IOT BOOTCAMP – LAB 1 4. CONFIGURE THE RASPBERRY PI 1. SSH Connect to your Raspberry using the LAN cable • IP: 192.168.0.X • USER: pi • PASSWORD: raspberry 2. Copy certificate, public & private key to: • /home/pi/bootcamp_iot/certs/ 3. Set Date On Raspberry (Cause It Doesn’t Have A HW Clock) • sudo date -s "27 OCT 2017 10:00:00"
  • 48. AWS IOT BOOTCAMP – LAB 1 5. TEST THE ENVIRONMENT 1. Go back to the Console 2. Click on Test 3. Subscribe to topic • iot/000x/# (# is the wildcard)
  • 49. AWS IOT BOOTCAMP – LAB 1 5. TEST THE ENVIRONMENT 4. SSH Connect to your Raspberry using the LAN cable • IP: 192.168.0.X • USER: pi • PASSWORD: raspberry 5. Navigate to /home/pi/bootcamp_iot/ 6. Start the Publish Service • ./start.sh 000X (x is your group)
  • 50. AWS IOT BOOTCAMP – LAB 1 5. TEST THE ENVIRONMENT 7. After few seconds, Check the presence of MQTT messages published in the topics: 8. iot/000X/dht • DATA ABOUT TEMPERATURE AND HUMIDITY 9. iot/000X/stats • STATS ABOUT YOUR DEVICE
  • 51. AWS IOT BOOTCAMP – LAB 1 6. UNDERSTAND THE PYTHON CODE • It uses the AWS IoT Python SDK • Create the AWS IoT Endpoint o Publish in 3 Topic: iot/000x/dht, stats, button o Subscribe in 1 Topic: iot/000x/listen o Define Actions for interact with sensors • BUZZER • BUTTON • BLINKREDLED
  • 52. AWS IOT BOOTCAMP – LAB 1 6. UNDERSTAND THE PYTHON CODE 1. To test the logic behind the Python code, go to Test and try to publish a message to the topic: • iot/000x/listen • «action»: «BLINKREDLED» The raspberry is subscribed to the topic /listen and will react to your message!
  • 53. AWS IOT BOOTCAMP – LAB 1 6. UNDERSTAND THE PYTHON CODE We will now learn how to create a Rule to interact with the sensors 2. Subscribe to Topic iot/000x/button 3. Go to Act and Create Rule to Republish the Topic to iot/000x/listen 4. Push the Button!
  • 55. AWS IOT BOOTCAMP – LAB 1 7. CREATE RULE ON AWS IOT RULES ENGINE 1. Go back to the Console 2. Click on Act  Create • NAME: Tempalarmgroup6 • ACTION: REPUBLISH TO iot/000x/listen • STATEMENT:
  • 56. AWS IOT BOOTCAMP – LAB 1 7. CREATE RULE ON AWS IOT RULES ENGINE BONUS PART 1. Click on «Add Action» • TYPE: SNS Note: Test this feature only if you’re on-time!
  • 57. AWS IOT BOOTCAMP – LAB 1 8. CREATE SNS TOPIC 2. Create a new Topic specific to your group on SNS Service
  • 58. AWS IOT BOOTCAMP – LAB 1 8. CREATE SNS TOPIC 3. Subscribe to Topic by: • E-MAIL (Your E-mail) • SMS (39xxxxxx) 4. Check your e-mail and confirm the subscription
  • 59. AWS IOT BOOTCAMP – LAB 1 8. CREATE SNS TOPIC 5. Configure The Action • SNS TARHET: Your New Sns Topic • MESSAGE FORMAT: RAW • IAM Role: raspberry-iot-bootcamp-role 6. Add the rule TEST THE SENSOR INCREASING THE TEMPERATURE AND… … PAY ATTENTION TO YOUR EARS! 
  • 60. Continue to LAB 2 WELL DONE! target 11:30
  • 62. AWS IOT BOOTCAMP – LAB 2 OVERVIEW PART 2 “We want to store the data gathered from the temperature and humidity sensors, to create a dashboard with real-time and historical data and the main metrics of our sensors. We will use Kibana to create appealing Dashboards.“
  • 63. AWS IOT BOOTCAMP – LAB 2 OVERVIEW PART 2 AWS IOT PLATFORM IoT topic IoT MQTT protocol IoT certificate IoT rule IoT policy Elastic Search Grove Sensors Raspberry Pi + Grove Board
  • 64. AWS IOT BOOTCAMP – LAB 2 LAB GOALS 1. What is ElasticSearch 2. From IoT to ElasticSearch 3. Rules and Actions 4. Meet Kibana 5. Create your first Dashboard!
  • 65. AWS IOT BOOTCAMP – LAB 2 WHAT IS ELASTICSEARCH? • Elasticsearch is a popular open-source search and analytics engine It is often coupled with Kibana, its natural visualization tool • Amazon Elasticsearch Service (Amazon ES) is a managed service that makes it easy to create a domain and deploy, operate, and scale Elasticsearch clusters in the AWS Cloud.
  • 66. AWS IOT BOOTCAMP – LAB 2 FROM IOT TO ELASTICSEARCH • We need to create three different IoT Rules to manage three Topics: • TEMPERATURE /iot/000x/dht • HUMIDITY /iot/000x/dht • RASPBERRY STATISTICS /iot/000x/stats 3 ELASTICSEARCH INDEXES
  • 67. AWS IOT BOOTCAMP – LAB 2 TEMPERATURE RULE 1. Go back to IoT Console 2. Click on Act  Create • NAME: 000x_iot_to_es_temperature • ATTRIBUTE: id, timestamp, temperature • TOPIC FILTER: iot/000x/dht
  • 68. AWS IOT BOOTCAMP – LAB 2 TEMPERATURE RULE ES ACTION 3. Click on Add Action  Send Message to Amazon Elasticsearch • DOMAIN NAME: bootcamp • ENDPOINT: https://search- bootcamp- dubcwlclatdifvomglc3kmq3ze.eu- west-1.es.amazonaws.com • Id: ${newuuid()} • Index: iot-dht • Type: temperature • IAM Role Name: iot-device 4. Click on Add Action
  • 69. AWS IOT BOOTCAMP – LAB 2 HUMIDITY RULE 5. Do the same for the other two rules… 6. Click on Act  Create • NAME: 000x_iot_to_es_humidity • ATTRIBUTE: id, timestamp, humidity • TOPIC FILTER: iot/000x/dht
  • 70. AWS IOT BOOTCAMP – LAB 2 HUMIDITY RULE ES ACTION 7. Click on Add Action  Send Message to Amazon Elasticsearch • DOMAIN NAME: bootcamp • ENDPOINT: https://search- bootcamp- dubcwlclatdifvomglc3kmq3ze.eu- west-1.es.amazonaws.com • ID: ${newuuid()} • INDEX: iot-dht • Type: humidity • IAM Role Name: iot-device 8. Click on Add Action
  • 71. AWS IOT BOOTCAMP – LAB 2 RASPBERRY STATS RULE 9. Click on Act  Create • NAME: 000x_iot_to_es_stats • ATTRIBUTE: id, timestamp, cpuPercent00, cpuPercent01, cpuPercent02, cpuPercent03, cpuPercentAvg, cpuFreq, memAvail, memTotal, memUsed, memPercent, netBytesRecv, netBytesSent, netConnections, bootTime • TOPIC FILTER: iot/000x/stats
  • 72. AWS IOT BOOTCAMP – LAB 2 RASPBERRY STATS RULE ES ACTION 10. Click on Add Action  Send Message to Amazon Elasticsearch • DOMAIN NAME: bootcamp • ENDPOINT: https://search- bootcamp- dubcwlclatdifvomglc3kmq3ze.eu- west-1.es.amazonaws.com • ID: ${newuuid()} • INDEX: iot-stats • Type: stats • IAM Role Name: iot-device 11. Click on Add Action
  • 73. AWS IOT BOOTCAMP – LAB 2 MEET KIBANA 1. Open your browser and go to URL: • https://search-bootcamp- dubcwlclatdifvomglc3kmq3ze. eu-west- 1.es.amazonaws.com/_plugin/ kibana/ 2. Set the time filter on the top- right to  this_month 3. Discover: shows your indexes 4. Visualize: browse your charts or create new ones 5. Dashboard: aggregate your charts and information
  • 74. AWS IOT BOOTCAMP – LAB 2 MEET KIBANA 6. Click on Visualize  + (Create New Visualization)  Line 7. Select iot-dht index 8. Choose the metric for Y axis, in our case the average temperature 9. Choose the metric for X axis, in our case the timestamp (Date Histogram) 10. Click on Play Button and Voilà
  • 75. AWS IOT BOOTCAMP – LAB 2 CREATE YOUR FIRST DASHBOARD • Dashboards can hold many different charts, giving you a wide insight about your system • For our IoT system we can keep track of: • Temperature and Humidity Changements Over Time • Average Temperature and Humidity Values • Max Humidity and Temperature Values • Total Number of Samples in Our Analysis
  • 76. You’re almost half-way! GOOD JOB! target 13:00
  • 78. AWS IOT BOOTCAMP – LAB 3 OVERVIEW “Now that we have raw metrics from sensors, we would need to enrich the data with information from other sources, like a NoSQL Database. We can do that by adding a Kinesis stream that triggers a pre-processing lambda function where our business logic is implemented. We want also to use our custom IoT button to interact with the shadow of our Raspberry“
  • 79. AWS IOT BOOTCAMP – LAB 3 OVERVIEW PART 3 AWS IOT PLATFORM IoT topic IoT MQTT protocol IoT shadow IoT certificate IoT rule IoT policy Elastic Search KinesisLambda DynamoDB AWS IoT Button Grove Sensors Raspberry Pi + Grove Board Python IoT SDK
  • 80. AWS IOT BOOTCAMP – LAB 3 LAB GOALS 1. What is the IoT Button 2. Configure our IoT Button 3. Configure the rule 4. Play with the Button 5. What is DynamoDB 6. Create Kinesis Delivery Stream 7. Create the IoT Rules 8. Review the Kibana Dashboard!
  • 82. AWS IOT BUTTON PROGRAMMABLE VERSION OF AMAZON DASH BUTTON
  • 83. AWS IOT BUTTON IoT Complete Hardware Device Characteristics:  Code in the Cloud  Learn IoT Rules, Shadow and Topics Features:  Wi-Fi Connectivity  One multi-click Button  One RGB Led SAMPLES WITH AND WITHOUT BULLETED TEXT Device message: { "serialNumber": "GXXXXXXXXXXXXXXX", "batteryVoltage": "mV", "clickType": "type" } Click Type:  Single  Double  Long
  • 84. AWS IOT BUTTON AWS IOT BUTTON EXAMPLE WORKFLOW Private Key & Certificate Thing/Device SDK AWS Services Execution Role PolicyPermissionPolicy Rule AWS IoT Action Lambda Function Rules Engine SNS Topic
  • 85. AWS IOT BOOTCAMP – LAB 3 To configure the IoT Button: • Create the Thing on the IoT console and Download the certificates • Press and hold the button until a blue blinking light appears (around 6 sec) • The button acts as a Wi-Fi access point, so when your computer searches for Wi-Fi networks, it will find one called Button ConfigureMe - XXX where XXX is a three- character string generated by the button. Use your computer to connect to the button's Wi-Fi access point • The first time you connect to the button's Wi-Fi access point, you will be prompted for the WPA2-PSK password. Type the last 8 characters of the device serial number (DSN) • You can navigate to http://192.168.0.1/index.html in a browser to configure your button. CONFIGURE THE IOT BUTTON
  • 86. AWS IOT BOOTCAMP – LAB 3 MANUAL SETUP PANEL
  • 87. AWS IOT BOOTCAMP – LAB 3 CONFIGURE THE RULES 1. Create a Rule for each feature of the IoT Button • SINGLE CLICK • DOUBLE CLICK • LONG CLICK 2. Click on Act  Create • NAME: 000x_iot_button_to_RedLedON • ATTRIBUTE: «000x» as deviceId, «redled» as sensor, «ON» as status • TOPIC FILTER: iotbutton/xxxxxx • CONDITION: clickType=«SINGLE» • ACTION: Invoke a Lambda function
  • 88. AWS IOT BOOTCAMP – LAB 3 CONFIGURE THE RULES 3. Select the Lambda function: • NAME: bootcamp- lambda-shadow 4. Check the Code of the Lambda to understand the scope
  • 89. AWS IOT BOOTCAMP – LAB 3 CONFIGURE THE RULES 5. Repeat for Double and Long Click 6. Click on Act  Create • NAME: 000x_iot_button_to_RedLedOFF • ATTRIBUTE: «000x» as deviceId, «redled» as sensor, «OFF» as status • TOPIC FILTER: iotbutton/xxxxxx • CONDITION: clickType=«DOUBLE» • ACTION: Invoke a Lambda function
  • 90. AWS IOT BOOTCAMP – LAB 3 CONFIGURE THE RULES 7. Select the Lambda function: • NAME: bootcamp- lambda-shadow
  • 91. AWS IOT BOOTCAMP – LAB 3 CONFIGURE THE RULES 8. Click on Act  Create • NAME: 000x_iot_button_to_Buzzer • ATTRIBUTE: «000x» as deviceId, «BUZZER» as action • TOPIC FILTER: iotbutton/xxxxxx • CONDITION: clickType=«LONG» • ACTION: Invoke a Lambda function
  • 92. AWS IOT BOOTCAMP – LAB 3 CONFIGURE THE RULES 9. Select the Lambda function: • NAME: bootcamp- lambda-topic 10. Check the Code of the Lambda to understand the scope
  • 93. You’re almost done! TAKE A BREATH AND KEEP GOING! target 15:00
  • 94. AMAZON DYNAMODB FAST AND FLEXIBLE NOSQL DATABASE SERVICE Partition key Sort key
  • 95. AMAZON DYNAMODB STRUCTURE OF A TABLE Items PARTITION KEY • Mandatory • Key-value access pattern • Determines data distribution SORT KEY • Optional • Model 1:N relationship • Enables rich query capabilities (==, <, >, contains,..)
  • 96. AMAZON DYNAMODB EXAMPLE OF ITEMS IN MUSIC TABLE { TableName: "Music", Item: { "Artist": "No One You Know", "SongTitle": "My Dog Spot", "AlbumTitle":"Hey Now", "Price": 1.98, "Genre": "Country", "CriticRating": 8.4 } } { TableName: "Music", Item: { "Artist": "The Acme Band", "SongTitle": "Still In Love", "AlbumTitle":"The Buck Starts Here", "Price": 2.47, "Genre": "Rock", "PromotionInfo": { "RadioStationsPlaying":[ "KHCR", "KBQX", "WTNR", "WJJH" ], "TourDates": { "Seattle": "20150625", "Cleveland": "20150630" }, "Rotation": "Heavy« } } } { TableName: "Music", Item: { "Artist": "The Acme Band", "SongTitle": "Look Out, World", "AlbumTitle":"The Buck Starts Here", "Price": 0.99, "Genre": "Rock" } }
  • 97. AWS IOT BOOTCAMP – LAB 3 KINESIS FIREHOSE STREAM TO ES 1. Starting from our Data Source (AWS IoT), we can create stream with Amazon Kinesis Firehose. 2. Data can be processed with Lambda functions before being send to Elasticsearch 3. Elasticsearch will hold our enriched data and show them through Kibana
  • 98. AWS IOT BOOTCAMP – LAB 3 TEMPERATURE FIREHOSE STREAM 1. Select Kinesis Service in AWS Console 2. Choose Firehose (Go to the Firehose Console) 3. Click on Create Delivery Stream 4. Choose stream name (bootcamp-000x-temperature- stream) 5. Iot Service will put data directly in our Stream so choose as source Direct PUT or other sources
  • 99. AWS IOT BOOTCAMP – LAB 3 TEMPERATURE FIREHOSE STREAM 6. Enable record transformation to allow data enrichment 7. Choose the appropriate lambda function bootcamp-lambda- firehose 8. Select $LATEST version of lambda function
  • 100. AWS IOT BOOTCAMP – LAB 3 TEMPERATURE FIREHOSE STREAM 9. Choose our stream destination: Elasticsearch Cluster  Domain: bootcamp  Index: iot-kinesis-dht  Type: temperature  Retry Duration: 300
  • 101. AWS IOT BOOTCAMP – LAB 3 TEMPERATURE FIREHOSE STREAM 10. Setup S3 bucket that will hold data sent to Elasticsearch in case of failures  Backup Mode: Failed record Only  Backup S3 bucket: bootcamp- iot-kinesis-firehose  Backup S3 Bucket Prefix: 000x/temperature/
  • 102. AWS IOT BOOTCAMP – LAB 3 TEMPERATURE FIREHOSE STREAM 11. Select the Role  bootcamp-0001-temperature- stream-role
  • 103. AWS IOT BOOTCAMP – LAB 3 TEMPERATURE FIREHOSE STREAM 12. Check all details of your new Kinesis Firehose stream 13. You can jump to our data processing lambda and to your S3 bucket
  • 104. AWS IOT BOOTCAMP – LAB 3 HUMIDITY FIREHOSE STREAM 14. Repeat same steps to create humidity stream named bootcamp-000x-humidity-stream 15. Check details on the Detail page to ensure everything is as expected
  • 105. AWS IOT BOOTCAMP – LAB 3 STATS FIREHOSE STREAM 16. Repeat same steps to create humidity stream named bootcamp-000x-stats-stream 17. Check details on the Detail page to ensure everything is as expected
  • 106. AWS IOT BOOTCAMP – LAB 3 TEMPERATURE RULE FH ACTION 1. Go back to IoT Console  Click on Acts  Select 000x_iot_to_es_temperature rule 2. Click on Add Action  Send Message to an Amazon Kinesis firehose Stream • STREAM NAME: bootcamp-000x- temperature-stream • SEPARATOR: n (newline) • IAM Role Name: iot-device 3. Click on Add Action
  • 107. AWS IOT BOOTCAMP – LAB 3 RASPBERRY STATS RULE FH ACTION 4. Go back to IoT Console  Click on Acts  Select 000x_iot_to_es_stats rule 5. Click on Add Action  Send Message to an Amazon Kinesis firehose Stream • STREAM NAME: bootcamp-000x- stats-stream • SEPARATOR: n (newline) • IAM Role Name: iot-device 6. Click on Add Action
  • 108. AWS IOT BOOTCAMP – LAB 3 HUMIDITY RULE FH ACTION 7. Go back to IoT Console  Click on Acts  Select 000x_iot_to_es_humidity rule 8. Click on Add Action  Send Message to an Amazon Kinesis firehose Stream • STREAM NAME: bootcamp-000x- humidity-stream • SEPARATOR: n (newline) • IAM Role Name: iot-device 9. Click on Add Action
  • 109. But you’ve not finished yet! YOU’RE NOW AN IOT MASTER! target 16:30
  • 111. AWS IOT BOOTCAMP – LAB 4 WHAT IS PREDICTIVE MAINTENANCE? “Predictive maintenance is one of many appealing use cases for the Internet of Things (IoT). Using sensors to predict the health of a fleet of machines in the field can prevent down time without conducting unnecessary maintenance. Further, predictive maintenance allows for maintenance to be conducted at the most cost effective time. Allowing you to shift your operations from being reactive to proactive.“
  • 112. AWS IOT BOOTCAMP – LAB 4 OVERVIEW AWS IOT PLATFORM IoT topic IoT MQTT protocol IoT certificate IoT rule IoT policy COLLECTED DATA Machine Learning
  • 113. AWS IOT BOOTCAMP – LAB 4 LAB GOALS 1. Create the Datasource 2. Verify the Schema 3. Select the target to evaluate 4. Create the ML Model 5. Configure the ML model 6. Review Model Performances 7. Create the Real-time Endpoint 8. Configure Alarms and Start the Prediction!
  • 114. AMAZON MACHINE LEARNING (ML) CREATING MACHINE LEARNING (ML) MODELS WITHOUT HAVING TO LEARN COMPLEX ML ALGORITHMS AND TECHNOLOGY. Will the customer buy this Product? Is this email spam? What will the temperature be tomorrow? Is this book a romance, thriller or adventure story?
  • 115. AMAZON MACHINE LEARNING (ML) MACHINE LEARNING PROBLEM TYPES BINARY CLASSIFICATION MULTICLASS CLASSIFICATION REGRESSION 28
  • 116. AMAZON MACHINE LEARNING (ML) STEPS TO SOLVE A ML PROBLEM STEP 1: PREPARE YOUR DATA AND LOADING THE DATASET STEP 2: SPLITTING DATA INTO TRAINING AND TESTING SUBSETS STEP 3: CREATING ML MODEL USING TRAINING SET STEP 4: TESTING ML MODEL AGAINST THE TESTING SET STEP 5: EVALUATING MODEL PERFORMANCE STEP 6: USE THE ML MODEL TO GENERATE PREDICTIONS AWS TASKS
  • 117. AWS IOT BOOTCAMP – LAB 4 CREATE THE DATASOURCE
  • 118. AWS IOT BOOTCAMP – LAB 4 VERIFY THE SCHEMA
  • 119. AWS IOT BOOTCAMP – LAB 4 SELECT THE TARGET TO EVALUATE
  • 120. AWS IOT BOOTCAMP – LAB 4 CREATE THE MODEL FROM THE DATASOURCE
  • 121. AWS IOT BOOTCAMP – LAB 4 CONFIGURE THE ML MODEL
  • 122. AWS IOT BOOTCAMP – LAB 4 REVIEW THE PERFORMANCES OF THE MODEL
  • 123. AWS IOT BOOTCAMP – LAB 4 CREATE REAL-TIME ENDPOINT
  • 124. AWS IOT BOOTCAMP – LAB 4 CONFIGURE ALARMS ON CLOUDWATCH aws cloudwatch put-metric-alarm --alarm-name maintenanceNotification --metric-name maintenance-status -- namespace "pm-metrics" --statistic Maximum --period 60 --evaluation-periods 1 --threshold 1 -- comparison-operator GreaterThanOrEqualToThreshold aws cloudwatch put-metric-data --metric-name maintenance-status --namespace "pm-metrics" --value 0 To create an alarm based on our predictions, we first need to create an Amazon CloudWatch metric, then attach an alarm to that metric to let us know when a unit is in need of maintenance. This can be done through the console or through the AWS CLI (Command Line Inteface) The alarm will go off if at least one of our units is predicted to need maintenance. It is possible to configure the alarm to notify via text or email when status is set to ALARM
  • 125. AWS IOT BOOTCAMP – LAB 4 CONFIGURE ALARMS ON CLOUDWATCH aws iam create-role --role-name cw_role --assume-role-policy-document file://cw_role.json Next, we need to create a role with permission to write to Amazon CloudWatch metrics. This role gives the AWS IoT Rules Engine rule permission to forward our AML predictions to Amazon CloudWatch. We create the policy and attach the role to the policy Finally, we create the Topic Rule, to route the observations to ML Endpoint aws iot create-topic-rule --rule-name cwAlarm --topic-rule-payload file://cw_rule.json aws iam create-policy --policy-name cw_policy --policy-document file://cw_policy.json aws iam attach-role-policy --role-name cw_role --policy-arn arn:aws:iam::192878198312:policy/cw_policy
  • 126. AWS IOT BOOTCAMP – LAB 4 REVIEW DATA ON CLOUDWATCH
  • 128. AWS IOT GREENGRASS SAMPLES WITH AND WITHOUT BULLETED TEXT Respond to Local Events in Near Real-time Operate Offline Secure Comunications Simplified Device Programming with AWS Lambda Reduce the Cost of Running IoT Applications
  • 129. AWS IOT GREENGRASS GREENGRASS COMPONENTS GreenGrass is software, not hardware. You can use your standard hardware Components:  AWS GreenGrass Core  AWS IoT Device SDK  AWS GreenGrass Cord SDK
  • 130. AWS IOT GREENGRASS GREENGRASS CORE FEAUTRES GreenGrass Core is responsible for:  Local Lambda execution  Local messaging  Local Device Shadow  Local Security  Interacting with the AWS Cloud
  • 131. AWS IOT GREENGRASS GREENGRASS CORE REQUIREMENTS GreenGrass Core requirements:  Min 1 Single-Core 1GHz  Min 128MB RAM  x86 or ARM architecture  Linux OS
  • 132. AWS IOT GREENGRASS GREENGRASS CORE REQUIREMENTS GreenGrass Core v1.1.0  x86_64  ARMv8  ARMv7 GreenGrass SDK v1.0.0:  Python 2.7  Java 8  Node.js 6.10
  • 133. THANK YOU www.reply.com STORM REPLY IT Torino – Milano – Roma
  • 134. STORM REPLY IT Torino – Milano – Roma