How to Build a Complete IoT Solution with AWS – An Use Case Approach

In future, there will be millions of connected devices, from smart vehicles to smart wearables, generating an ever-increasing amount of data. The IoT cloud platform provides facilitation to collect data, store process and get actionable insights.

AWS IoT along with other services provided by AWS a complete IoT Solution can be build. In this article we will be discussing an IoT uses case and see how to implement the solution.

IoT Use Case

A logistic company is providing transportation services and need to ship items (e.g. fish, meat, etc.) in refrigerated containers. The merchant receiving this service found that sometimes the goods he received gets spoiled. He took insurance from an insurance company for the goods during transit. Over a period of time, the insurance company felt that the merchant is raising false claims, and want to implement a system to avoid this false claims.

The insurance company decided to implement an IoT solution to avoid the false claim. Therefore, considering the following parameters is imperative during transit.

Temperature: The goods needs to be frozen to maintain quality

Humidity: To avoid thawing of frozen goods

GPS Location: To track the route of the container

Door Sensor: To alert the company when the truck door is opened

Human Presence Sensor: To check any human presence in the container

Note: All the sensors are connected to the node (Hardware platform; in this case, LinkIt One/ Edison /Raspberry Pi), and measurement is passed on to the cloud using GPRS connectivity.

By measuring the mentioned parameters, the insurance company can identify if any anomaly has happened during transit. If anomalies are found, they will reject the claim.

For Example, 

  1. Change in Temperature and Humidity may affect the quality of goods – Can be identified using temperature and humidity sensor
  2. Deviation from the predefined route can affect the delivery time – Can be identified using GPS sensor
  3. Opening the door of truck will affect the Temperature, and Humidity maintained inside the truck – this can be identified using door sensor
  4. Stealing of goods can be identified by human presence sensor placed inside the truck

User Case Architecture

IoT Architecture

AWS Components in the Architecture

Node: The Hardware along with sensors connected to a Device (IoT Device) is termed as a node.

Thing: In AWS IoT terminology a ‘Thing’ represents a connected device( a.k.a Node).

Device Gateway: The AWS IoT Device Gateway enables secure and efficient communication between devices and AWS IoT. This can exchange messages using a publish/subscribe model, which allows one-to-one and one-to-many communications. The Data collected by the node is securely published to AWS IoT Device gateway using MQTT protocol.

AWS components

Device Shadow: The device shadow shows the current state of the device or the last known state of the device (if the node is offline). The data published to AWS IoT will reflect in the AWS IoT Device Shadow. The Thing shadow is a JSON document that is used to store the current state of the ‘Thing’

AWS IoT Rules: AWS IoT Rules gives IoT-enabled devices the ability to interact with AWS services. Rules are analyzed, and actions are performed based on the MQTT topic stream. Rules support tasks like these:

  1. Write data received from a device to an Amazon Dynamo DB database
  2. Process messages from a large number of devices using Amazon Kinesis
  3. Send a push notification using Amazon SNS to all users
  4. Save a file to Amazon S3
  5. Send the data from an MQTT message to Amazon Machine Learning to make predictions based on an Amazon ML model.

Amazon IAM: Amazon IAM: AWS Identity and Access Management helps users with secured control access to AWS resources. However, permission has to be granted by the account holder to AWS IoT to access these AWS resources. Users can use IAM to control who can use their AWS resources. The users can also control which AWS resource can have permission to accesses/manipulate other AWS resources.

Amazon Kinesis Streams: Amazon Kinesis Streams can continuously capture and store terabytes of data per hour and hundreds and thousands of sources. Amazon Kinesis can perform low-level processing on streams of data. Data records are accessible for a default of 24 hours from the time they are added to a stream. This time frame is called the retention period and is configurable in hourly increments from 24 to 168 hours (1 to 7 days).

EC2 Instance: An EC2 instance is a virtual server in Amazon’s EC2 (Elastic Compute Cloud)

Kinesis Client Library: The Amazon Kinesis Client Library (KCL) helps applications consume and process data from an Amazon Kinesis stream. The KCL takes care of several complex tasks that are associated with distributed computing, such as load-balancing across multiple instances, addressing to instance failures, and checkpointing processed records. The KCL acts as an intermediary between record processing logic and Streams.

Simple Storage Service (S3): Amazon S3 provides developers and IT teams with secure, durable, highly-scalable cloud storage. Amazon S3 is easy to use object storage with a simple web service interface to store and retrieve any amount of data from anywhere on the web. Amazon S3 is carefully engineered to meet the requirements for scalability, reliability, speed, low-cost, and simplicity. Each object in S3 can be managed with an object life cycle by using lifecycle configuration. Lifecycle configuration enables you to simplify the lifecycle management of your objects such as automatically sending less frequently accessed objects to low-cost storage alternatives like Amazon Glacier and scheduled deletions of the objects.

Amazon Glacier: Amazon Glacier is a low-cost storage service that provides secure, flexible and durable storage for data backup and archival. Customers can reliably store their data for only about $0.007 per gigabyte per month with Amazon Glacier. It enables any business to easily and cost-effectively retain data for months, years, or decades.

Amazon Dynamo DB: Amazon DynamoDB is a fast and flexible NoSQL database service for applications that need consistent single-digit millisecond latency at any scale. Dynamo DB allows a user to create database tables that can store and retrieve any amount of data, and serve any level of request traffic. Dynamo DB automatically spreads the data and traffic for the tables over a sufficient number of servers to handle throughput and storage requirements, while maintaining consistent and fast performance.

Amazon QuickSight: Amazon QuickSight is a very fast, cloud-powered business intelligence (BI) service that makes it easy for all employees to build visualizations, perform ad-hoc analysis, and quickly get business insights from their data. Amazon QuickSight uses a new, Super-fast, Parallel, In-memory Calculation Engine (“SPICE”) to perform advanced calculations and render visualizations rapidly. Amazon QuickSight easily connects to other AWS data services like Amazon Redshift, Amazon RDS, Amazon Dynamo DB, Amazon S3, and Amazon Kinesis. It can upload CSV, TSV, and spreadsheet files or connect to third-party data sources such as Salesforce.

Amazon Cognito: A smart mobile device can securely connect AWS IoT using AWS Cognito, which provides a secure way to access AWS services from Android and iOS mobile applications. Amazon Cognito also allows mobile applications to authenticate users through social identity providers such as Facebook, Twitter, and Amazon with SAML identity solutions.

AWS Short Notification Service (SNS): SNS is a fully managed push notification service that allows you send individual messages to large numbers of recipients. Amazon SNS makes it simple and cost-effective to send push notifications to mobile device users, email recipients or even send messages to other distributed services.

Solution for the Use Case

The above architecture diagram is the proposed solution for the logistics company, which is using services provided by AWS. The sensors are attached to Hardware board LinkIt One (node) that collects data from the sensors. In IoT scenario, a node represents a ‘Thing’ in our case the ‘Thing’ is the ‘Truck.’

In AWS IoT terminology a ‘Shadow’ is a virtual representation of ‘Thing’. The entire sensor data passed on from truck (via Node) to the AWS IoT is available in the ‘Shadow’.

To update available data at node to ‘Shadow’ and access data available in ‘Shadow’ AWS has given ‘Device SDK’.

In the above use case, the state of the logistic truck (node) (i.e., the temperature, humidity, location of the truck, human presence in the truck and truck door status) is published to the AWS Device gateway using MQTT protocol. The status of the truck published to the device gateway will reflect in the AWS IoT Device Shadow. Any mobile device authenticated by Amazon Cognito can retrieve the latest state stored in the device shadow. The current status of the truck such as current location or the temperature of the container can be monitored remotely from any mobile device.

In the above use case, the AWS IoT Rules Engine serves two purposes,

  1. The rules engine will continuously monitor the current device status, (i.e. current state published to the device gateway from the node). If the temperature or humidity increases, then their threshold values, or if someone opens the refrigerated container’s door in middle of transport, or if the driver of the truck varies from his specified route, the AWS IoT rules engine will trigger emergency alert by sending a push notification, email or SMS to the mobile phone of an admin of the logistics company using Amazon SNS (Short Notification Service).
  2. The rules engine will send the data that is published to the Device Gateway to Amazon Kinesis Streams for further processing and analysis of the data.

The logistic company can have hundreds of trucks. Monitoring and keeping track of all the trucks simultaneously can be tedious. So all the data from hundreds of trucks is sent to Amazon Kinesis Streams where simple processing is done and send to Dynamo DB and S3 from which data will be extracted by Amazon Quick Sight for Business Intelligence and Visual analytics.

Using this solution, the insurance company can keep track of each and every truck for which it gives service if trucks are deviating from the agreed upon conditions as per the insurance, the insurance claimed will not be honored. Now the Insurance Company have the data to show its client when a claim is raised. Thus avoiding the false claim.


About Mehter Muzzamil

Mehter Muzzamil is a software developer at Vmoksha Technologies who is having knowledge in the android domain and Internet of Things. He is passionate about exploring emerging technologies like Internet of Things and loves the varieties of challenges that these technologies bring. Apart from this, he likes to spend his time in reading books, watching movies, and playing games.

About Ciby Baby Punnamparambil

Ciby is a Solution Architect at Vmoksha with over 12 years of experience in the IT industry. He has in-depth knowledge and industry experience in delivering IoT embedded and Mobility solutions.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>