aws january 2016 webinar series - best practices for building iot backends with aws iot & aws...

31
© 2015, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Presenter: Vyom Nagrani, Sr. Product Manager, AWS Lambda Q&A Moderator: Ajay Nair, Sr. Product Manager, AWS Lambda Q&A Moderator: Olawale Oladehin, AWS Solutions Architect January 28 th , 2015 Essentials: Best Practices for Building IoT Backends with AWS IoT & AWS Lambda

Upload: amazon-web-services

Post on 20-Jan-2017

2.383 views

Category:

Technology


4 download

TRANSCRIPT

Page 1: AWS January 2016 Webinar Series - Best Practices for Building IoT Backends with AWS IoT & AWS Lambda

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

Presenter: Vyom Nagrani, Sr. Product Manager, AWS Lambda

Q&A Moderator: Ajay Nair, Sr. Product Manager, AWS Lambda

Q&A Moderator: Olawale Oladehin, AWS Solutions Architect

January 28th, 2015

Essentials: Best Practices for Building IoT Backends with AWS IoT & AWS Lambda

Page 2: AWS January 2016 Webinar Series - Best Practices for Building IoT Backends with AWS IoT & AWS Lambda

AWS IoT: enables connected devices to easily and securely interact with cloud applications

Extract and filter data from your devices and

take action with custom rules

Securely connect and manage any physical device across multiple

networks

Create web applications that interact with

devices reliably at any time

Devices Network Security Data Collection SmartsConnect Billions

of DevicesLightweight

Communication Protocol

X509 Certificates DynamoDB, Kinesis, and S3

Trigger Lambda Functions

1 2 3

Page 3: AWS January 2016 Webinar Series - Best Practices for Building IoT Backends with AWS IoT & AWS Lambda

Benefits of AWS IoT for building IoT backends

Secure by DefaultConnect securely via X509 Certs andTLS v1.2 Client Mutual Auth

Multi-protocol Message GatewayMillions of devices and apps can connectover MQTT or HTTP

Elastic Pub Sub BrokerGo from 1 to 1-billion long-lived connections with zero provisioning

Subscribers

Publishers

Rules and ActionsMatch patterns and take actions to send data to other AWS services or republish

Page 4: AWS January 2016 Webinar Series - Best Practices for Building IoT Backends with AWS IoT & AWS Lambda

AWS Lambda: A compute service that runs your code in response to events

Lambda functions: Stateless, trigger-based code execution

Triggered by events:• Direct Sync and Async invocations • Put to an Amazon S3 bucket• API Gateway call• And many more …

Makes it easy to• Build back-end services that perform at scale • Perform data-driven auditing, analysis, and notification

Page 5: AWS January 2016 Webinar Series - Best Practices for Building IoT Backends with AWS IoT & AWS Lambda

Continuous Scaling No Servers to Manage

AWS Lambda automatically scales your application by running code in response to each trigger. Your code runs in parallel and processes each trigger individually, scaling precisely

with the size of the workload.

Subsecond Metering

With AWS Lambda, you are charged for every 100ms your code executes and the number of times your code is

triggered. You don't pay anything when your code isn't running.

AWS Lambda automatically runs your code without requiring you to provision or manage servers. Just write the code

and upload it to Lambda.

Benefits of AWS Lambda for building mobile backends

1 2 3

Page 6: AWS January 2016 Webinar Series - Best Practices for Building IoT Backends with AWS IoT & AWS Lambda

DEVICE SDKSet of client libraries to

connect, authenticate and exchange messages

DEVICE GATEWAYCommunicate with devices

via MQTT and HTTP

AUTHENTICATIONSecure with mutual authentication and

encryption

RULES ENGINETransform messages based on rules and

route to AWS Services

AWS Services- - - - -

3P Services

SHADOWPersistent thing state

during intermittent connections

APPLICATIONS

AWS IoT API

REGISTRYIdentity and Management of

your things

AWS IoT: How it Works

Page 7: AWS January 2016 Webinar Series - Best Practices for Building IoT Backends with AWS IoT & AWS Lambda

AWS IoT Rules Engine

Complex Evaluations: Respond to the fleet, not just a single unit. Dozens of functions() available

Multiple / Simultaneous Actions: Sometimes a situation requires you to take many actions

Simple & Familiar Syntax- SQL Statement to define topic filter- Optional WHERE clause- Advanced JSON support

Functions improve signal : noise- String manipulation (regex support)- Mathematical operations- Crypto support- UUID, Timestamp, rand, etc.

Page 8: AWS January 2016 Webinar Series - Best Practices for Building IoT Backends with AWS IoT & AWS Lambda

AWS IoT Rules Engine Actions

Rules Engine evaluates inbound messages published into AWS IoT, transforms and delivers to the appropriate endpoint based on business rules.

External endpoints can be reached via Lambda and Simple Notification Service (SNS).

AWS Lambda

Amazon S3

Amazon DynamoDB

Amazon SNS

Amazon KinesisActions

Amazon Kinesis Firehose

AWS IoT

Page 9: AWS January 2016 Webinar Series - Best Practices for Building IoT Backends with AWS IoT & AWS Lambda

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}

Thing

Report its current state to one or multiple shadowsRetrieve 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 10: AWS January 2016 Webinar Series - Best Practices for Building IoT Backends with AWS IoT & AWS Lambda

AWS IoT Hardware Partners

… and the list will continue to grow!

Page 11: AWS January 2016 Webinar Series - Best Practices for Building IoT Backends with AWS IoT & AWS Lambda

Official IoT Starter Kits on Variety of Platforms

Broadcom WICEDBCM4343WOn Threadx/Netx

Marvell EZConnectMW302On FreeRTOS

Renasas RX63NOn Micrium OS

TI CC3200On TI-RTOS

Microchip WCMPIC32 Platform

Intel Edison on Yocto Linux

Mediatek LinkOneon Linkit OS

Dragonboard 410c on Ubuntu

Seeeduino Arduino on openWRT

Beaglebone Green on Debian

Page 12: AWS January 2016 Webinar Series - Best Practices for Building IoT Backends with AWS IoT & AWS Lambda

AWS IoT Button - “Hello World” of AWS IoT

• Based on the Amazon dash button hardware (Stateless Wi-Fi Button)

• Code in the Cloud; no device specific code or flashing required

• Learn Rules, Shadows and Topics

https://www.hackster.io/challenges/AWSIoTMegaContest Button was available for AWS re:Invent 2015 participants only

Page 13: AWS January 2016 Webinar Series - Best Practices for Building IoT Backends with AWS IoT & AWS Lambda

Today’s demo workflow: AWS IoT to AWS Lambda to Amazon SNS

Lambda Function

Rules Engine

SNS Topic

Private Key& Certificate

Thing/Device

SDK

AWS Services

ExecutionRole PolicyPermission

Select * from ‘iotbutton/+’

Policy Rule

AWS IoT

Action

Page 14: AWS January 2016 Webinar Series - Best Practices for Building IoT Backends with AWS IoT & AWS Lambda
Page 15: AWS January 2016 Webinar Series - Best Practices for Building IoT Backends with AWS IoT & AWS Lambda
Page 16: AWS January 2016 Webinar Series - Best Practices for Building IoT Backends with AWS IoT & AWS Lambda
Page 17: AWS January 2016 Webinar Series - Best Practices for Building IoT Backends with AWS IoT & AWS Lambda
Page 18: AWS January 2016 Webinar Series - Best Practices for Building IoT Backends with AWS IoT & AWS Lambda
Page 19: AWS January 2016 Webinar Series - Best Practices for Building IoT Backends with AWS IoT & AWS Lambda
Page 20: AWS January 2016 Webinar Series - Best Practices for Building IoT Backends with AWS IoT & AWS Lambda
Page 21: AWS January 2016 Webinar Series - Best Practices for Building IoT Backends with AWS IoT & AWS Lambda
Page 22: AWS January 2016 Webinar Series - Best Practices for Building IoT Backends with AWS IoT & AWS Lambda
Page 23: AWS January 2016 Webinar Series - Best Practices for Building IoT Backends with AWS IoT & AWS Lambda
Page 24: AWS January 2016 Webinar Series - Best Practices for Building IoT Backends with AWS IoT & AWS Lambda
Page 25: AWS January 2016 Webinar Series - Best Practices for Building IoT Backends with AWS IoT & AWS Lambda
Page 26: AWS January 2016 Webinar Series - Best Practices for Building IoT Backends with AWS IoT & AWS Lambda
Page 27: AWS January 2016 Webinar Series - Best Practices for Building IoT Backends with AWS IoT & AWS Lambda
Page 28: AWS January 2016 Webinar Series - Best Practices for Building IoT Backends with AWS IoT & AWS Lambda

Sample code: Mobile backend using Amazon Kinesis and AWS Lambda

https://github.com/awslabs/lambda-refarch-iotbackend

Page 29: AWS January 2016 Webinar Series - Best Practices for Building IoT Backends with AWS IoT & AWS Lambda

Reference Architecture: IoT backend using Amazon Kinesis and AWS Lambda

https://s3.amazonaws.com/awslambda-reference-architectures/iot-backend/lambda-refarch-iotbackend.pdf

Page 30: AWS January 2016 Webinar Series - Best Practices for Building IoT Backends with AWS IoT & AWS Lambda

Three Next Steps

1. Connect your IoT device to AWS IoT, or purchase one of the AWS IoT hardware starter kits to get started. With a few clicks in the AWS Management Console, you can create an device policy and rule that enables you to securely and easily connect your device to the cloud and access data, business logic, or functionality from your back-end services.

2. Create and test your first Lambda function. With AWS Lambda, there are no new languages, tools, or frameworks to learn. You can use any third party library, even native ones. And every month, the first 1M invokes are on us!

3. Select Lambda as the rule action for your IoT device … Use the sample code and setup instructions to quickly create your first IoT device backend using AWS IoT and AWS Lambda.

Page 31: AWS January 2016 Webinar Series - Best Practices for Building IoT Backends with AWS IoT & AWS Lambda

Thank you!

Visit http://aws.amazon.com/iot, the AWS blog, and the AWS IoT forum to learn more and get started using AWS IoT.

Visit http://aws.amazon.com/lambda, the AWS Compute blog, and the Lambda forum to learn more and get started using Lambda.