Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Connecting to AWS IoT

2,740 views

Published on

Learn to capture and push live data into Amazon DynamoDB using AWS IoT and AWS Lambda.

Published in: Technology
  • Be the first to comment

Connecting to AWS IoT

  1. 1. © 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved. John Rotach Software Development Engineer – AWS IoT September 28, 2016 Connecting to AWS IoT Workshop
  2. 2. Agenda • Overview of AWS IoT • AWS IoT Button w/ AWS Lambda • Example with a Device SDK
  3. 3. AWS IoT
  4. 4. AWS IoT
  5. 5. AWS IoT TLS 1.2 Certificate, private key, root CA WebSockets Signature V4 Authentication
  6. 6. AWS IoT Standard Protocol Support MQTT, HTTP, WebSockets Long Lived Connections Receive signals from the cloud Pub Sub Messaging topics
  7. 7. AWS IoT Persistent, Virtual Thing Simplifies programming State Differences in desired, reported
  8. 8. 1. Device Publishes Current State 2. Persist JSON Data Store 3. App requests device’s current state 4. App requests change the state 5. Device Shadow sync’s updated state 6. Device Publishes Current State 7. Device Shadow confirms state change AWS IoT Device Shadow Flow
  9. 9. AWS IoT Device Shadow - Simple Yet Powerful { "state" : { “desired" : { "lights": { "color": "RED" }, "engine" : "ON" }, "reported" : { "lights" : { "color": "GREEN" }, "engine" : "ON" }, "delta" : { "lights" : { "color": "RED" } } }, "version" : 10 } Device Report its current state to one or multiple shadows 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
  10. 10. AWS IoT
  11. 11. AWS IoT - SQL Reference • Like scanning a database table • Default source is an MQTT topic EXAMPLES: • FROM mqtt(‘my/topic’) • FROM mqtt(‘my/wildcard/+/topic’) • FROM (‘my/topic’) SELECT DATA FROM TOPIC WHERE FILTER
  12. 12. AWS IoT
  13. 13. AWS IoT Button Overview • Get connected • Lambda • Show resources created by wizard • Examples from the Internet • Modify Lambda to hit my API
  14. 14. AWS IoT Button http://aws.amazon.com/iot/button
  15. 15. Lambda Wizard Enter DSN, Click Generate certificate and keys Download Certificate & Private Key
  16. 16. Configure Button Follow Steps: WiFi Certificate Private Key Endpoint Subdomain Region
  17. 17. Button AP Mode Press and hold until LED is blue Button ConfigureMe - XXX
  18. 18. Configure Button WiFi Certificate Private Key Endpoint Subdomain Region
  19. 19. MQTT Client Subscribe to: iotbutton/#
  20. 20. Lambda Invoked
  21. 21. What did we build with the wizard? Lambda function IoT - thing - certificate, private key - policy - rule IAM - Lambda execution role
  22. 22. Now What? We have a Lambda – We have the entire Internet
  23. 23. My App Update our Lambda function to hit my HTTP API Serverless (API Gateway + Lambda) Code is in the zip file
  24. 24. Device SDK Overview Connect with NodeJS SDK Shadow Control GPIO
  25. 25. Device SDK https://nodejs.org/en/download/
  26. 26. Device SDK Create Thing
  27. 27. Device SDK Create Thing
  28. 28. Device SDK Create Certificate (one-click)
  29. 29. Device SDK Make a workspace directory Make a certs directory
  30. 30. Device SDK Create Policy
  31. 31. Device SDK Create Policy
  32. 32. Device SDK Attach Policy to Certificate
  33. 33. Device SDK Attach Policy to Certificate
  34. 34. Device SDK Attach Thing to Certificate
  35. 35. Device SDK Attach Thing to Certificate
  36. 36. Device SDK Download SDK Git clone SDK CD into SDK NPM install
  37. 37. Device SDK Download SDK
  38. 38. Device SDK Copy example to examples
  39. 39. Device SDK Edit sample to point to your certificates
  40. 40. Device SDK Walkthrough of example - Mock GPIOs - Shadow update - Delta handling
  41. 41. Device SDK Run
  42. 42. Device SDK Update shadow * don’t forget comma
  43. 43. Thank You! @rotach rotach@amazon.com

×