29
© 2015, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Jan Metzner Solutions Architect Mobile/IoT EMEA, Amazon Web Services

AWS IoT Deep Dive - AWS IoT Web Day

Embed Size (px)

Citation preview

Page 1: AWS IoT Deep Dive - AWS IoT Web Day

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

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

Page 2: AWS IoT Deep Dive - AWS IoT Web Day

Welche Themen werden wir in diesem Webinar behandeln?

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

Page 3: AWS IoT Deep Dive - AWS IoT Web Day

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: AWS IoT Deep Dive - AWS IoT Web Day

Talking to Things

DynamoDB Lambda Amazon Kinesis

Page 5: AWS IoT Deep Dive - AWS IoT Web Day

Mutual Auth TLS

Page 6: AWS IoT Deep Dive - AWS IoT Web Day

Talking to Non-Things

DynamoDB Lambda Amazon Kinesis

Page 7: AWS IoT Deep Dive - AWS IoT Web Day

AWS Auth + TLS

Page 8: AWS IoT Deep Dive - AWS IoT Web Day

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: AWS IoT Deep Dive - AWS IoT Web Day

Back To Certs and Keys

Page 10: AWS IoT Deep Dive - AWS IoT Web Day

AWS-Generated Keypair

CreateKeysAndCertificate()!

Page 11: AWS IoT Deep Dive - AWS IoT Web Day

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: AWS IoT Deep Dive - AWS IoT Web Day

CreateKeysAndCertificate()!

AWS-Generated Keypair

Page 13: AWS IoT Deep Dive - AWS IoT Web Day

Client Generated Keypair

CSR

Page 14: AWS IoT Deep Dive - AWS IoT Web Day

Client Generated Keypair

CSR

CreateCertificateFromCSR(CSR)!

Page 15: AWS IoT Deep Dive - AWS IoT Web Day

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: AWS IoT Deep Dive - AWS IoT Web Day

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: AWS IoT Deep Dive - AWS IoT Web Day

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: AWS IoT Deep Dive - AWS IoT Web Day

Private Key Protection – Software Threats

chroot SELinux OTP Fuses

Page 19: AWS IoT Deep Dive - AWS IoT Web Day

Private Key Protection – Hardware Threats

TPMs Smartcards Locks and Boxes FIPS-style hardware

Page 20: AWS IoT Deep Dive - AWS IoT Web Day

Identity Federation

DynamoDB Lambda Amazon Kinesis

Page 21: AWS IoT Deep Dive - AWS IoT Web Day

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: AWS IoT Deep Dive - AWS IoT Web Day

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: AWS IoT Deep Dive - AWS IoT Web Day

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: AWS IoT Deep Dive - AWS IoT Web Day

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: AWS IoT Deep Dive - AWS IoT Web Day

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: AWS IoT Deep Dive - AWS IoT Web Day

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

Page 27: AWS IoT Deep Dive - AWS IoT Web Day

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: AWS IoT Deep Dive - AWS IoT Web Day

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: AWS IoT Deep Dive - AWS IoT Web Day

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

Thank You

Jan Metzner @janmetzner