Unit 5 IOT
Unit 5 IOT
Communication types
1. Device-to-Device Communications
2. Device-to-Cloud Communications
Device-to-Device Communications:
The device-to-device communication model represents two or more
devices that directly connect and communicate between one another, rather
than through an intermediary application server. These devices communicate
over many types of networks, including IP networks or the Internet.
Often,however these devices use protocols like Bluetooth-Wave, or ZigBee to
establish direct device-to-device communications.
Attack Surfaces on Device to Device Communication:
Credentials stealing from the firmware
Sensitive information disclosure
No proper updating mechanism of firmware
DoS Attacks
Buffer-overflow
attacks
A buffer is a temporary area for data storage. When more data gets placed by a
program or system process, the extra data overflows. It causes some of that data
to leak out into other buffers, which can corrupt or overwrite whatever data they
were holding. In a buffer- overflow attack, the extra data sometimes holds
specific instructions for actions intended by a hacker or malicious user; for
example, the data could trigger a response that damages files, changes data or
unveils private information.
Best Practices for securing Device to Device Communication:
Evaluate hardware components, firmware, software, communications protocols
Try to Make the signed Firmware, software and hash your binaries.
Implement the machine to machine authentication securely.
Get the feedback from the clients to improve the device security levels
Device-to-Cloud Communications
In a device to cloud communication model, the IoT device connects
directly to an Internet cloud service like an application service provider to
exchange data and control message traffic. This approach frequently takes
advantage of existing communications mechanisms like traditional wired
MQTT Concepts
In MQTT, all messages are published into a shared topic space at the broker
level. A
―topic‖ in MQTT is a filter condition on the consolidated message stream that
runs through the MQTT broker from all publishers. Publishing topics have a
hierarchical structure (a path through topic space) and filters can be expressed as
direct matching conditions (topic name and filter expression must match), or the
filter can use wild-cards for single or multiple path segments.
Figure 2: MQTT Protocol
Every published message from any publisher is eligible for delivery into
any client session where a subscription exists with a matching topic filter.
MQTT is very suitable for fast and ―online‖ dispatch and distribution of
messages to many subscribers in scenarios where it’s feasible for the entirety
of the consolidated published message stream to be inspected on behalf of all
concurrent subscribers.
2. IoT in Cloud
The advent of cloud computing has acted as a catalyst for the development
and deployment of scalable Internet-of-Things business models and
applications. Therefore, IoT and cloud are nowadays two very closely affiliated
future internet technologies, which go hand-in-hand in non-trivial IoT
deployments.
Cloud computing is the next evolutionary step in Internet-based computing,
which provides the means for delivering ICT resources as a service. The ICT
resources that can be delivered through cloud computing model include
computing power, computing infrastructure (e.g.,servers and/or storage
resources), applications, business processes and more. Cloud computing
infrastructures and services have the following characteristics, which typically
differentiate them from similar (distributed computing) technologies:
Elasticity and the ability to scale up and down: Cloud computing
services can scale upwards during high periods of demand and downward
during periods of lighter demand. This elastic nature of cloud computing
facilitates the implementation of flexibly scalable business models, e.g.,
through enabling enterprises to use more or less resources as their business
grows or shrinks.
Self-service provisioning and automatic deprovisioning: Contrary to
conventional web-based Application Service Providers (ASP) models (e.g.,
web hosting), cloud computing enables easy access to cloud services without
a lengthy provisioning process. In cloud computing, both provisioning and de-
provisioning of resources can take place automatically.
Application programming interfaces (APIs): Cloud services are
accessible via APIs, which enable applications and data sources to
communicate with each other.
Billing and metering of service usage in a pay-as-you-go model: Cloud
services are associated with a utility-based pay-as-you-go model. To this end,
they provide the means for metering resource usage and subsequently issuing
bills.
Performance monitoring and measuring: Cloud computing
infrastructures provide a service management environment along with an
integrated approach for managing physical environments and IT systems.
Security: Cloud computing infrastructures offer security functionalities
towards safeguarding critical data and fulfilling customers’ compliance
requirements.
The two main business drivers behind the adoption of a cloud computing model
and associated services including:
Business Agility: Cloud computing alleviates tedious IT procurement
processes, since it facilitates flexible, timely and on-demand access to
computing resources (i.e. compute cycles, storage) as needed to meet business
targets.
Depending on the types of resources that are accessed as a service, cloud
computing is associated with different service delivery models.
Infrastructure as a Service (IaaS): IaaS deals with the delivery of
storage and computing resources towards supporting custom business
solutions. Enterprises opt for an IaaS cloud computing model in order to
benefit from lower prices, the ability to aggregate resources, accelerated
deployment, as well as increased and customized security. The most
prominent example of IaaS service Amazon’s Elastic Compute Cloud (EC2),
which uses the Xen open-source hypervisor to create and manage virtual
machines.
Platform as a Service (PaaS): PaaS provides development environments
for creating cloud-ready business applications. It provides a deeper set of
capabilities comparing to IaaS, including development, middleware, and
deployment capabilities. PaaS services create and encourage deep ecosystem
of partners who commit to this environment. Typical examples of PaaS
services are Google’s App Engine and Microsoft’s Azure cloud environment,
which both provide a workflow engine, development tools, a testing
environment, database integration functionalities, as well as third-party tools
and services.
Software as a Service (SaaS): SaaS services enable access to purpose-
built business applications in the cloud. Such services provide the pay-go-go,
reduced CAPEX and elastic properties of cloud computing infrastructures.
Cloud services can be offered through infrastructures (clouds) that are publicly
accessible (i.e. public cloud services), but also by privately owned
infrastructures (i.e. private cloud services). Furthermore, it is possible to offer
services supporting by both public and private clouds, which are characterized
as hybrid cloud services.
IoT/Cloud Convergence
One of the earliest efforts has been the famous Pachube.com infrastructure
(used extensively for radiation detection and production of radiation maps
during earthquakes in Japan). Pachube.com has evolved (following several
evolutions and acquisitions of this infrastructure) to Xively.com, which is
nowadays one of the most prominent public IoT clouds. Nevertheless, there
are tens of other public IoT clouds as well, such as ThingsWorx,
ThingsSpeak, Sensor-Cloud, Realtime.io and more. The list is certainly non-
exhaustive. These public IoT clouds offer commercial pay-as-you-go access to
end-users wishing to deploying IoT applications on the cloud. Most of them
come with developer friendly tools, which enable the development of cloud
applications, thus acting like a PaaS for IoT in the cloud.
Similarly to cloud computing infrastructures, IoT/cloud infrastructures and
related services can be classified to the following models:
Infrastructure-as-a-Service (IaaS) IoT/Clouds: These services provide
the means for accessing sensors and actuator in the cloud. The associated
business model involves the IoT/Cloud provide to act either as data or sensor
provider. IaaS services for IoT provide access control to resources as a
prerequisite for the offering of related pay-as-you-go services.
Platform-as-a-Service (PaaS) IoT/Clouds: This is the most widespread
model for IoT/cloud services, given that it is the model provided by all public
IoT/cloud infrastructures outlined above. As already illustrate most public IoT
clouds come with a range of tools and related environments for applications
development and deployment in a cloud environment. A main characteristic
of PaaS IoT services is that they provide access to data, not to hardware. This
is a clear differentiator comparing to IaaS.
Software-as-a-Service (SaaS) IoT/Clouds: SaaS IoT services are the
ones enabling their uses to access complete IoT-based software applications
through the cloud, on- demand and in a pay-as-you-go fashion. As soon as
sensors and IoT devices are not visible, SaaS IoT applications resemble very
much conventional cloud-based SaaS applications.
The benefits of integrating IoT into Cloud are discussed in this section as follows.
1. Communication
The Cloud is an effective and economical solution which can be used to
connect, manage, and track anything by using built-in apps and customized
portals . The availability of fast systems facilitates dynamic monitoring and
remote objects control, as well as data real-time access. It is worth declaring
that, although the Cloud can greatly develop and facilitate the IoT
interconnection, it still has weaknesses in certain areas. Thus, practical
restrictions can appear when an enormous amount of data needs to be
transferred from the Internet to the Cloud.
2. Storage
As the IoT can be used on billions of devices, it comprises a huge number of
information sources, which generate an enormous amount of semi-structured or
non-structured data . This is known as Big Data, and has three characteristics :
variety (e.g. data types), velocity (e.g. data generation frequency), and volume
(e.g. data size). The Cloud is considered to be one of the most cost-effective and
suitable solutions when it comes to dealing with the enormous amount of data
created by the IoT. Moreover, it produces new chances for data integration,
aggregation, and sharing with third parties .
3. Processing capabilities
IoT devices are characterized by limited processing capabilities which prevent
on-site and complex data processing. Instead, gathered data is transferred to
nodes that have high capabilities; indeed, it is here that aggregation and
processing are accomplished. However, achieving scalability remains a
challenge without an appropriate underlying infrastructure. Offering a solution,
the Cloud provides unlimited virtual processing capabilities and an on- demand
usage model . Predictive algorithms and data-driven decisions making can be
integrated into the IoT in order to increase revenue and reduce risks at a lower
cost .
4. Scope
With billions of users communicating with one another together and a variety of
information being collected, the world is quickly moving towards the Internet of
Everything (IoE) realm - a network of networks with billions of things that
generate new chances and risks . The Cloud-based IoT approach provides new
applications and services based on the expansion of the Cloud through the IoT
objects, which in turn allows the Cloud to work with a number of new real
world scenarios, and leads to the emergence of new services .
5. New abilities
The IoT is characterised by the heterogeneity of its devices, protocols, and
technologies. Hence, reliability, scalability, interoperability, security,
availability and efficiency can be very hard to achieve. Integrating IoT into the
Cloud resolves most of these issues. It provides other features such as easeof-
use and ease-of-access, with low deployment costs .
6. New Models
Cloud-based IoT integration empowers new scenarios for smart objects,
applications, and services. Some of the new models are listed as follows:
• SaaS (Sensing as a Service) , which allows access to sensor data;
• EaaS (Ethernet as a Service), the main role of which is to provide ubiquitous
connectivity to control remote devices;
• SAaaS (Sensing and Actuation as a Service), which provides control logics
automatically.
• IPMaaS (Identity and Policy Management as a Service) , which provides
access to policy and identity management.
• DBaaS (Database as a Service), which provides ubiquitous database management;
• SEaaS (Sensor Event as a Service) , which dispatches messaging services that are
generated by sensor events;
• SenaaS (Sensor as a Service) , which provides management for remote sensors;
• DaaS (Data as a Service), which provides ubiquitous access to any type of data.
3. Cloud Architecture
The cloud components of IoT architecture are positioned within a
three-tier architecture pattern comprising edge, platform and enterprise
tiers, as described in the Industrial Internet Consortium Reference
Architecture . The edge-tier includes Proximity Networks and Public
Networks where data is collected from devices and transmitted to devices.
Data flows through the IoT gateway or optionally directly from/to the
device then through edge services into the cloud provider via IoT
transformation and connectivity. The Platform tier is the provider cloud,
which receives, processes and analyzes data flows from the edge tier and
provides API Management and Visualization. It provides the capability to
initiate control commands from the enterprise network to the public
network as well. The Enterprise tier is represented by the Enterprise
Network comprised of Enterprise Data, Enterprise User Directory, and
Enterprise Applications. The data flow to and from the enterprise network
takes place via a Transformation and Connectivity component. The data
collected from structured and non-structured data sources, including real-
time data from stream computing, can be stored in the enterprise data.
One of the features of IoT systems is the need for application logic
and control logic in a hierarchy of locations, depending on the timescales
involved and the datasets that need to be brought to bear on the decisions
that need to be made. Some code may execute directly in the devices at the
very edge of the network, or alternatively in the IoT Gateways close to the
devices. Other code executes centrally in the provider cloud services or in
the enterprise network. This is sometimes alternatively called ―fog
computing‖ to contrast with centralised ―cloud computing‖, although fog
computing can also contain one or more layers below the cloud that each
could potentially provide capabilities for a variety of services like
analytics.
The following figure 3 shows the capabilities and relationships for supporting
IoT using cloud computing.
Proximity Network - contains the physical entities that are at the heart of
the IoT system, along with the devices that interact with the physical
entities and connect them to the IoT system.
IoT Gateway - acts as a means for connecting one or more devices to the
public network (typically the Internet). It is commonly the case that devices
have limited network connectivity – they may not be able to connect
directly to the Internet. This can be for a number of reasons, including the
limitation of power on the device, which can restrict the device to using a
low-power local network. The local network enables the devices to
communicate with a local IoT Gateway, which is then able to communicate
with the public network. The IoT Gateway contains the following
components:
App Logic - provides domain specific or IoT solution specific logic that
runs on the IoT Gateway. For IoT systems that have Actuators which act
on physical entities, a significant capability of the app logic is the
provision of control logic which makes decisions on how the actuators
should operate, given input from sensors and data of other kinds, either
held locally or held centrally.
Analytics - provides Analytics capability locally rather than in the
provider cloud.
Agent - allows management of the IoT Gateway itself and can also
enable management of the attached devices by providing a
connection to the provider cloud layer's Device
Management.service via the device management protocol.
Device Data Store - stores data locally. Devices may generate a large
amount of data in real time it may need to be stored locally rather than
being transmitted to a central location. Data in the device data store
can be used by the application logic and analytics capability in the IoT
Gateway.
Public Network - contains the wide area networks (typically the internet),
peer cloud systems, the edge services.
Peer Cloud - a 3rd party cloud system that provides services to bring data
and capabilities to the IoT platform. Peer clouds for IoT may contribute to
the data in the IoT system and may also provide some of the capabilities
defined in this IoT architecture. For example an IoT for Insurance solution
may use services from partners, such as weather data.
Edge Services - services needed to allow data to flow safely from the
internet into the provider cloud and into the enterprise. Edge services also
support end user applications. Edge services include:
Domain Name System Server - resolves the URL for a particular web
resource to the TCP-IP address of the system or service that can deliver that
resource.
Content Delivery Networks (CDN) - support end user applications by
providing geographically distributed systems of servers deployed to
minimize the response time for serving resources to geographically
distributed users, ensuring that content is highly available and provided to
users with minimum latency. Which servers are engaged will depend on
server proximity to the user, and where the content is stored or cached.
Firewall - controls communication access to or from a system
permitting only traffic meeting a set of policies to proceed and
blocking any traffic that does not meet the policies. Firewalls can be
implemented as separate dedicated hardware, or as a component in
other networking hardware such as a load-balancer or router or as
integral software to an operating system.
Load Balancers - provides distribution of network or application traffic
across many resources (such as computers, processors, storage, or
network links) to maximize throughput, minimize response time,
increase capacity and increase reliability of applications. Load
balancers can balance loads locally and globally. Load balancers should
be highly available without a single point of failure. Load balancers are
sometimes integrated as part of the provider cloud analytical system
components like stream processing, data integration, and repositories.
Provider Cloud - provides core IoT applications and associated services
including storage of device data; analytics; process management for the
IoT system; create visualizations of data. Also hosts components for
device management including a device registry.
Device Data Store - stores data from the IoT devices so that the data can
be integrated with processes and applications that are part of the IoT
System. Devices may generate a large amount of data in real time calling
for the Device Data Store to be elastic and scalable.
Security and Privacy - Security and Privacy in IoT deployments must address
both information technology (IT) security as well as operations technology (OT)
security elements. Furthermore, the level of attention to security and the topic
areas to address varies depending upon the application environment, business
pattern, and risk assessment. A risk assessment will take into account multiple
threats and attacks along with an estimate of the potential costs associated with
such attacks. In addition to security considerations, the connecting of IT
systems with physical systems also brings with it the need to consider the
impact to safety that the IoT system may have. IoT systems must be designed,
deployed, and managed such that they can always bring the system to a safe
operating state, even when disconnected from communications with other
systems that are part of the deployment. Identity and Access Management- As
with any computing system, there must be strong identification of all
participating entities – users, systems, applications, and, in the case of IoT,
devices and the IoT gateways through which those devices communicate with
the rest of the system. Device identity and management necessarily involves
multiple entities, starting with chip and device manufacturers, including IoT
platform providers, and also including enterprise users and operators of the
devices. In IoT solutions it is often the case that multiple of these entities will
continue to communicate and address the IoT devices throughout their
operational lifetime.
Data Protection -Data in the device, in flight throughout the public network,
provider cloud, and enterprise network, as well as at rest in a variety of locations
and formats must be protected from inappropriate access and use. Multiple
methods can be utilized, and indeed, in many cases, multiple methods are
applied simultaneously to provide different levels of protection of dataagainst
different types ofthreatsor isolation from different entities supporting the system.
4. AWS IoT
AWS IoT provides the following interfaces to create and interact with your devices:
Related Services
Each device has a shadow that stores and retrieves state information.
Each item in the state information has two entries: the state last reported
by the device and the desired state requested by an application. An
application can request the current state information for a device. The
shadow responds to the request by providing a JSON document with the
state information (both reported and desired), metadata, and a version
number. An application can control a device by requesting a change in its
state. The shadow accepts the state change request, updates its state
information, and sends a message to indicate the state information has
been updated. The device receives the message, changes its state, and
then reports its new state.
1. Open the AWS home page and choose Create an AWS Account.
2. Follow the online instructions. Part of the sign-up procedure involves
receiving a phone call and entering a PIN using your phone's keypad.
3. Sign in to the AWS Management Console and open the AWS IoT console.
4. On the Welcome page, choose Get started.
Register a Device in the Registry
1. On the Welcome to the AWS IoT Console page, in the left navigation
pane, choose Manage to expand the choices, and then choose Things.
Figure 5: Registration
2. On the page that says You don't have any things yet, choose Register a thing.
Figure 6: Register a Thing
3. On the Creating AWS IoT things page, choose Create a single thing.
4. On the Create a thing page, in the Name field, type a name for your
device, such as MyIoTButton. Choose Next to add your device to the
registry.
Communication between your device and AWS IoT is protected through the
use of
X.509 certificates. AWS IoT can generate a certificate for you or you can use your
own
X.509 certificate. AWS IoT generates the X.509 certificate for you.
Certificates must be activated prior to use.
3. Choose the back arrow until you have returned to the main AWS
IoT console screen.
X.509 certificates are used to authenticate your device with AWS IoT. AWS
IoT policies are used to authorize your device to perform AWS IoT operations,
such as subscribing or publishing to MQTT topics. Your device will presents its
certificate when sending messages to AWS IoT. To allow your device to
perform AWS IoT operations, you must create an AWS IoT policy and attach it
to your device certificate.
1. In the left navigation pane, choose Secure, and then Policies. On the You
don't have a policy yet page, choose Create a policy.
2. On the Create a policy page, in the Name field, type a name for the
policy (for example,MyIoTButtonPolicy). In the Action field,
type iot:Connect. In the Resource ARN field, type *. Select the
Allow checkbox. This allows all clients to connect to AWS IoT.
You can restrict which clients (devices) are able to connect by specifying a
client ARN as the resource. The client ARNs follow this format:
arn:aws:iot:your-region:your-aws-account:client/<my-client-id>
Finally, select the Allow check box. This allows your device to publish
messages to the specified topic.After you have entered the information for your
policy, choose Create.
Now that you have created a policy, you must attach it to your device
certificate. Attaching an AWS IoT policy to a certificate gives the device the
permissions specified in the policy.
2. In the box for the certificate you created, choose ... to open a drop-down
menu, and then choose Attach policy.
3. In the Attach policies to certificate(s) dialog box, select the check box
next to the policy you created in the previous step, and then choose
Attach.
1. Remove the AWS IoT button from its packaging, and then press and hold
the button until a blue blinking light appears. (This should take no longer
than 15 seconds.)
2. The button acts as a Wi-Fi access point, so when your computer searches
for Wi-Fi networks, it will find one called Button ConfigureMe - XXX
where XXX is a three- character string generated by the button. Use your
computer to connect to the button's Wi-Fi access point.
Configure a Different Device
1. In the AWS IoT console, in the left navigation pane, choose Test.
2. Subscribe to the topic on which your thing publishes. In the case of the
AWS IoT button, you can subscribe to iotbutton/+ (note that + is the
wildcard character). In Subscribe to a topic, in the Subscription topic
field, type iotbutton/+, and then choose Subscribe to topic. Choosing
Subscribe to topic above, results in the topic iotbutton/+ appearing
in theSubscriptions column.
3. Press your AWS IoT button, and then view the resulting message in the
AWS IoT MQTT client. If you do not have a button, you will simulate a
button press in the next step.
4. To use the AWS IoT console to publish a message:
On the MQTT client page, in the Publish section, in the Specify a topic
and a message to publish… field, type iotbutton/ABCDEFG12345. In
the message payload section, type the following JSON:
{
"serialNumber": "ABCDEFG12345",
"clickType": "SINGLE",
"batteryVoltage": "2000 mV"
}
Choose Publish to topic. You should see the message in the AWS IoT
MQTT client (choose iotbutton/+ in the Subscription column to see the
message).
The AWS IoT rules engine listens for incoming MQTT messages that
match a rule. When a matching message is received, the rule takes some action
with the data in the MQTT message (for example, writing data to an Amazon S3
bucket, invoking a Lambda function, or sending a message to an Amazon SNS
topic). In this step, you will create and configure a rule to send the data received
from a device to an Amazon SNS topic. Specifically, you will:
Scalability
The kinds of applications that people want to host in the cloud are often
meant to handle lots of users. Yet the traditional Windows Server
programming model wasn’t explicitly designed to support Internet-scale
applications. The Windows Azure programming model, however, was
intended from the start to do this. Created for the cloud era, it’s designed to let
developers build the scalable applications that massive cloud data centres can
support. Just as important, it also allows applications to scale down when
necessary, letting them use just the resources they need and pay for only the
computing resources used.
Windows Azure has three core components: Compute, Storage and Fabric. As
the names suggest, Compute provides a computation environment with Web
Role and Worker Role while Storage focuses on providing scalable storage
(Blobs, Tables, Queue and Drives) for large-scale needs.
Fabric Controller
Windows Azure is designed to run in data centres containing lots of
computers. Accordingly, every Windows Azure application runs on multiple
machines simultaneously. All the computers in a particular Windows Azure
data centre are managed by an application called the fabric controller. The
fabric controller is itself a distributed application that runs across multiple
computers. When a developer gives Windows Azure an application to run, he
provides the code for the application’s roles together with the service
definition and service configuration files for this application. Among other
things, this information tells the fabric controller how many instances of each
role it should create. The fabric controller chooses a physical machine for
each instance, then creates a VM on that machine and starts the instance
running. The role instances for a single application are spread across different
machines within this data centre. Once it’s created these instances, the fabric
controller continues to monitor them. If an instance fails for any reason—
hardware or software—the fabric controller will start a new instance for that
role. While failures might cause an application’s instance count to temporarily
drop below what the developer requested, the fabric controller will always
start new instances as needed to maintain the target number for each of the
application’s roles.
Azure storage
Windows Azure offers blobs, tables, queues etc., as data storage options.
They are a new type of data storage, they are fast and they are non-relational.
Storage must be external to role instances. This is to ensure if a role instance
fails, any data it contains is not lost. So Windows Azure stores data
persistently outside role instances. This way another role instance can now
access data that otherwise would have been lost if that data had been stored
locally on a failed instance. Storage is replicated. Just as a Windows Azure
application runs multiple role instances to allow for failures, Windows Azure
storage provides multiple copies of data. Without this, a single failure would
make data unavailable, something that’s not acceptable for highly available
applications.
Identity Management
All applications and services must manage user identity. This is
particularly important in cloud-based scenarios that can potentially serve a
very large number of customers and each of these customers may have their
own identity framework. The ideal solution is a solution that takes advantage
of the customers existing on-premises or federated directory service to enable
single sign on (SSO) across their local and all external hosted services. This
reduces the development effort of building individual and separate identity
management systems. SSO allows users to access the application or service
using their existing credentials.
Windows Azure - One or more instances of web roles and worker roles: Every
Windows Azure application consists of one or more roles. When it executes,
an application that conforms to the Windows Azure programming model must
run at least two copies—two distinct instances—of each role it contains. Each
instance runs as its own VM. Every instance of a particular role runs the exact
same code. In fact, with most Windows Azure applications, each instance is
just like all of the other instances of that role—they’re interchangeable. For
example, Windows Azure automatically load balances HTTP requests
across an application’s Web role instances.