Transcript
Page 1: Jan Metzner - Amazon Web Servicesaws-de-media.s3.amazonaws.com/images/Webinar/IoT...AWS IoT DEVICE SDK Set of client libraries to connect, authenticate and exchange messages MESSAGE

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

Jan Metzner Solutions Architect Mobile/IoT EMEA, Amazon Web Services

Page 2: Jan Metzner - Amazon Web Servicesaws-de-media.s3.amazonaws.com/images/Webinar/IoT...AWS IoT DEVICE SDK Set of client libraries to connect, authenticate and exchange messages MESSAGE

Welche Themen werden wir in diesem Webinar behandeln?

•  Authentifizierung und Authorisierung •  Kommunikation über das Device/Thing Shadow

Page 3: Jan Metzner - Amazon Web Servicesaws-de-media.s3.amazonaws.com/images/Webinar/IoT...AWS IoT DEVICE SDK Set of client libraries to connect, authenticate and exchange messages MESSAGE

AWS IoT

DEVICE SDK Set of client libraries to

connect, authenticate and exchange messages

MESSAGE BROKER Communicate with devices via

MQTT and HTTP

AUTHENTICATION AUTHORIZATION

Secure with mutual authentication and encryption

RULES ENGINE Transform messages based on rules and

route to AWS Services

AWS Services - - - - -

3P Services

SHADOW Persistent thing state

during intermittent connections

APPLICATIONS

AWS IoT API

REGISTRY Identity and Management of

your things

Page 4: Jan Metzner - Amazon Web Servicesaws-de-media.s3.amazonaws.com/images/Webinar/IoT...AWS IoT DEVICE SDK Set of client libraries to connect, authenticate and exchange messages MESSAGE

Talking to Things

DynamoDB Lambda Amazon Kinesis

Page 5: Jan Metzner - Amazon Web Servicesaws-de-media.s3.amazonaws.com/images/Webinar/IoT...AWS IoT DEVICE SDK Set of client libraries to connect, authenticate and exchange messages MESSAGE

Mutual Auth TLS

Page 6: Jan Metzner - Amazon Web Servicesaws-de-media.s3.amazonaws.com/images/Webinar/IoT...AWS IoT DEVICE SDK Set of client libraries to connect, authenticate and exchange messages MESSAGE

Talking to Non-Things

DynamoDB Lambda Amazon Kinesis

Page 7: Jan Metzner - Amazon Web Servicesaws-de-media.s3.amazonaws.com/images/Webinar/IoT...AWS IoT DEVICE SDK Set of client libraries to connect, authenticate and exchange messages MESSAGE

AWS Auth + TLS

Page 8: Jan Metzner - Amazon Web Servicesaws-de-media.s3.amazonaws.com/images/Webinar/IoT...AWS IoT DEVICE SDK Set of client libraries to connect, authenticate and exchange messages MESSAGE

One Service, Two Protocols

MQTT + Mutual Auth TLS AWS Auth + HTTPS

Server Auth TLS + Cert TLS + Cert

Client Auth TLS + Cert AWS API Keys

Confidentiality TLS TLS

Protocol MQTT HTTP

Page 9: Jan Metzner - Amazon Web Servicesaws-de-media.s3.amazonaws.com/images/Webinar/IoT...AWS IoT DEVICE SDK Set of client libraries to connect, authenticate and exchange messages MESSAGE

Back To Certs and Keys

Page 10: Jan Metzner - Amazon Web Servicesaws-de-media.s3.amazonaws.com/images/Webinar/IoT...AWS IoT DEVICE SDK Set of client libraries to connect, authenticate and exchange messages MESSAGE

AWS-Generated Keypair

CreateKeysAndCertificate()!

Page 11: Jan Metzner - Amazon Web Servicesaws-de-media.s3.amazonaws.com/images/Webinar/IoT...AWS IoT DEVICE SDK Set of client libraries to connect, authenticate and exchange messages MESSAGE

Actual Commands

$ aws iot create-keys-and-certificate --set-as-active { "certificateArn": "arn:aws:iot:us-east-1:123456972007:cert/d7677b0…SNIP…026d9",

"certificatePem": "-----BEGIN CERTIFICATE-----…SNIP…-----END CERTIFICATE-----", "keyPair": {

"PublicKey": "-----BEGIN PUBLIC KEY-----…SNIP…-----END PUBLIC KEY-----", "PrivateKey": "-----BEGIN RSA PRIVATE KEY-----…SNIP…-----END RSA PRIVATE KEY-----"

}, "certificateId": "d7677b0…SNIP…026d9"

}

Page 12: Jan Metzner - Amazon Web Servicesaws-de-media.s3.amazonaws.com/images/Webinar/IoT...AWS IoT DEVICE SDK Set of client libraries to connect, authenticate and exchange messages MESSAGE

CreateKeysAndCertificate()!

AWS-Generated Keypair

Page 13: Jan Metzner - Amazon Web Servicesaws-de-media.s3.amazonaws.com/images/Webinar/IoT...AWS IoT DEVICE SDK Set of client libraries to connect, authenticate and exchange messages MESSAGE

Client Generated Keypair

CSR

Page 14: Jan Metzner - Amazon Web Servicesaws-de-media.s3.amazonaws.com/images/Webinar/IoT...AWS IoT DEVICE SDK Set of client libraries to connect, authenticate and exchange messages MESSAGE

Client Generated Keypair

CSR

CreateCertificateFromCSR(CSR)!

Page 15: Jan Metzner - Amazon Web Servicesaws-de-media.s3.amazonaws.com/images/Webinar/IoT...AWS IoT DEVICE SDK Set of client libraries to connect, authenticate and exchange messages MESSAGE

Actual Commands

$ openssl genrsa –out ThingKeypair.pem 2048 Generating RSA private key, 2048 bit long modulus ....+++ ...+++

e is 65537 (0x10001)

$ openssl req -new –key ThingKeypair.pem –out Thing.csr ----- Country Name (2 letter code) [XX]:US State or Province Name (full name) []:NY Locality Name (eg, city) [Default City]:New York Organization Name (eg, company) [Default Company Ltd]:ACME Organizational Unit Name (eg, section) []:Makers Common Name (eg, your name or your server's hostname) []:John Smith Email Address []:[email protected]

Page 16: Jan Metzner - Amazon Web Servicesaws-de-media.s3.amazonaws.com/images/Webinar/IoT...AWS IoT DEVICE SDK Set of client libraries to connect, authenticate and exchange messages MESSAGE

Actual Commands

$ aws iot create-certificate-from-csr \ --certificate-signing-request file://Thing.csr \

--set-as-active

{

"certificateArn":

"arn:aws:iot:us-east-1:123456972007:cert/b5a396e…SNIP…400877b",

"certificatePem":

"-----BEGIN CERTIFICATE-----…SNIP…-----END CERTIFICATE-----",

"certificateId":

"b5a396e…SNIP…400877b"

}

Page 17: Jan Metzner - Amazon Web Servicesaws-de-media.s3.amazonaws.com/images/Webinar/IoT...AWS IoT DEVICE SDK Set of client libraries to connect, authenticate and exchange messages MESSAGE

Private Key Protection – Test & Dev

$ openssl genrsa -out ThingKeypair.pem 2048 Generating RSA private key, 2048 bit long modulus ......................+++ .................................+++

e is 65537 (0x10001) $ ls -l ThingKeypair.pem

-rw-rw-r-- 1 ec2-user ec2-user 1679 Sep 25 14:10 ThingKeypair.pem

$ chmod 400 ThingKeypair.pem ; ls -l ThingKeypair.pem -r-------- 1 ec2-user ec2-user 1679 Sep 25 14:10 ThingKeypair.pem

Page 18: Jan Metzner - Amazon Web Servicesaws-de-media.s3.amazonaws.com/images/Webinar/IoT...AWS IoT DEVICE SDK Set of client libraries to connect, authenticate and exchange messages MESSAGE

Private Key Protection – Software Threats

chroot SELinux OTP Fuses

Page 19: Jan Metzner - Amazon Web Servicesaws-de-media.s3.amazonaws.com/images/Webinar/IoT...AWS IoT DEVICE SDK Set of client libraries to connect, authenticate and exchange messages MESSAGE

Private Key Protection – Hardware Threats

TPMs Smartcards Locks and Boxes FIPS-style hardware

Page 20: Jan Metzner - Amazon Web Servicesaws-de-media.s3.amazonaws.com/images/Webinar/IoT...AWS IoT DEVICE SDK Set of client libraries to connect, authenticate and exchange messages MESSAGE

Identity Federation

DynamoDB Lambda Amazon Kinesis

Page 21: Jan Metzner - Amazon Web Servicesaws-de-media.s3.amazonaws.com/images/Webinar/IoT...AWS IoT DEVICE SDK Set of client libraries to connect, authenticate and exchange messages MESSAGE

Data Access Control – AWS APIs

DynamoDB Lambda Amazon Kinesis

{ "Version":"2012-10-17", "Statement":[ { "Effect":"Allow", "Action":[ "iot:Connect" ], "Resource":"*" }, { "Effect":"Allow", "Action":[ "iot:GetThingShadow" ], "Resource":[ "arn:aws:iot:us-east-1:123456972007:thing/MyThing"] }, { "Effect":"Allow", "Action":[ "iot:Publish" ], "Resource":[ "arn:aws:iot:us-east-1:123456972007: topic/$aws/things/MyThing/shadow/update"] } ] }

Page 22: Jan Metzner - Amazon Web Servicesaws-de-media.s3.amazonaws.com/images/Webinar/IoT...AWS IoT DEVICE SDK Set of client libraries to connect, authenticate and exchange messages MESSAGE

Mobile Users as Things

DynamoDB Lambda Amazon Kinesis

{ "Version":"2012-10-17", "Statement":[ { "Effect":"Allow", "Action":[ "iot:Connect" ], "Resource":"*" }, { "Effect":"Allow", "Action":[ "iot:GetThingShadow" ], "Resource":[ "arn:aws:iot:us-east-1:123456972007: thing/${cognito-identity.amazonaws.com:aud}"] }, { "Effect":"Allow", "Action":[ "iot:Publish" ], "Resource":[ "arn:aws:iot:us-east-1:123456972007:topic/$aws/things/ ${cognito-identity.amazonaws.com:aud}/shadow/update"] } ] }

Page 23: Jan Metzner - Amazon Web Servicesaws-de-media.s3.amazonaws.com/images/Webinar/IoT...AWS IoT DEVICE SDK Set of client libraries to connect, authenticate and exchange messages MESSAGE

DynamoDB Lambda Amazon Kinesis

{ "Version":"2012-10-17", "Statement":[ { "Effect":"Allow", "Action":[ "iot:Connect" ], "Resource":"*" }, { "Effect":"Allow", "Action":[ "iot:Publish" ], "Resource":[ "arn:aws:iot:us-east-1:123456972007: topic/$aws/things/MyThing/shadow/update"] }, { "Effect":"Allow", "Action":[ "iot:Subscribe", "iot:Receive" ], "Resource":[ "arn:aws:iot:us-east-1:123456972007: topicfilter/$aws/things/MyThing/shadow/*" ] } ] }

Data Access Control - MQTT { "Version": "2012-10-17", "Statement": [{ "Effect":"Allow", "Action":[ "iot:Connect" ], "Resource":"*" }, { "Effect": "Allow", "Action": ["iot:Connect", "iot:Publish"], "Resource": [ "arn:aws:iot:us-east-1:123456972007:topic/foo/bar", "arn:aws:iot:us-east-1:123456972007:topic/foo/baz" ] }] }

Page 24: Jan Metzner - Amazon Web Servicesaws-de-media.s3.amazonaws.com/images/Webinar/IoT...AWS IoT DEVICE SDK Set of client libraries to connect, authenticate and exchange messages MESSAGE

AWS IoT Thing Shadow

Shadow

Thing

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

Page 25: Jan Metzner - Amazon Web Servicesaws-de-media.s3.amazonaws.com/images/Webinar/IoT...AWS IoT DEVICE SDK Set of client libraries to connect, authenticate and exchange messages MESSAGE

AWS IoT Shadow Flow

Shadow

Device SDK

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

Page 26: Jan Metzner - Amazon Web Servicesaws-de-media.s3.amazonaws.com/images/Webinar/IoT...AWS IoT DEVICE SDK Set of client libraries to connect, authenticate and exchange messages MESSAGE

Demo Thing Shadow look at: https://github.com/aws/aws-iot-device-sdk-js

Page 27: Jan Metzner - Amazon Web Servicesaws-de-media.s3.amazonaws.com/images/Webinar/IoT...AWS IoT DEVICE SDK Set of client libraries to connect, authenticate and exchange messages MESSAGE

AWS IoT

DEVICE SDK Set of client libraries to

connect, authenticate and exchange messages

MESSAGE BROKER Communicate with devices via

MQTT and HTTP

AUTHENTICATION AUTHORIZATION

Secure with mutual authentication and encryption

RULES ENGINE Transform messages based on rules and

route to AWS Services

AWS Services - - - - -

3P Services

SHADOW Persistent thing state

during intermittent connections

APPLICATIONS

AWS IoT API

REGISTRY Identity and Management of

your things

Page 28: Jan Metzner - Amazon Web Servicesaws-de-media.s3.amazonaws.com/images/Webinar/IoT...AWS IoT DEVICE SDK Set of client libraries to connect, authenticate and exchange messages MESSAGE

Simple Pay as you go and Predictable Pricing

•  Pay as you go. No minimum fees •  $5 per million messages published to, or delivered

in US East (N. Virginia), US West (Oregon), EU (Ireland) $8 in Asia Pacific (Tokyo)

AWS IoT

Free Tier 250,000 Messages Per Month Free for first 12 Months

Page 29: Jan Metzner - Amazon Web Servicesaws-de-media.s3.amazonaws.com/images/Webinar/IoT...AWS IoT DEVICE SDK Set of client libraries to connect, authenticate and exchange messages MESSAGE

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

Thank You

Jan Metzner @janmetzner


Recommended