Amazon Web Services IoT is a managed cloud service that enables Internet-connected things to easily and securely interact with each other and cloud resources. We dive into demo applications that tie together physical IoT devices, web browsers and identity providers to create smart, connected applications using Amazon Web Services.
Speaker: Adam Larter, Solutions Architect, Amazon Web Services
3. What is a ‘Thing’?
• iPad’s and Mobile Phones are “things”
• Laptops can be “things”
• Biochips are definitely “things”
• Maker devices – Arduinos, Raspberry Pis, Edisons - are “things”
• M2M devices are a common “thing”
• If it’s using MQTT, has a certificate, and an IP address then it’s a
Thing
4.
5. AWS IoT
DEVICE SDK
Set of client libraries to
connect, authenticate and
exchange messages
DEVICE GATEWAY
Communicate with devices via
MQTT and HTTP
AUTHENTICATION
AUTHORISATION
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
AWS
IoT API
DEVICE REGISTRY
Identity and management of
your things
10. AWS IoT
DEVICE SDK
Set of client libraries to
connect, authenticate and
exchange messages
DEVICE GATEWAY
Communicate with devices via
MQTT and HTTP
AUTHENTICATION
AUTHORISATION
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
AWS
IoT API
DEVICE REGISTRY
Identity and management of
your things
11. Device Shadow
Plan for devices to lose connectivity
• Device may need to shut down when idle to conserve battery.
• Device may be stable, but the network could be unreliable.
Send devices commands through Shadows
• Instead of wrangling custom topics and keeping state yourself, use the
Device Shadow to abstract away the topics and connectivity issues.
Query device state through Shadows
• The Device Shadow is always available, even if the device is not.
12. Thing
reported
state
desired
state
MQTT
AWS Lambda
The device itself is the
source of truth for the
‘reported’ state.
Interested parties set
the ‘desired’ state to
request a change to the
state of the device.
Device Shadow
13. ‘Desired’ State
Used to request a change to device state
• Interested parties request device state change through the JSON payload.
Difference between ‘reported’ and ‘desired’
triggers a ‘delta’ message to the device
• The AWS IoT device shadow compares the ‘reported’ state with the ‘desired’
state, and any properties of ‘desired’ not present or different in the ‘reported’
state are notified via a ‘delta’ message.
16. IoT certificate and
private key IoT policyAWS IoT
IoT ‘Thing’
LightBulb
+
MQTT topics
AWS IoT – Securing Device Connections
Certificate provisioned
by device manufacturer
AWS IoT has the public key to
confirm the authenticity of the
certificate and the connection
between the Thing and the
AWS IoT service is encrypted
Based on the certificate presented
by the Thing, the associated IoT
Policy is applied to allow/deny
actions to resources (such as
publishing to certain MQTT topics)
17. AWS IoT
DEVICE SDK
Set of client libraries to
connect, authenticate and
exchange messages
DEVICE GATEWAY
Communicate with devices via
MQTT and HTTP
AUTHENTICATION
AUTHORISATION
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
AWS
IoT API
DEVICE REGISTRY
Identity and management of
your things
18. Example IoT Rule
SELECT state.reported.info as info
FROM '$aws/things/sensorBox/shadow/update'
WHERE state.reported.target="LightBulb"
Just the ‘info’ property in the
reported state message
Only messages that have a
‘target’ value set to ‘LightBulb’
19. AWS Lambda
Zero Administration
• Focus on business logic, not infrastructure
• Upload your code & Lambda handles everything else
Auto Scaling
• Lambda scales the infrastructure as needed to match the event rate
and pay as you go
Bring Your Own Code
• Python, NodeJS & Java supported now with other languages coming
• Create threads and processes, run batch scripts or other exe’s
21. AWS IoT SDKs
Supported languages / environments
• Python
• Embedded C
• iOS
• Android
• Javascript
• NodeJS
• Java
• Arduino Yun
Support device shadow and custom topics
• Built on top of Paho MQTT client library, the SDK abstracts the
device shadow but allows direct pub/sub
Fully documented
• Rich documentation with examples on GitHub
22. This call initialises the
thing shadow, passing in
the X.509 certificate and
key needed to secure the
connection.
AWS IoT SDK Abstraction
23. Listen for callbacks –
standard event-driven
model in NodeJS.
AWS IoT SDK Abstraction
32. Amazzon
Kinesis
Stream
Shard / Partition
Lambda functions
as adapters
Serverless Event Bus – Event-driven
Amazon
API
Gateway
AWS
Lambda
AWS IoT
message broker
External data
provider
Page submits request
and then subscribes to
a topic over which it
receives notification events
when data is ready
33. Connecting the Disconnected
• What happens when the world can access
connected devices that cost less than $5? Or $3?
• What will we learn when we have access to more
information about the world around us in real-time?
• What if you could interact with and change the world
around you at massive scale?
What Will You Build?