Your guide to AWS re:Invent 2017 news and analysis
Reporting and analysis from IT events
The internet of things has been around for a while, but cloud adoption has been slow because of the wide variety...
of disparate devices, tools and programming models. One AWS model that's based on Lambda could find an audience among developers and facilitate more AWS IoT projects among developers.
The AWS Lambda functional programming model enables developers to code logic for internet of things (IoT) applications that work on the cloud or on premises. IT teams can use the AWS Lambda functional programming model to develop and test new IoT applications. Let's take a look at how AWS' code, tools and guides, including the AWS IoT Button and Greengrass, interoperate to support Lambda for various IoT platform back-end features.
The AWS IoT Button is a simplified use for AWS IoT that alters Amazon's retail-focused Dash button and adjusts it for developers. Enterprise IT teams can program button pushes to virtually any action on AWS, such as notifications, counting events and turning appliances on or off.
AWS Greengrass takes the power of Lambda to IoT gateways installed in the field. It enables developers to use hybrid cloud architectures for fleets of IoT devices that are sporadically connected or operate independent of the cloud. IT teams develop and test the code in the cloud to determine the programming logic and identify bugs before deployment. Greengrass runs on Linux boxes, which eliminates the need to deploy a server OS on an IoT gateway. The AWS IoT Device SDK helps developers create apps that run on IoT devices to capture data, subscribe to data streams and manage state information.
In all cases, AWS IoT tools have a strong security model. Developers must provision and manage security certificates associated with IoT devices to work with the desired Lambda functions and back-end services, which includes setting up the appropriate AWS Lambda Permissions Model.
Device shadows mirror IoT devices
AWS uses Device Shadows, which are also called Thing Shadows, to represent the current and desired state of things. Device Shadows act as a communication layer between applications and devices in the form of a JSON document, which makes it easy for applications to query the current state of objects, issue controls to the objects and receive notifications when control messages are accepted or rejected. For example, a smart lightbulb won't turn on for a variety of reasons -- poor connectivity, a broken control module or a broken bulb. The back-end application receives a notification of this and it's either logged or used to drive queries to identify the cause of the problem.
AWS stores data from Device Shadows in the JSON document that sits between the device and AWS Lambda functions or back-end databases; MQTT topics facilitate communication. A topic is a subset of MQTT communications across a shared network that is designated for a single device, such as a lightbulb, or a group of devices, such as all lightbulbs in a room.
Test your knowledge about the future of cloud traffic
How fast is cloud-based IP traffic growing? Take this quiz and see if forecasts for cloud traffic volume, download speeds and server workloads are in line with your expectations.
Developers can use Lambda functions to call three methods that work with Device Shadows: UPDATE, GET and DELETE. The UPDATE method creates a Device Shadow if it does not exist, which simplifies the process of automatically populating a database of IoT devices. Device Shadows work with MQTT and RESTful APIs over HTTPS.
Use Lambda with the AWS IoT projects
There are several common ways to tie AWS Lambda with IoT applications, including using IoT Rule Actions, facilitating synchronous communications between devices and databases, processing events.
AWS IoT can call Lambda via IoT rule actions, which analyze and perform actions based on MQTT messages. In this case, the rule calls a Lambda function and passes data from the MQTT message that triggered the rule. Lambda can then call another AWS utility or a third-party service. Rule actions work in the cloud or on a local gateway device that runs AWS Greengrass.
Developers can set up Lambda functions to sit between connected devices and Amazon DynamoDB to facilitate bidirectional communications in their AWS IoT projects. Synchronous communications enable devices to retrieve configuration information or historical event data.
Developers can also configure a Lambda function to improve, transform and load raw IoT data feed or Amazon Kinesis data streams to fit into Amazon DynamoDB for low latency access. This information feeds into devices, back-end applications or data analytics applications to produce events. This same function also analyzes event data and sends alerts to Amazon CloudWatch if the system exceeds certain thresholds.
Kinesis sends event streams to multiple Lambda functions, which enable a second Lambda function to improve, transform and load raw data into a format for long-term storage on Amazon Simple Storage Service. This approach would provide a cost-effective alternative for long-term storage and analysis via Elastic MapReduce and Amazon Redshift.
IoT platform on AWS connects devices to the cloud
Devices find a soft landing in the cloud on AWS IoT
How to connect to AWS IoT