Connecting IoT Devices to Cloud Services

By Rajan Mistry

Staff Engineer


August 13, 2019


Connecting IoT Devices to Cloud Services

In this blog we?ll briefly review the common transport and application-layer protocols that help facilitate IoT communications.

When it comes to the Internet of Things (IoT), the cloud plays a major role in allowing developers to distribute computing between edge devices and remote digital services. This architecture opens up the potential for a multitude of solutions where devices and cloud services work in concert over today’s high-speed communication channels using efficient protocols. Of course, supporting all of this requires strong two-way communications right from the physical layer up to the application layer.[1]

In this blog we’ll briefly review the common transport and application-layer protocols that help facilitate IoT communications, and then look at how you can get IoT edge devices to communicate with Microsoft Azure and AWS IoT.

A Protocol for IoT Connectivity

No matter how sophisticated edge-to-cloud IoT communications get, it all comes down to two-way data communications over the internet between a device and a remote service.

Starting at the transport layer, device-to-cloud communications generally take place over TCP (Transmission Control Protocol) or UDP (User Datagram Protocol) channels. TCP is connection-oriented and reliable, meaning that every data packet sent requires acknowledgement that it was received. But with great reliability comes great overhead, and sometimes for an IoT application, the TCP header can be larger than the payload itself. UDP on the other hand, is connectionless and unreliable, meaning that it allows for the loss of data packets in the interest of speed. TCP is used where data must get through whereas UDP is employed where some data loss is acceptable (e.g., when streaming videos).

At the application layer, HTTP (HyperText Transfer Protocol) has become one of the most standardized protocols for web-based communications. It was developed as a request-response model from the client-server era where clients (e.g., browsers), open a TCP connection to send requests to servers (e.g., web servers) that return responses. TLS is often employed to secure HTTP communication over TCP, while DTLS performs similar functionality over UDP. This setup can be used by IoT devices to communicate with the web servers using a RESTful/SOAP web service.

For example, devices can talk to the server over a TCP/IP connection using HTTP GET/POST methods, and deliver the payloads formatted in XML, JSON, or some other format. Each step (TCP/IP, HTTP, XML/JSON) keeps adding overhead to the payload, which is the only relevant information that the end application is looking for.

Hence, another application-layer protocol, MQTT (Message Queuing Telemetry Transport), has become popular for IoT. It’s a lightweight protocol with a small code footprint suitable for constrained environments such as embedded IoT devices. Most notably, it works on a publish-subscribe model that facilitates one-to-many communications between devices through a central MQTT “broker”–just the type of communications you would typically need for IoT!

With an understanding of these underlying protocols, let’s now look at how edge-to-cloud communications can work. For this blog, we will look at the Qualcomm® MDM9206 LTE Modem and Qualcomm® Snapdragon™ mobile platforms as examples because they illustrate how manufacturer support from the hardware level right up through the API communications stack can facilitate IoT-to-cloud development.

Connecting MDM9206 LTE Modem IoT Devices to Azure

The MDM9206 is a fairly specialized device that is often used as a modem in conjunction with another processor.

To facilitate communications, you can utilize the Qualcomm® LTE for IoT SDK which supports TLS, DTLS, MQTT, and HTTP, and provides a “shim layer” for connecting to Azure IoT Hub[2].

This shim layer includes Azure input/output (I/O) and platform shim layer libraries as part of a package for Azure application development on the ThreadX platform in the user space. Azure applications use Microsoft Azure SDK-defined APIs to interact with the Azure IoT SDK C module. The Azure IoT SDK C module uses the adapter layer to interact with the ThreadX IoT stack. The figure below shows the Azure application architecture on a ThreadX IoT device:

Architecture for Azure applications on a ThreadX device. Image courtesy of Qualcomm Technologies, Inc.

This shim layer also includes a number of scripts that set up a build environment to build an application for your device.[3]

Connecting IoT Devices with the MDM9206 LTE Modem to AWS IoT

The SDK can also be used for communications to AWS IoT using MQTT messages. There is a demo and project on GitHub that provides some great resources: IoT Merchandise Cart and merchant-cart-aws-iot project.

The key steps involved for connecting your device to AWS IoT are:

  • Create an EC2 instance and enable the correct port
  • Add the app to the EC2 instance
  • Obtain the certificate and private key for the app from AWS IoT
  • Build the device-side application and transfer it along with the certificate and private key, and any other supporting files to the device
  • Set up the sensor map with the device to track product inventory levels
  • Launch a browser and navigate to your AWS IoT app
  • Run the application on the device

If you’re interested in learning more, check out the project’s sample app module for posting inventory levels to EC2 over MQTT. You can also see how MQTT communication works by taking a look at the aws_iot_mqtt*.c files.

Connecting Linux-based IoT Devices Running on Snapdragon platforms to AWS IoT

The Snapdragon mobile platforms provide a broader set of capabilities for IoT solutions. They also give developers the ability to integrate higher-level SDKs and libraries written in a variety of programming languages.

Communication between a Snapdragon-based device and AWS IoT using MQTT, can be accomplished with one of the AWS IoT SDKs (e.g. AWS IoT Device SDK for Python)[4].

The key steps involved with connecting to AWS IoT are:

1. Create a project in AWS

  • Create a “thing”
  • Connect the “thing” to a device
  • Select a programming language
  • Generate a certificate and policy and add them to the project

2. Install the required SDKs for AWS IoT on the client/device

3. Create the device-side application with the following implementation:

  • Add the AWS module to the client code
  • Instantiate a client in code passing the private key and certificate
  • Start a connection
  • Subscribe to a topic and specify a callback to receive information back
  • Publish messages as required by your app


Device-to-cloud communication working over standard OSI-model protocols provides the backbone for cloud services. IoT-device-to-cloud connectivity can be achieved on both specialized hardware such as the MDM9206 LTE Modem and more general-purpose devices such as the Snapdragon mobile platforms.

More generally, this device-to-cloud architecture provides a rich set of options for processing on IoT devices and/or the cloud. However, at the end of the day, it’s all about how well you can implement two-way data communications over the internet between a device and a remote service.

Author’s Bio

Rajan Mistry is a Sr. Applications Engineer at Qualcomm Technologies, Inc. with the Qualcomm Developer Network team. His role is to help grow the developer community and work on the next generation of solutions that leverage Qualcomm technologies.

Qualcomm Snapdragon, Qualcomm MDM9206 and Qualcomm LTE for IoT SDK are products of Qualcomm Technologies, Inc. and/or its subsidiaries.

[1] If you need a refresher on the seven communication layers, check out:

[2] This is accomplished using the azure-iot-sdk-c package.

[3] Additional information can be found on the Qualcomm Developer Network blog, as well as Microsoft’s demo video.

[4] You can see this in the project: Four Steps to AWS IoT, which shows connecting a DragonBoard™ 410c (the Snapdragon hardware developer kit from Arrow Electronics) using AWS IoT SDK for Python

Staff Application Engineer and Technology Evangelist working in the wireless industry.

More from Rajan

Networking & 5G