59
November 12, 2014, Las Vegas, NV Jinesh Varia, @jinman

(MBL201) Device Clouds: Best Practices in Building a Connected Device Backend in the Cloud | AWS re:Invent 2014

Embed Size (px)

DESCRIPTION

The more devices are connected, the more new applications and services emerge that use those connected devices. AWS offers a wide variety of services that can be used to build andquot;device clouds,andquot; backend infrastructure for connecting different kinds of devices, including smart phones, tablets, smart meters, connected cars, sensor and actuator gateways, and so on. In this session, we share best practices for authentication, authorization, messaging, data collection, analytics, and much more. We also hear from Internet of Things (IoT) customers who have successfully built highly-scalable device clouds on AWS.

Citation preview

Page 1: (MBL201) Device Clouds: Best Practices in Building a Connected Device Backend in the Cloud | AWS re:Invent 2014

November 12, 2014, Las Vegas, NV

Jinesh Varia, @jinman

Page 2: (MBL201) Device Clouds: Best Practices in Building a Connected Device Backend in the Cloud | AWS re:Invent 2014
Page 3: (MBL201) Device Clouds: Best Practices in Building a Connected Device Backend in the Cloud | AWS re:Invent 2014
Page 4: (MBL201) Device Clouds: Best Practices in Building a Connected Device Backend in the Cloud | AWS re:Invent 2014
Page 5: (MBL201) Device Clouds: Best Practices in Building a Connected Device Backend in the Cloud | AWS re:Invent 2014
Page 6: (MBL201) Device Clouds: Best Practices in Building a Connected Device Backend in the Cloud | AWS re:Invent 2014
Page 7: (MBL201) Device Clouds: Best Practices in Building a Connected Device Backend in the Cloud | AWS re:Invent 2014
Page 8: (MBL201) Device Clouds: Best Practices in Building a Connected Device Backend in the Cloud | AWS re:Invent 2014
Page 9: (MBL201) Device Clouds: Best Practices in Building a Connected Device Backend in the Cloud | AWS re:Invent 2014
Page 10: (MBL201) Device Clouds: Best Practices in Building a Connected Device Backend in the Cloud | AWS re:Invent 2014
Page 11: (MBL201) Device Clouds: Best Practices in Building a Connected Device Backend in the Cloud | AWS re:Invent 2014
Page 12: (MBL201) Device Clouds: Best Practices in Building a Connected Device Backend in the Cloud | AWS re:Invent 2014

Scalability

User Experience

Security

Page 13: (MBL201) Device Clouds: Best Practices in Building a Connected Device Backend in the Cloud | AWS re:Invent 2014
Page 14: (MBL201) Device Clouds: Best Practices in Building a Connected Device Backend in the Cloud | AWS re:Invent 2014
Page 15: (MBL201) Device Clouds: Best Practices in Building a Connected Device Backend in the Cloud | AWS re:Invent 2014
Page 16: (MBL201) Device Clouds: Best Practices in Building a Connected Device Backend in the Cloud | AWS re:Invent 2014
Page 17: (MBL201) Device Clouds: Best Practices in Building a Connected Device Backend in the Cloud | AWS re:Invent 2014

Elastic Load

BalancingElastic Load

Balancing

API

API

API

Device

Device

Device

Brokers

Page 18: (MBL201) Device Clouds: Best Practices in Building a Connected Device Backend in the Cloud | AWS re:Invent 2014

Scalability

User Experience

Security

Page 19: (MBL201) Device Clouds: Best Practices in Building a Connected Device Backend in the Cloud | AWS re:Invent 2014
Page 20: (MBL201) Device Clouds: Best Practices in Building a Connected Device Backend in the Cloud | AWS re:Invent 2014
Page 21: (MBL201) Device Clouds: Best Practices in Building a Connected Device Backend in the Cloud | AWS re:Invent 2014
Page 22: (MBL201) Device Clouds: Best Practices in Building a Connected Device Backend in the Cloud | AWS re:Invent 2014

Scalability

User Experience

Security

Page 23: (MBL201) Device Clouds: Best Practices in Building a Connected Device Backend in the Cloud | AWS re:Invent 2014
Page 24: (MBL201) Device Clouds: Best Practices in Building a Connected Device Backend in the Cloud | AWS re:Invent 2014

POST https://api.spark.io/v1/devices/teddy-bear/hug

Page 25: (MBL201) Device Clouds: Best Practices in Building a Connected Device Backend in the Cloud | AWS re:Invent 2014
Page 26: (MBL201) Device Clouds: Best Practices in Building a Connected Device Backend in the Cloud | AWS re:Invent 2014
Page 27: (MBL201) Device Clouds: Best Practices in Building a Connected Device Backend in the Cloud | AWS re:Invent 2014
Page 28: (MBL201) Device Clouds: Best Practices in Building a Connected Device Backend in the Cloud | AWS re:Invent 2014
Page 29: (MBL201) Device Clouds: Best Practices in Building a Connected Device Backend in the Cloud | AWS re:Invent 2014

??

Page 30: (MBL201) Device Clouds: Best Practices in Building a Connected Device Backend in the Cloud | AWS re:Invent 2014

a = 1 b = “two”

c = 3

d = “four”a = 1

b = “two”

c = 3

d = “four”

c = 3

d = “four”

geofence = inside

where truck in geofence a

and c > 1 and d != “two”

• HTTP Post (webhook)

• SNS

• RedShift

• S3

• Republish on another

topic

• Republish to another

account

• Transform payload

Page 31: (MBL201) Device Clouds: Best Practices in Building a Connected Device Backend in the Cloud | AWS re:Invent 2014

a = 2

Page 32: (MBL201) Device Clouds: Best Practices in Building a Connected Device Backend in the Cloud | AWS re:Invent 2014
Page 33: (MBL201) Device Clouds: Best Practices in Building a Connected Device Backend in the Cloud | AWS re:Invent 2014

– Custom actors for AWS actions

iOS 8 interactive notifications

Page 34: (MBL201) Device Clouds: Best Practices in Building a Connected Device Backend in the Cloud | AWS re:Invent 2014

REQUEST

RESPONSE???

Page 35: (MBL201) Device Clouds: Best Practices in Building a Connected Device Backend in the Cloud | AWS re:Invent 2014

STREAM PROCESSING / INTEGRATIONS

Device

Consumers

Application

Consumers

?

Page 36: (MBL201) Device Clouds: Best Practices in Building a Connected Device Backend in the Cloud | AWS re:Invent 2014
Page 37: (MBL201) Device Clouds: Best Practices in Building a Connected Device Backend in the Cloud | AWS re:Invent 2014

Study by Stephen Nicholas (MQTT and HTTP on Android)

Creating Connection (% Battery used)

3G Wifi

HTTPS MQTT HTTPS MQTT

0.02972 0.04563 0.00228 0.00276

Page 38: (MBL201) Device Clouds: Best Practices in Building a Connected Device Backend in the Cloud | AWS re:Invent 2014

Study by Stephen Nicholas (MQTT and HTTP on Android)

% Battery used / hour

3G Wifi

HTTPS MQTT HTTPS MQTT

1.11553 0.72465 0.15839 0.01055

0.48697 0.32041 0.08774 0.00478

0.33277 0.16027 0.02897 0.00230

0.08263 0.07991 0.00824 0.00112

60 Seconds

120 Seconds

240 Seconds

480 Seconds

Page 39: (MBL201) Device Clouds: Best Practices in Building a Connected Device Backend in the Cloud | AWS re:Invent 2014

BROKER

QoS 0

PUBLISH

PUBLISH

PUBACK

PUBLISH

PUBACK

PUBREL

PUBCOMP

- At most once

- Does not survive network failure

QoS 1- At least once

- Can survive network failure

- Can be duplicated

QoS 2- Exactly once

- Can survive network failure

- Never duplicated

Page 40: (MBL201) Device Clouds: Best Practices in Building a Connected Device Backend in the Cloud | AWS re:Invent 2014

BROKER

CONNECT ID=thing2

SUBSCRIBE things/#2

CONNECT ID=thing1 LWT=things/thing1 “disconnected”

1PINGREQ

PINGRESP

KEEP_ALIVE exceeded

2 things/thing1 “disconnected”

Page 41: (MBL201) Device Clouds: Best Practices in Building a Connected Device Backend in the Cloud | AWS re:Invent 2014

SUBSCRIPTION SUBSCRIPTION

SESSION SESSION

SUBSCRIPTION

SESSION SESSION SESSION

1 2 3 4 5 1 2 3 54

• Durable Subscription– Messages 2 and 4 are

not lost but will be received on next connection

Page 42: (MBL201) Device Clouds: Best Practices in Building a Connected Device Backend in the Cloud | AWS re:Invent 2014
Page 43: (MBL201) Device Clouds: Best Practices in Building a Connected Device Backend in the Cloud | AWS re:Invent 2014
Page 44: (MBL201) Device Clouds: Best Practices in Building a Connected Device Backend in the Cloud | AWS re:Invent 2014

Real-time message processing

& Scalable API management

Page 45: (MBL201) Device Clouds: Best Practices in Building a Connected Device Backend in the Cloud | AWS re:Invent 2014

1Introduction

2 3 4Under the Hood:

What’s Unique

Use Case Evolving

with AWS

Page 46: (MBL201) Device Clouds: Best Practices in Building a Connected Device Backend in the Cloud | AWS re:Invent 2014
Page 47: (MBL201) Device Clouds: Best Practices in Building a Connected Device Backend in the Cloud | AWS re:Invent 2014
Page 48: (MBL201) Device Clouds: Best Practices in Building a Connected Device Backend in the Cloud | AWS re:Invent 2014
Page 49: (MBL201) Device Clouds: Best Practices in Building a Connected Device Backend in the Cloud | AWS re:Invent 2014
Page 50: (MBL201) Device Clouds: Best Practices in Building a Connected Device Backend in the Cloud | AWS re:Invent 2014
Page 51: (MBL201) Device Clouds: Best Practices in Building a Connected Device Backend in the Cloud | AWS re:Invent 2014
Page 52: (MBL201) Device Clouds: Best Practices in Building a Connected Device Backend in the Cloud | AWS re:Invent 2014

Let’s take a look at the evolution…

- Listeners

- Commanders

Yarn Cluster:

- Translation (i/o)

- BI

Public-facing API

MongoDB

Page 53: (MBL201) Device Clouds: Best Practices in Building a Connected Device Backend in the Cloud | AWS re:Invent 2014

Sinatra

Postman

Page 54: (MBL201) Device Clouds: Best Practices in Building a Connected Device Backend in the Cloud | AWS re:Invent 2014

Sinatra

YARN

ZooKeeper

Postman

Page 55: (MBL201) Device Clouds: Best Practices in Building a Connected Device Backend in the Cloud | AWS re:Invent 2014

VPC

(translation)

Public EC2

(APIs)

Page 56: (MBL201) Device Clouds: Best Practices in Building a Connected Device Backend in the Cloud | AWS re:Invent 2014
Page 57: (MBL201) Device Clouds: Best Practices in Building a Connected Device Backend in the Cloud | AWS re:Invent 2014
Page 58: (MBL201) Device Clouds: Best Practices in Building a Connected Device Backend in the Cloud | AWS re:Invent 2014
Page 59: (MBL201) Device Clouds: Best Practices in Building a Connected Device Backend in the Cloud | AWS re:Invent 2014

http://bit.ly/awsevals