AWS Mobile Blog

Welcome Parse IoT Customers!

by Ben Moore | on | Permalink | Comments |  Share

Guest post by Steve Johnson

You may have heard the recent announcement that Facebook’s Parse Service will be retired over the next year.  Parse is recommending that current users migrate their products to alternative services such as Amazon Web Services (the recently open-sourced Parse server runs great on Amazon EC2).

For Internet of Things (IoT) customers, Parse provides a set of device SDKs that can be used to connect devices to cloud applications.  Customers who may have tried Parse for IoT in the past, should have a look at AWS IoT, Amazon’s managed cloud platform that lets connected devices easily and securely interact with cloud applications and other devices.  In order to make that easier, this blog describes some of the key similarities and differences between Parse IoT and AWS IoT.

Parse is also quite useful for building mobile apps and web apps that control and display the status of smart devices.  AWS IoT is designed to work well with AWS Mobile services such as Amazon Cognito and Amazon Simple Notification Service (SNS).  Click here to read more about migrating mobile apps from Parse to AWS.

Regarding devices, let’s talk about basic differences between how Parse IoT and AWS IoT operate, and then we’ll cover some use cases for migrating Parse functionality to AWS IoT.

The Parse Arduino SDK exposes some object methods and a REST interface for doing things like storing JSON objects, receiving push notifications, and querying the cloud-side object store.  The AWS IoT Service Broker communicates with your device using MQTT, WebSockets and REST.   With AWS IoT, your devices can efficiently and inexpensively keep long-running connections to the broker with configurable timeout values.

MQTT is a lightweight, low bandwidth alternative to HTTP that is perfect for embedded and resource-constrained devices. It is a publish/subscribe protocol that allows you to pass messages to topics, and have them routed, processed, and consumed by the AWS IoT Rules Engine. The Rules Engine is used to inspect and filter messages and process them using the power of AWS.

AWS IoT also includes Device Shadows, a JSON state database for each device in your application. Shadows provide a REST API for interacting with your device, even if the device communicates by MQTT or another protocol, and even if it is currently disconnected.  With shadows, you can retrieve the most recent device state from the cloud at any time.  You can also use shadows to set the desired future state for your device.

Storing Objects in the Cloud

If you are currently using Parse Objects to store data in the Cloud, you have options when migrating to AWS IoT.  If the data you’re storing is state information for the device, you can use the Shadow API to put (and retrieve) that data in the Shadow database.  The Shadow database can store up to 8K of JSON data.  If you need larger storage, you can configure the Rules Engine to send data to Dynamo DB.  The Rules Engine in AWS IoT examines incoming messages, filters them, and sends them to an AWS Service or another topic.  In this case, you could put the data you want to store in an MQTT message, send it to a topic, and have the Rules Engine store it in Dynamo DB.  Of course, if you want to send it to Kinesis, S3, or run a Lambda function, you can do that too.  

Retrieving Information from the Cloud

Let’s say you need to get information from the Cloud.  If you have stored the data in the Shadow Database, you can use the Shadow API to retrieve it.  You can even have your device subscribe to a topic that has changes to the Shadow Database published to it.  One of the great things about MQTT (and pub/sub in general) is that your devices can subscribe to topics, and the data will be sent to them automatically.  This gives you great architectural freedom while minimizing the amount of code you need to write.  

Push Notifications

Push notifications in Parse can be migrated to AWS IoT using MQTT subscriptions.  Instead of writing a push notification callback function, your device can just subscribe to a topic that your server pushes messages to.  Any items "pushed" to the device will arrive on the topic.  Each device can have their own topic, or you can have a topic that fans out to several (or millions!) of devices.  It’s worth noting that the MQTT messages can contain any payload:  JSON, Binary, or encrypted data.  This gives you the opportunity to minimize traffic bandwidth. 

Security is always our first priority in AWS, so all communication with the IoT Service is handled over TLS 1.2.  Authentication with the AWS IoT service can be accomplished using mutually authenticated certificates, AWS credentials, or by using AWS Cognito.

Getting Started

It is fast and easy to get started with AWS IoT.  The AWS IoT free tier gets you started with 250,000 free messages (published or delivered) per month, for 12 months.  To connect your hardware device, sensor, mobile app or a thing use the AWS IoT Device SDK for Embedded C, Node.JS and Arduino Yun.  Alternatively, you can choose from a wide range of AWS starter kits pre-packaged to connect to AWS IoT:

You can create amazing IoT solutions with AWS IoT, through the combination of Device Gateway, the Rules Engine, Device Shadows, and the entire AWS platform. Looking for more information? Visit the AWS IoT forum or register to join our webinar Migrating Mobile Apps from Parse to AWS.