Upgrade to Pro — share decks privately, control downloads, hide ads and more …

serverless IoT-applications

Niko Will
September 21, 2017

serverless IoT-applications

Softwareentwickler sehen sich heutzutage mit einer Vielzahl von Anforderungen konfrontiert. Bereits das Verstehen der Domäne für die Implementierung der Geschäftslogik kann beliebig komplex werden. Hinzu kommen nun immer mehr Themen wie Skalierung und Ausfallsicherheit. Ganz zu schweigen von Benutzerauthentifizierung und -autorisierung oder Logging, Monitoring und Betrieb der Anwendung. Im IoT-Umfeld bereiten uns zusätzlich noch die Anbindung von Geräten über unsichere und instabile Verbindungen Kopfzerbrechen.

Andererseits bieten mittlerweile viele der großen Cloud-Plattformen zusätzlich zu Datenbanken und Messaging-Systemen auch ein reiches Portfolio an Diensten, die speziell auf die Bedürfnisse von IoT-Applikationen zugeschnitten sind. In Kombination mit serverlosen Funktionen lassen sich so bereits in einigen Tagen bis wenigen Wochen erste Konzepte praktisch erproben oder sogar komplett umsetzen. Darüber hinaus kann durch den Verzicht auf eigene Backend-Services ein Großteil der typischen Betriebsthemen entfallen.

Dieser Vortrag zeigt am Beispiel von Amazon Web Services (AWS), wie sich Geräte schnell und sicher an eine Cloud-Plattform anbinden lassen. Außerdem lernen die Teilnehmer, wie sie durch Kombination der vorhandenen Dienste und einiger weniger serverloser Funktionen zu einer produktiv einsetzbaren IoT-Applikation kommen.

Niko Will

September 21, 2017
Tweet

More Decks by Niko Will

Other Decks in Programming

Transcript

  1. @n1ko_w1ll about me > Developer since 2005 > living in

    a Smarthome since 2012 > became an IoT Geek > before: worked on Bosch IoT Suite for 2 years > now: Consultant at innoQ > follow me on Twitter: @n1ko_w1ll
  2. @n1ko_w1ll agenda > microservices approach > AWS, Lambda & IoT

    > use-cases > JITR | on-boarding | pairing > list / search things | command & control | telemetry > connected / disconnected / LWT > encrypted file transfer | firmware update
  3. @n1ko_w1ll microservices approach thing mobile client browser IoT-application API Gateway

    MQTT Broker database Users Devices Policies Rules Analytics …
  4. @n1ko_w1ll microservices approach API Gateway MQTT Broker database Devices …

    microservices Devices Devices … … Message Broker Service Discovery IAM Keystore API Gateway API Gateway MQTT Broker MQTT Broker Service Discovery Service Discovery Message Broker Message Broker IAM IAM Keystore HSM docker / kubernetes
  5. @n1ko_w1ll microservices approach Devices microservices docker / kubernetes Alert Manager

    prometheus Grafana fluentd Kibana elasticsearch operations (DevOps) logging monitoring alerting
  6. @n1ko_w1ll AWS Amazon S3 Amazon Elasticsearch Amazon Kinesis Amazon SNS

    Amazon SQS Amazon DynamoDB Amazon Cognito Amazon API Gateway AWS Lambda Amazon CloudWatch AWS IoT State Fast Data
  7. @n1ko_w1ll AWS Lambda > Functions-as-a-Service (FaaS) > serverless > „small“

    functions > stateless compute containers > event-driven
  8. @n1ko_w1ll AWS Lambda > advantages > scalable > pay-per-execution /

    pay-as-you-go > no upfront capacity planning > significantly reduce operational cost
  9. @n1ko_w1ll AWS Lambda > disadvantages > vendor lock-in > startup

    latency > testing > debugging > execution duration
  10. @n1ko_w1ll AWS IoT > managed service > message broker >

    rules engine > shadows > registry > security
  11. @n1ko_w1ll message broker > topic based > publish / subscribe

    > topic wildcards > protocols > MQTT > MQTT + WebSockets > HTTP $aws/events/presence/connected/clientId $aws/events/presence/disconnected/clientId $aws/things/thingName/shadow/update $aws/things/thingName/shadow/update/delta
  12. @n1ko_w1ll rules engine > SQL-like syntax > augument or filter

    data > rule actions > state stores > fast data pipelines > CloudWatch > Lambda > republish SELECT *, newuuid() AS requestId, clientId() AS clientId, timestamp() AS timestamp, topic(2) AS deviceId, topic(4) AS sensorId FROM 'device/+/sensor/+/v1' WHERE temperature > 50 AND color <> 'red'
  13. @n1ko_w1ll shadows > JSON document > current state of thing

    > connection independent > supports client tokens > supports versioning > MQTT topics > RESTful API { "state" : { "desired" : { "color" : "RED" }, "reported" : { "color" : „GREEN" } }, "metadata" : { "desired" : { "color" : { "timestamp" : 12345 } }, "reported" : { "color" : { "timestamp" : 12345 } } }, "version" : 10, "clientToken" : "UniqueClientToken", "timestamp": 123456789 }
  14. @n1ko_w1ll registry > manage your things > physical device or

    sensor > logical entity > attributes > thing types { "version": 3, "thingName": "MyLightBulb", "defaultClientId": "MyLightBulb", "thingTypeName": "LightBulb", "attributes": { "model": "123", "wattage": "75" } }
  15. @n1ko_w1ll security > mutual authentication with X509 certificates + TLS

    1.2 > or SigV4 for HTTPS and WebSockets > bring your own certificate > JITR > Atmel ECC508 > policy based access with dynamic values > role based rules action execution
  16. @n1ko_w1ll just in time registration (JITR) thing AWS IoT Device

    Registry $aws/events/certificates/ registered/caCertificateID IoT Policy IoT Rule AWS Lambda
  17. @n1ko_w1ll thing IoT Policy Device Shadow mobile client AWS Lambda

    Amazon Cognito Amazon API Gateway AWS IoT thing pairing exchange OAuth token for AWS credentials
  18. @n1ko_w1ll list / search things things mobile client AWS Lambda

    Amazon Cognito Amazon API Gateway AWS IoT Amazon DynamoDB
  19. @n1ko_w1ll command & control thing mobile client AWS Lambda Amazon

    Cognito Amazon API Gateway AWS IoT Device Shadow
  20. @n1ko_w1ll command & control thing Amazon Cognito AWS IoT Amazon

    Echo AWS Lambda Alexa Skill Device Shadow
  21. @n1ko_w1ll { "state": { "reported": { "connected": true } }

    } { "state": { "reported": { "connected": true } } } connected / disconnected / LWT Device Shadow thing AWS IoT shadow update topic
  22. @n1ko_w1ll { "state": { "reported": { "connected": true } }

    } { "state": { "reported": { "connected": false } } } { "state": { "reported": { "connected": false } } } connected / disconnected / LWT Device Shadow thing AWS IoT shadow update topic
  23. @n1ko_w1ll { "state": { "reported": { "connected": true } }

    } { "state": { "reported": { "connected": false } } } connected / disconnected / LWT Device Shadow thing AWS IoT LWT rule custom LWT topic LWT { "state": { "reported": { "connected": false } } } shadow update topic republish
  24. @n1ko_w1ll summary > scalable plattform > common IoT use-cases >

    w/o own infrastructure > w/o upfront capacity planning > very secure > very extensible
  25. @n1ko_w1ll Thank you. Questions? Comments @n1ko_w1ll Niko Will [email protected] innoQ

    Deutschland GmbH Krischerstr. 100 40789 Monheim am Rhein Germany Phone: +49 2173 3366-0 innoQ Schweiz GmbH Gewerbestr. 11 CH-6330 Cham Switzerland Phone: +41 41 743 0116 www.innoq.com Ohlauer Straße 43 10999 Berlin Germany Phone: +49 2173 3366-0 Ludwigstr. 180E 63067 Offenbach Germany Phone: +49 2173 3366-0 Kreuzstraße 16
 80331 München Germany Phone: +49 2173 3366-0