© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Michael Garcia, Sr. Technical Program Manager AWS IoT
September 29, 2016
AWS IoTGetting Started
@michaelgarcia__
Today’s webinar
Hands-On
AWS IoT
Get started !
AWS IoT Starter Kit
Challenges
Many SDKs &
Tools
Scalability Security &
Management
Cloud Powered
Apps
Big Data & Analytics &
predictions
AWS IoT
DEVICE SDKSet of client libraries to
connect, authenticate and
exchange messages
DEVICE GATEWAYCommunicate with devices via
MQTT
AUTHENTICATION
AUTHORIZATIONSecure with mutual
authentication and encryption
RULES ENGINETransform messages
based on rules and
route to AWS Services
AWS Services
- - - - -
3P Services
DEVICE SHADOWPersistent thing state
during intermittent
connections
APPLICATIONS
AWS IoT API
HTTP
DEVICE REGISTRYIdentity and Management of
your things
AWS IoT
DEVICE SDKSet of client libraries to
connect, authenticate and
exchange messages
AWS IoT Device SDKs
Arduino Yún
Arduino
Mobile SDKs
Android and iOS
C-SDK
RTOS, μControllers
JS-SDK
Embedded Platforms
Java
Embedded Platforms
Python
Embedded Platforms
https://aws.amazon.com/iot/sdk/
Security and Identity
AUTHENTICATIONSecure with mutual
authentication and encryption
Security and Identity
TLS Mutual Authentication
Fine-Grained Permissions through Policies
Standard Web Security
Mutual Auth TLSwww.mywebsite.com
- Secure Pipe
- Anonymous
- Secure Bi-Directional Pipe
- Mutual Proof of Identity
AWS IoT Authentication & Authorization
Device Gateway
AWS IoT Message Broker
MQTT
MQTT vs HTTPS:
• 93x faster throughput
• 11.89x less battery to send
• 170.9x less battery to receive
• 50% less power to keep connected
• 8x less network overhead
Source:
http://stephendnicholas.com/archives/1217
• OASIS standard protocol (v3.1.1)
• Lightweight, pub-sub, transport protocol
that is useful for connected devices
• MQTT is used on oil rigs, connected
trucks, and many more sensitive and
resource-sensitive scenarios
• Customers have needed to build,
maintain, and scale a broker to use
MQTT with cloud applications
MQTT
Publishers SubscribersTOPIC
‘mytopic’
Publish to ‘mytopic’ Subscribe to ‘mytopic’
MQTT
Publishers SubscribersTOPIC
‘mytopic’
MQTT
Publishers SubscribersTOPIC
‘mytopic1’
‘mytopic2’
‘mytopic3’
AWS IoT Message Broker : managed service
Highly Scalable
Device Gateway
Millions of devices
sending billions of
messages
SubscribersPublishers
Device Registry
THING REGISTRYIdentity and Management of
your things
Device Registry
$ aws --region us-east-1 iot describe-thing --thing-name pump1
{
"attributes": {
"MN": "AB776",
"install_date": "12-23-2011",
"SN": "225458854"
},
"thingName": "pump1",
"defaultClientId": "pump1"
}
Device Shadows
THING SHADOWPersistent thing state
during intermittent
connections
AWS IoT Device Shadows
Device Shadows
{
"state" : {
“desired" : {
"lights": { "color": "RED" },
"engine" : "ON"
},
"reported" : {
"lights" : { "color": "GREEN" },
"engine" : "ON"
},
"delta" : {
"lights" : { "color": "RED" }
} },
"version" : 10
}
Thing
Report its current state to one or multiple shadow
Retrieve its desired state from shadow
Mobile App
Set the desired state of a device
Get the last reported state of the device
Delete the shadow
Shadow
Shadow reports delta, desired
and reported states along with metadata and version
Device Shadows{
"state" : {
“desired" : {
"engine" : "ON”,
“tires”: {
“LF”:40,
“RF”:38,
“LR”:37,
“RR”:39
},
“CCD”: {
“A”:0,
“B”:8,
“C”:7,
“D”:9
}
},
"reported" : {
"engine" : ”OFF”,
“tires”: {
“LF”:40,
“RF”:38,
“LR”:37,
“RR”:39
},
“CCD”: {
“A”:0,
“B”:8,
“C”:7,
“D”:9
}
},
"version" : 10
}
Device Shadows{
"state" : {
“desired" : {
"engine" : ”OFF”,
“tires”: {
“LF”:40,
“RF”:38,
“LR”:37,
“RR”:39
},
“CCD”: {
“A”:0,
“B”:8,
“C”:7,
“D”:9
}
},
"reported" : {
"engine" : ”OFF”,
“tires”: {
“LF”:40,
“RF”:38,
“LR”:37,
“RR”:39
},
“CCD”: {
“A”:0,
“B”:8,
“C”:7,
“D”:9
}
},
"delta" : {
”engine" : “ON”
} },
"version" : 10
}
"engine" : ”OFF”
Device Shadows{
"state" : {
“desired" : {
"engine" : "ON”,
“tires”: {
“LF”:40,
“RF”:38,
“LR”:37,
“RR”:39
},
“CCD”: {
“A”:0,
“B”:8,
“C”:7,
“D”:9
}
},
"reported" : {
"engine" : ”OFF”,
“tires”: {
“LF”:40,
“RF”:38,
“LR”:37,
“RR”:39
},
“CCD”: {
“A”:0,
“B”:8,
“C”:7,
“D”:9
}
},
"delta" : {
”engine" : “ON”
} },
"version" : 10
}
"engine" : ”ON”
Device Shadows{
"state" : {
“desired" : {
"engine" : "ON”,
“tires”: {
“LF”:40,
“RF”:38,
“LR”:37,
“RR”:39
},
“CCD”: {
“A”:0,
“B”:8,
“C”:7,
“D”:9
}
},
"reported" : {
"engine" : ”OFF”,
“tires”: {
“LF”:40,
“RF”:38,
“LR”:37,
“RR”:39
},
“CCD”: {
“A”:0,
“B”:8,
“C”:7,
“D”:9
}
},
"delta" : {
”engine" : “ON”
} },
"version" : 10
}
"engine" : "ON”
Device Shadows{
"state" : {
“desired" : {
"engine" : "ON”,
“tires”: {
“LF”:40,
“RF”:38,
“LR”:37,
“RR”:39
},
“CCD”: {
“A”:0,
“B”:8,
“C”:7,
“D”:9
}
},
"reported" : {
"engine" : ”ON”,
“tires”: {
“LF”:40,
“RF”:38,
“LR”:37,
“RR”:39
},
“CCD”: {
“A”:0,
“B”:8,
“C”:7,
“D”:9
}
},
"version" : 10
}
"engine" : "ON”
AWS IoT Rules Engine actions
RULES ENGINETransform messages
based on rules and
route to AWS Services
AWS Services
- - - - -
3P Services
AWS Services
- - - - -
3P Services
AWS IoT Rules Engine
Rules Engine
building1/chillers/xx881
building1/fans/aj982
building3/chillers/ks434
building1/radiators/ss243
building2/chillers/fe324
"sql": "SELECT * FROM 'building1/#'"
"actions": [{ "dynamoDB":….
Rules Engine
building1/chillers/xx881
building1/fans/aj982
building3/chillers/ks434
building1/radiators/ss243
building2/chillers/fe324
"sql": "SELECT * FROM 'building1/#'"
"actions": [{ "dynamoDB":….
AWS IoT Rules Engine
SELECT DATA FROM TOPIC WHERE FILTER
THEN ACTION
AWS IoT – SQL Reference
SELECT DATA FROM…
• SELECT *
• SELECT deviceid, temp
• SELECT coords.latitude
• SELECT a.another_level.b
• Returns {“b” : 3}
• SELECT a..b
• Returns {“b” : 3}
{
“deviceid” : “iot123”,
“temp” : 54,
“humidity” : 32,
“coords” : {
“latitude” : 47.615694,
“longitude” : -122.3359976
},
“a” : {
“another_level” : {
{“b” : 3},
{“b” : 5}
}}
}
SAMPLE PAYLOAD
AWS IoT – SQL Reference
SELECT DATA FROM…
• SELECT deviceid AS client
• SELECT md5(deviceid) AS hashed_id
Substitution Templates
• ${expression}
• ${topic() - md5(deviceid)}
• ${deviceid - temp}
{
“deviceid” : “iot123”,
“temp” : 54,
“humidity” : 32,
“coords” : {
“latitude” : 47.615694,
“longitude” : -122.3359976
},
“a” : {
“another_level” : {
{“b” : 3},
{“b” : 5}
}}
}
SAMPLE PAYLOAD
AWS IoT – SQL Reference
SELECT DATA FROM TOPIC WHERE FILTER
• Like scanning a database table
• Default source is an MQTT topic
EXAMPLES:
• FROM mqtt(‘my/topic’)
• FROM mqtt(‘my/wildcard/+/topic’)
• FROM (‘my/topic’)
AWS IoT – SQL Reference
SELECT DATA FROM TOPIC WHERE FILTER
Token Meaning Example
= Equal, comparison color = 'red'
<> Not Equal, comparison color <> 'red'
AND Logical AND color = 'red' AND siren = 'on'
OR Logical OR color = 'red' OR siren = 'on'
() Parenthesis, grouping color = 'red' AND (siren = 'on' OR isTest)
+ Addition, arithmetic 5 + 3
- Substitution, arithmetic 5 - 4
/ Division, arithmetic 8 / 2
AWS IoT – SQL Reference
SELECT DATA FROM TOPIC WHERE FILTER
THEN ACTION
LambdaSNS SQS
S3 Amazon KinesisDDB RDS
Amazon
Redshift
Amazon Glacier
EC2
3rd party
AWS IoT Starter Kit
AWS IoT Starter Kits
Hands-On
Hands-On !
Get started !
Pricing
• Pay as you go. No minimum fees.
• $5 per million messages published to, or delivered
by, AWS IoT.
• Free Tier: 250,000 messages per month for 12
months.
AWS IoT
https://aws.amazon.com/
Re:Invent 2015 Mobile & IoT
Source:
https://www.youtube.com/playlist?list=PLhr1KZpdzukcBfuUdMOKc94mnrQhBpdmw
Resources
http://aws.amazon.com/iot/developer-resources/
http://aws.amazon.com/iot/getting-started/
Monday, October 24, 2016
JW Marriot Austin
https://aws.amazon.com/events/devday-
austin
Free, one-day developer event featuring tracks, labs,
and workshops around Serverless, Containers, IoT,
and Mobile
Thank you!