deep dive on aws iot

33
© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Vadim Jelezniakov | Dev Manager, AWS IoT 19 April 2016 IoT on AWS Deep Dive

Upload: amazon-web-services

Post on 08-Jan-2017

3.408 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Deep Dive on AWS IoT

© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Vadim Jelezniakov | Dev Manager, AWS IoT

19 April 2016

IoT on AWS

Deep Dive

Page 2: Deep Dive on AWS IoT

Goal: Answer these questions

1. How do I extract value from my device data?

Using IoT rules engine to process your data

2. How do I visualize my device data?

Connecting the rules engine to Elasticsearch/Kibana

3. How do I generate predictions?

Using Amazon Machine Learning predict function in

your IoT rules

Page 3: Deep Dive on AWS IoT

AWS IoT

Page 4: Deep Dive on AWS IoT

Back to the questions

1. How do I extract value from my device data?

Using IoT rules engine to process messages

2. How do I visualize my device data?

Connecting the rules engine to Elasticsearch/Kibana

3. How do I generate predictions ?

Using Amazon Machine Learning predict function in

your IoT rules

Page 5: Deep Dive on AWS IoT

Rules Engine

Page 6: Deep Dive on AWS IoT

Rules engine: Extracting value from messages

• Filter messages with certain criteria

• Transform the payload of messages

• React based on messages

• Move messages to other topics

• Move messages to other systems

• Predict changes based on trends

Page 7: Deep Dive on AWS IoT

What is a rule?

ruleArn: arn:aws:iot:<region>:<account_id>:rule/<uniq_rule_name>

rule:

• ruleName: human-readable name

• description: human-readable description

• ruleDisabled: true/false

• sql: e.g. SELECT * FROM ‘pm/topic’

• actions:

• action 1:

• action 2:

Page 8: Deep Dive on AWS IoT

What is a rule?

• ruleName: human-readable name

• description: human-readable description

• ruleDisabled: true/false

• sql: e.g. SELECT * FROM ‘pm/topic’

• actions:

• action 1:

• action 2:

Page 9: Deep Dive on AWS IoT

What is a rule?

• ruleName: human-readable name

• description: human-readable description

• ruleDisabled: true/false

• sql: e.g. SELECT * FROM ‘pm/topic’

• actions:

• action 1:

• action 2:

Page 10: Deep Dive on AWS IoT

Rules engine: Filter and transform

• Filter messages with certain criteria

• Transform the payload of messages

• React based on messages

• Move messages to other topics

• Move messages to other systems

• Predict changes based on trends

Page 11: Deep Dive on AWS IoT

Rules engine: Filter and transform

• SQL

• SELECT * FROM topic WHERE condition

• SELECT status.space_id AS room_id FROM

'iot/tempSensors/#' WHERE temp > 50

• Functions (in SELECT or WHERE)

• String manipulation (regex support)

• Mathematical operations

• Context-based helper functions

• Crypto support

• UUID, timestamp, rand, etc.

Page 12: Deep Dive on AWS IoT

Rules engine: React and move

• Filter messages with certain criteria

• Transform the payload of messages

• React based on messages

• Move messages to other topics

• Move messages to other systems

• Predict changes based on trends

Page 13: Deep Dive on AWS IoT

Rules engine: React (and move)

"rule": {

"ruleName": "republishPredictions”,

"ruleDisabled": false,

"sql": "SELECT no AS id, cycle AS c_number FROM 'pm/topic' WHERE failure = 1",

"description": "Republish ids of engines that are predicted to fail within 30 cycles",

"actions": [

{

"republish": {

"topic": "pm/failures",

"roleArn": "arn:aws:iam::012345678901:role/iot-actions-role”

}

}

],

}

Page 14: Deep Dive on AWS IoT

Rules engine: React (and move)

"rule": {

"ruleName": "republishPredictions”,

"ruleDisabled": false,

"sql": "SELECT no AS id, cycle AS c_number FROM 'pm/topic' WHERE failure = 1",

"description": "Republish ids of engines that are predicted to fail within 30 cycles",

"actions": [

{

"republish": {

"topic": "pm/failures",

"roleArn": "arn:aws:iam::012345678901:role/iot-actions-role”

}

}

],

}

Page 15: Deep Dive on AWS IoT

Rules engine: Move messages to other systems

• Filter messages with certain criteria

• Transform the payload of messages

• React based on messages

• Move messages to other topics

• Move messages to other systems

• Predict changes based on trends

Page 16: Deep Dive on AWS IoT

Rules engine: Move messages to other

systems

Invoke a Lambda function

Put object in an S3 bucket

Insert, update a

DynamoDB table

Publish to an SNS topic

or endpoint

Publish to a Kinesis stream

Publish to Firehose

Republish to AWS IoT

Publish to Elasticsearch

Capture a CloudWatch

metric or change an alarm

Write to SQS queue

Page 17: Deep Dive on AWS IoT

1. How do I extract value from my device data?

Using IoT rules engine to process messages

2. How do I visualize my device data?

Connecting the rules engine to Elasticsearch/Kibana

3. How do I generate predictions?

Using Amazon Machine Learning predict function in

your IoT rules

Page 18: Deep Dive on AWS IoT

1. How do I extract value from my device data ?

Using IoT Rules Engine to process messages

2. How do I visualize my device data?

Connecting the rules engine to Elasticsearch/Kibana

3. How do I generate predictions ?

Using Amazon Machine Learning (AML) predict

function in your IoT Rules

Page 19: Deep Dive on AWS IoT

ElasticSearch Integration - New

Page 20: Deep Dive on AWS IoT

Basic flow for using Elasticsearch

1. Configure your Elasticsearch domain

2. Use an IoT rule to send device data to the

Elasticsearch domain you configured

3. Use Kibana to visualize your device data

Page 21: Deep Dive on AWS IoT
Page 22: Deep Dive on AWS IoT

AWS IoT Elasticsearch demo

Page 23: Deep Dive on AWS IoT

1. How do I extract value from my device data?

Using IoT rules engine to process messages

2. How do I visualize my device data?

Connecting the rules engine to Elasticsearch/Kibana

3. How do I generate predictions?

Using Amazon Machine Learning predict function in

your IoT rules

Page 24: Deep Dive on AWS IoT

1. How do I extract value from my device data ?

Using IoT Rules Engine to process messages

2. How do I visualize my device data ?

Connecting the Rules Engine to ElasticSearch / Kibana

3. How do I generate predictions?

Using Amazon Machine Learning predict function in

your IoT rules

Page 25: Deep Dive on AWS IoT

Failures are often hard to predict

Page 26: Deep Dive on AWS IoT

Importance of the good predictions

Right balance depends on risk/cost ratio:

1. Predict a failure too soon = replacing a part

that doesn’t need repair yet – loss

2. No prediction = risk of sustaining a bigger loss

Page 27: Deep Dive on AWS IoT

Amazon ML Predict Function

Page 28: Deep Dive on AWS IoT

Basic flow for using predictions

1. Use an IoT rule to forward device data to S3

2. Train your Amazon ML model using the data from

S3

3. Use an IoT rule to:

• Obtain predicted value from real-time prediction

endpoint in Amazon ML

• Emit a CloudWatch metric (or trigger an alarm)

4. Use an IoT rule to emit details of a predicted failure

Page 29: Deep Dive on AWS IoT

AWS IoT predict function for Amazon ML

machinelearning_predict(

'ml-XXXXXX',

'arn:aws:iam::<account_id>:role/<role>',

*).predictedLabel

ml-XXXXXX – Amazon ML predictor you trained

account_id – your account ID

role – a role in your account that:

• Has access to Amazon ML

• Part of a trust relationship b/w your account and IoT

Page 30: Deep Dive on AWS IoT

AWS IoT predict demo

Page 31: Deep Dive on AWS IoT

More fun with WebSockets:

predict.vadimj.io

Page 32: Deep Dive on AWS IoT

Summary

• Extract value from device data: rules engine

• Visualize your data: rules engine with

Elasticsearch/Kibana integration

• Using predictions: machinelearning_predict()

Page 33: Deep Dive on AWS IoT

Thank You!@vadimj