Unit V
Unit V
UNIT- V
UNIT- V Syllabus :
IoT Physical Servers and Cloud Offerings –Introduction to Cloud
Storage models and communication APIs. Webserver–Webserver for
IoT, Cloud for IoT, Python web application framework. Designing a
RESTful web API
Unit - V
• In truth, cloud computing and IoT are tightly coupled. The growth of IoT
and the rapid development of associated technologies create a widespread
connection of ―things.
• This has lead to the production of large amounts of data, which needs to
be stored, processed and accessed. Cloud computing as a paradigm for big
data storage and analytics. While IoT is exciting on its own, the real
innovation will come from combining it with cloud computing.
• The combination of cloud computing and IoT will enable new monitoring
services and powerful processing of sensory data streams. For example,
sensory data can be uploaded and stored with cloud computing, later to
be used intelligently for smart monitoring and actuation with other smart
devices. Ultimately, the goal is to be able to transform data to insight and
drive productive, cost-effective action from those insights. The cloud
effectively serves as the brain to improved decision-making and optimized
internet-based interactions.
• However, when IoT meets cloud, new challenges arise. There is an urgent
need for novel network architectures that seamlessly integrate them. The
critical concerns during integration are quality of service (QoS) and quality
of experience (QoE), as well as data security, privacy and reliability. The
virtual infrastructure for practical mobile computing and interfacing
includes integrating applications, storage devices, monitoring devices,
visualization platforms, analytics tools and client delivery.
1. Local APIs are the original form, from which the name came. They
offer OS or middleware services to application programs. Microsoft's
.NET APIs, the TAPI (Telephony API) for voice applications, and
database access APIs are examples of the local API form.
2. Web APIs are designed to represent widely used resources like HTML
pages and are accessed using a simple HTTP protocol. Any web URL
activates a web API. Web APIs are often called REST (representational state
transfer) or RESTful because the publisher of REST interfaces doesn't save
any data internally between requests. As such, requests from many users
can be intermingled as they would be on the internet.
3. Program APIs are based on remote procedure call (RPC) technology that
makes a remote program component appear to be local to the rest of the
software. Service oriented architecture (SOA) APIs, such as Microsoft's
WS-series of APIs, are programAPIs.
Xively Support
• The platform supports the REST, WebSockets and MQTT protocols and
connects the devices to Xively Cloud Services.
• Native SDKs for Android, Arduino, ARM mbed, Java, PHP, Ruby, and
Python languages.
Model
• The model acts as a definition of some stored data and handles the
interactions with the database. In a web application, the data can be stored
in a relational database, non-relational database, an XML file, etc. A
Django model is a Python class that outlines the variables and methods
for a particular type of data.
Template
• In a typical Django web application, the template is simply an HTML
page with a few extra placeholders. Django’s template language can be
used to create various forms of text files (XML, email, CSS, Javascript,
CSV, etc.)
View
• The view ties the model to the template. The view is where you write
the code that actually generates the web pages. View determines
what data is to be displayed, retrieves the data from the database
and passes the data to the template.
- The EC2 region, AWS access key and AWS secret key are passed
to this function. After connecting to EC2 , a new instance is
launched using the conn.run_instances function.
- The AMI-ID, instance type, EC2 key handle and security group
are passed to this function.
AutoScaling Group
• After creating a launch configuration, it is then associated with a new
AutoScaling group.
• AutoScaling group is created by calling conn.create_auto_scaling_group.
• The settings for AutoScaling group such as the maximum and minimum
number of instances in the group, the launch configuration, availability
zones, optional load balancer to use with the group, etc.
AutoScaling Policies
• After creating an AutoScaling group, the policies for scaling up and scaling
down are defined.
• In this example, a scale up policy with adjustment type Change In Capacity
and scaling_ad justment = 1 is defined.
• Similarly a scale down policy with adjustment type ChangeInCapacity and
scaling_ad justment = -1 is defined.
CloudWatch Alarms
• With the scaling policies defined, the next step is to create Amazon
CloudWatch alarms that trigger these policies.
• The scale up alarm is defined using the CPU Utilization metric with the
Average statistic and threshold greater 70% for a period of 60 sec. The
scale up policy created previously is associated with this alarm. This alarm
is triggered when the average CPU utilization of the instances in the group
becomes greater than 70% for more than 60 seconds.
• The scale down alarm is defined in a similar manner with a threshold less
than 50%.
• The RDS region, AWS access key and AWS secret key are passed to this
function.
• The input parameters to this function include the instance ID, database size,
instance type, database username, database password, database port,
database engine (e.g. MySQL5.1), database name, security groups, etc.
v) Amazon Dynamo DB
• In this example, a connection to DynamoDB service is first established by
calling boto.dynamodb.connect_to_region.
• After connecting to DynamoDB service, a schema for the new table is created
by calling conn.create_schema.
• The schema includes the hash key and range key names and types.