AWS March 2016 Webinar Series - AWS IoT Real Time Stream Processing with AWS Lambda
-
Upload
amazon-web-services -
Category
Technology
-
view
1.899 -
download
1
Transcript of AWS March 2016 Webinar Series - AWS IoT Real Time Stream Processing with AWS Lambda
© 2015, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Presenter: Vyom Nagrani, Manager Product Management, AWS Lambda
Q&A Moderator: Ajay Nair, Principal Product Manager, AWS Lambda
Q&A Moderator: Bryan Liston, Product Manager, AWS Lambda
March 29th, 2016
Essentials: AWS IoT Real Time Stream Processing with 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
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 IoT backends
1 2 3
Workflow: IoT backend using Amazon Kinesis and AWS Lambda
Reference Architecture: IoT backend using Amazon Kinesis and AWS Lambdahttps://s3.amazonaws.com/awslambda-reference-architectures/iot-backend/lambda-refarch-iotbackend.pdf
Sample code: IoT backend using Amazon Kinesis and AWS Lambda
Lambda functions• ApiFunction • DdbCloudWatchEventProcessorFunction• EventArchiverFunction
Function roles• ApiExecutionRole • DdbCloudWatchProcessorRole • EventArchiverRole
Event source mappings• DdbCloudWatchProcessorSourceMapping • EventArchiverSourceMapping
IAM users and policies• TestClientUser• TestClientPolicy• TestClientKeys
Other resources• EventStream• SensorData Table• ArchiveBucket
Configuration• ConfigTable• ConfigHelperStack• SensorDataTableConfig• ArchiveBucketConfig
https://github.com/awslabs/lambda-refarch-iotbackend
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
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
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
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.
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
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
AWS IoT Hardware Partners
… and the list will continue to grow!
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
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
Today’s demo workflow: AWS IoT to AWS Lambda to Amazon SNS
Private Key& Certificate
Thing/Device
SDK
AWS Services
Execution Role PolicyPermission
Select * from ‘iotbutton/+’
Policy Rule
AWS IoT
Action
Lambda Function
Rules Engine
SNS Topic
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.
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.