AWS IoT is a managed cloud platform that lets connected devices easily and securely interact with cloud applications and other devices. AWS Lambda is a compute service that runs your code in response to triggers and automatically manages the compute resources for you.
This webinar will familiarize you with the basics of using AWS Lambda to do real-time stream processing with data from AWS IoT. We will discuss how you can leverage AWS IoT to receive data and send commands to IoT devices in real-time. You will learn how to trigger AWS Lambda functions to process inbound data from your IoT devices. You will also learn how to use Lambda to connect with Amazon Kinesis Firehose to load streaming data into Amazon S3 and Amazon Redshift.
Learning Objectives:
• Understand key AWS IoT and AWS Lambda features
• Learn how to set up AWS IoT and do real-time processing with AWS Lambda
• Explore sample use cases, best practices, and tips on using AWS Lambda with AWS IoT
Who Should Attend:
• IoT Developers
2. 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
3. Continuous ScalingNo 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
7. 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 Smarts
Connect Billions
of Devices
Lightweight
Communication
Protocol
X509 Certificates DynamoDB,
Kinesis, and S3
Trigger Lambda
Functions
1 2 3
8. Benefits of AWS IoT for building IoT backends
Secure by Default
Connect securely via X509 Certs and
TLS v1.2 Client Mutual Auth
Multi-protocol Message Gateway
Millions of devices and apps can connect
over MQTT or HTTP
Elastic Pub Sub Broker
Go from 1 to 1-billion long-lived
connections with zero provisioning
Subscribers
Publishers
Rules and Actions
Match patterns and take actions to send data to
other AWS services or republish
9. Device SDK
Set of client libraries to
connect, authenticate
and exchange messages
Device Gateway
Communicate with devices
via MQTT and HTTP
Authentication
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
AWS IoT: How it Works
10. 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.
11. 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 Kinesis
Actions
Amazon Kinesis Firehose
AWS IoT
12. 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 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
14. Official IoT Starter Kits on Variety of Platforms
Broadcom WICED
BCM4343W
On Threadx/Netx
Marvell EZConnect
MW302
On FreeRTOS
Renasas RX63N
On Micrium OS
TI CC3200
On TI-RTOS
Microchip WCM
PIC32 Platform
Intel Edison
on Yocto Linux
Mediatek LinkOne
on Linkit OS
Dragonboard
410c on Ubuntu
Seeeduino
Arduino on
openWRT
Beaglebone
Green on Debian
15. 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
16. 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
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31. 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.
32. 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.