This webinar will familiarize you with the basics of AWS IoT and AWS Lambda and demonstrate how to build IoT backends using these services. 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.
We will discuss how you can leverage AWS IoT to receive data and send commands to IoT devices. You will learn how to setup device gateways that trigger AWS Lambda functions to process inbound data from IoT devices. You will also learn how to use Lambda to read and write to Amazon DynamoDB, a fast and flexible NoSQL database service for all applications that need consistent, single-digit millisecond latency at any scale.
Learning Objectives:
Understand key AWS IoT and AWS Lambda and AWS IoT features
Learn how to set up a IoT backend using AWS IoT and AWS Lambda
Explore sample use cases, best practices, and tips on using AWS Lambda with AWS IoT
Who Should Attend:
IoT Developers
2. 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
3. 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
4. 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
5. 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 mobile backends
1 2 3
6. 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
7. 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.
8. 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
9. 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
11. 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
12. 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
13. 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
Execution
Role
PolicyPermission
Select * from ‘iotbutton/+’
Policy Rule
AWS IoT
Action
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28. Sample code: Mobile backend using Amazon Kinesis and
AWS Lambda
https://github.com/awslabs/lambda-refarch-iotbackend
29. Reference Architecture: IoT backend using Amazon
Kinesis and AWS Lambda
https://s3.amazonaws.com/awslambda-reference-architectures/iot-backend/lambda-refarch-iotbackend.pdf
30. 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.
31. 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.