Jump to a section
IoT Analytics in Cloud Environments
3.1Why cloud for IoT analytics
IoT deployments produce data that is massive in volume, heterogeneous (temperature floats, GPS traces, images, logs), real-time and geographically distributed. Sizing an on-premises data centre for this is hard: you would have to buy for the peak load and leave it idle most of the time. The cloud gives scalable, flexible and cost-effective infrastructure plus ready-made analytics tools.
| Benefit | What it means for IoT analytics |
|---|---|
| Scalability & elasticity | Capacity grows and shrinks with the data stream, so you avoid over-provisioning local servers for peak traffic. |
| Cost efficiency (pay-as-you-go) | Pay only for the compute and storage actually consumed. Capital expense (buying servers) becomes operational expense. |
| Variety of services | Storage, compute, machine learning, visualisation and messaging are all available as managed services. |
| Security & compliance | Built-in encryption, identity management and audit, essential for sensitive domains like healthcare and smart cities. |
| Agility | Rapid experimentation and faster time-to-market: spin up a cluster in minutes, throw it away when done. |
Worked example: talking to a Mars rover replica
The slide shows an AWS application that retrieves IoT data (temperature on Mars) through voice. It touches voice recognition, speech generation, storage, device interaction, networking, security and messaging in one flow:
- IoT device → AWS IoTThe user asks for the temperature on Mars through an IoT device; AWS IoT receives the request securely.
- AWS Lambda → Amazon LexA Lambda function passes the request to Lex, the conversational (chatbot) service.
- Lex recognises the intentLex identifies the intent "get temperature on Mars".
- Lex asks a follow-up"Celsius or Fahrenheit?" A slot is filled through dialogue.
- Lambda queries DynamoDBA second Lambda fetches the reading from the NoSQL database; it can also call SNS/SES to send a text or email.
- Lex responds, Polly speaks"Mars is minus 125 degrees Celsius." Amazon Polly converts the text to natural speech. CloudWatch records logs and metrics throughout.
over-provisioningpay-as-you-goelasticityheterogeneous dataLexPollyDynamoDBSNS/SESCloudWatch3.2Elastic analytics concepts
Elastic analytics is the ability of a data analytics system to dynamically scale up or down its computing and storage resources based on demand, giving performance, cost-efficiency and adaptability for fluctuating workloads.
Scaling comes in two flavours. Vertical scaling (scale up) gives one machine more CPU or RAM. Horizontal scaling (scale out) adds more machines; this is what distributed IoT analytics relies on. The five design principles from the slides:
| Principle | Explanation |
|---|---|
| Separate compute from storage | Keep data in elastic object storage (AWS S3, Azure Blob Storage) that grows with the stream. Compute clusters can be started, resized or destroyed without touching the data. No pre-purchased fixed storage capacity. |
| Build for scale from the start | Design code and services so they handle one user or a million without a rewrite: stateless services, partitioned data, queues between stages. |
| Make your bottleneck wetware, not hardware | "Wetware" means the human brain. The limiting factor should be your thinking, never "my laptop doesn't have enough memory to run the job". If a job needs 500 GB of RAM, rent it for an hour. |
| Manage to a spend budget, not to available hardware | The constraint is money, not a fixed rack of servers. Expand when needed, contract quickly to stay efficient. |
| Experiment, experiment, experiment | Spin up resources, terminate failures, iterate towards the right solution, then scale up or down as needed. Failed experiments cost little. |
elastic analyticsscale up / scale outcompute–storage separationwetwarespend budget3.3Traditional distributed computing
Distributed computing is a paradigm where a collection of interconnected computers share resources, divide tasks and work together to solve problems or process data as a unified system. It is also called cluster computing.
- Each computer in the cluster is a node. A cluster can be a few nodes or thousands.
- The framework (Hadoop, Spark) handles orchestration: splitting work, scheduling tasks on nodes, moving data and retrying failures.
- To the programmer it appears as one system; the distribution is hidden "under the covers".
When a single server is the better choice
Distribution carries a complexity cost. Even with frameworks doing the heavy lifting, you still have to design your analytics to work across multiple nodes (data partitioning, network shuffles, partial failures). Keep it simple and use one server when:
Use a single server
- Not much need for scale
- Small data instead of big data
- Resource needs are minimal
Use distributed computing
- Data exceeds one machine's memory or disk
- Job runtime must drop through parallelism
- Fault tolerance is required
cluster computingnodeorchestrationcomplexity costunified system3.4Cloud security and analytics
The rapid growth of IoT devices demands robust cloud security. Cloud platforms enable scale but also introduce new vulnerabilities: every device is an entry point, and data travels over public networks. Security analytics (analysing logs, traffic and behaviour) enables proactive threat detection, catching anomalies before they become breaches.
Protection of data, devices and communication in cloud-integrated IoT systems, using encryption, authentication, access control and secure APIs.
Key threats in IoT cloud environments
| Threat | IoT example | Mitigation |
|---|---|---|
| Data breaches | Health-monitor readings exposed from a misconfigured public bucket | Encryption at rest, private buckets, least-privilege IAM |
| Denial-of-service (DoS) | Thousands of compromised cameras flooding an endpoint (botnet / DDoS) | Rate limiting, AWS Shield / WAF, auto scaling |
| Malware and ransomware | Device firmware infected; stored data encrypted and held for ransom | Signed firmware updates, backups, patching, network segmentation |
| Unauthorized access | Default or shared credentials used to log in to a gateway | Named accounts, key-based auth, MFA, security groups |
security analyticsproactive threat detectionencryptionauthenticationaccess controlsecure APIsDoSransomware3.5Public/private key cryptography in cloud and IoT
Asymmetric encryption uses a key pair: a public key that is shared freely and a private key kept secret. Whatever the public key encrypts, only the matching private key can decrypt. That is why distributing the public key widely poses no security risk.
Symmetric
One shared secret key encrypts and decrypts (e.g. AES). Fast, but the key must somehow reach both parties safely.
Asymmetric
Public key encrypts, private key decrypts (e.g. RSA, ECC). Solves key distribution; slower, so it is often used to exchange a symmetric session key.
- Cloud providers rely on this model to secure communications. It underpins SSL/TLS, the protocol behind HTTPS websites.
- In IoT analytics, key pairs act as a stronger version of username/password authentication: an EC2 login uses an SSH key pair, and an AWS IoT device authenticates with an X.509 certificate and its private key.
- The scheme is proven, robust and widely trusted in cloud environments.
asymmetric encryptionkey pairSSL/TLSHTTPSSSH keyX.509 certificate3.6Public vs private subnets
Subnets are logical segments of a cloud network (an IP range carved out of the VPC) where resources are deployed.
| Public subnet | Private subnet | |
|---|---|---|
| Internet reachability | Reachable from the internet, but only if the resource has a public IP | No direct internet access |
| Route to internet | Route table points 0.0.0.0/0 to an Internet Gateway | Outbound traffic goes through a NAT gateway placed in a public subnet |
| Typical residents | Web servers, load balancers, bastion hosts | Databases, analytics engines, Spark/Hadoop clusters |
For security, most analytics workloads should run in private subnets, even though this adds complexity (NAT, bastion hosts, VPN for access). Always identify and manage your subnet types carefully to prevent unauthorized access.
subnetpublic IPNAT gatewayinternet gatewayroute table3.7Access restrictions in IoT analytics
- Use named user accounts. Avoid shared credentials so every action is traceable to a person: accountability.
- Protect private keys when using public/private key authentication. A leaked private key equals a leaked password.
- Restrict network traffic to only what is necessary and block everything else by default (default deny).
- Start with a locked-down environment, then selectively open access as needed. This is the principle of least privilege.
- In distributed computing, misconfigured network or security settings are a common cause of analytic failures (nodes cannot reach each other), so apply best practices from the outset.
named accountsleast privilegedefault denylocked-down environment3.8Securing customer data
IoT data is sensitive and can reveal personal insights (when you are home, your heart rate, where you drive). It must be protected with strong access controls and encryption, and failing to secure it creates legal risk under data-protection laws.
Encryption in transit
Protects data while it moves across the network, e.g. SSL/TLS between device, gateway and cloud.
Encryption at rest
Protects stored data on servers, disks and databases, e.g. S3 server-side encryption, encrypted EBS volumes, AWS KMS keys.
- Use public/private key pairs for seamless encryption, especially when data is widely accessible.
- If data is tightly controlled and stored in a private subnet, encryption can be relaxed slightly, but only when the risk is minimal.
- Best practice: always encrypt when possible, especially data exposed to the public internet.
- Cloud platforms offer built-in security features; leverage them fully.
in transitat restlegal riskKMS3.9Amazon Web Services
- AWS is the dominant global cloud provider. The slide dates its launch to 2005.
- Ranked #1 in Gartner's Magic Quadrant for cloud infrastructure.
- As of 2016, AWS had about 10× the compute capacity of its 14 closest competitors combined.
- Netflix and Airbnb run their operations on AWS.
- Market share: AWS about 30%. The text slide gives the nearest rival at 9% (older figure); the Q2 2025 chart shows Azure 20% and Google Cloud 13%.
Global infrastructure
| Concept | Meaning |
|---|---|
| Region | A geographic area (e.g. Mumbai, ap-south-1) containing one or more data centres, designed for low latency to nearby users. Data stays in the region you choose. |
| Availability Zone (AZ) | An isolated data centre (or group of them) inside a region with independent power and networking. Spreading resources across AZs gives high availability and fault tolerance: the application keeps running if one zone fails. |
| Global network | High-speed private fibre connecting AWS data centres worldwide. |
regionavailability zonefault tolerancehigh availabilityGartner Magic Quadrant3.10Virtual Private Cloud (VPC)
A VPC is a logically isolated section of a public cloud where you launch resources in a virtual network you define. It gives control over networking: IP ranges, subnets, route tables, gateways and security settings.
- Isolation: your VPC is private to your account even though it runs on shared infrastructure.
- Subnets: public (web servers) and private (databases, analytics engines).
- Security controls: Network ACLs and Security Groups.
| Security Group | Network ACL | |
|---|---|---|
| Level | Instance (network interface) | Subnet |
| State | Stateful: return traffic is automatically allowed | Stateless: return traffic needs its own rule |
| Rules | Allow rules only | Allow and deny rules |
| Evaluation | All rules evaluated together | Numbered rules, lowest number first |
| Analogy | Firewall on each server | Checkpoint at the subnet boundary |
logical isolationCIDRroute tablesecurity groupNACLstateful / stateless3.11Identity & Access Management (IAM)
IAM provides secure access control to AWS resources. You manage users, groups, roles and permissions so that only authorized identities can access specific services or data.
| Identity | What it is | IoT analytics example |
|---|---|---|
| User | A person or application with long-term credentials | Data analyst "priya" who logs into the console |
| Group | A collection of users sharing the same policies | "DataScientists" group with read access to the sensor bucket |
| Role | An identity assumed temporarily; issues temporary credentials, no password | A Lambda execution role allowed to write to DynamoDB |
| Credentials | Password, access keys, MFA device | Access key used by a gateway script |
A policy, statement by statement
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": ["s3:GetObject", "s3:ListBucket"],
"Resource": [
"arn:aws:s3:::iot-sensor-data",
"arn:aws:s3:::iot-sensor-data/*"
]
}
]
}
Each statement has an Effect (Allow/Deny), Action (API calls), Resource (ARNs) and optionally a Condition. Evaluation rule: everything is implicitly denied by default, an explicit Allow grants access, and an explicit Deny always wins.
usersgroupsrolespoliciesstatementstemporary credentialsexplicit denyARN3.12Elastic Compute Cloud (EC2)
A scalable compute service to launch and manage virtual servers (instances) for hosting applications, analytics and data pipelines. It is the backbone for running scalable IoT analytics workloads.
- Choose the memory, storage and CPU you need (the instance type), and stop the instance when done so you stop paying for compute.
- Instances boot from an AMI (Amazon Machine Image) and you log in with a key pair.
- Secure, reliable, high-performance and cost-effective; deploy applications without managing physical hardware.
- Secure instances with VPC, subnets and security groups.
- Attach Auto Scaling to add or remove instances automatically based on demand or traffic.
- Pricing models: On-Demand, Reserved/Savings Plans (cheaper for steady load) and Spot (very cheap, can be reclaimed; good for batch analytics).
instanceinstance typeAMIkey pairAuto ScalingSpot3.13Simple Storage Service (S3)
A highly durable, scalable and cost-effective object storage service used for IoT data, logs, datasets and backups. It integrates with analytics and ML tools (Athena, EMR, Redshift, SageMaker) to process stored data.
- Bucket: top-level container with a globally unique name. Object: the file plus metadata. Key: the object's name/path.
- Designed for 99.999999999% (eleven nines) durability; single objects up to 5 TB; virtually unlimited total storage.
- Storage classes trade cost against access speed: Standard, Infrequent Access, Glacier for archives.
- S3 is the usual data lake for IoT: raw readings land here and are queried later with Athena or processed with EMR/Spark.
object storagebucketobject keydurabilitydata lakestorage class3.14Microsoft Azure
Azure cloud offers solutions that integrate with business data, illustrated through a Quality Management System. Its pitch is integration at both the infrastructure and application level: "our solutions are not islands".
Azure Analysis Services
- Built on Microsoft SQL Server Analysis Services (SSAS); compatible with SQL Server 2016 Analysis Services Enterprise Edition.
- Supports tabular models (in-memory semantic data models used by BI tools).
- Functionality: DirectQuery (query the source live instead of importing data), partitions (process large tables in pieces), row-level security (users see only their rows), bidirectional relationships (filters flow both ways between tables) and translations (model metadata in multiple languages).
- Use the same tools as SSAS: build and deploy tabular models with SQL Server Data Tools (SSDT) or Azure templates in SQL Server Management Studio (SSMS).
Case study: Modus Consulting, ProcessFrame
| Situation | A quality management system must pull data from ERP (enterprise resource planning) and CRM (customer relationship management) systems, push data back to BI tools, and simplify secure authentication and user management. |
| Solution | Azure Hybrid Connections: scheduled CSV import/export, access to SQL Server views and input/output web services, letting ProcessFrame offer integration. Azure Active Directory (now Microsoft Entra ID) gives transparent user management and single sign-on, even when ProcessFrame runs in remote cloud infrastructure. |
| Benefits | Integration as smooth as an on-premises install; cloud solution and security for Modus customers without traditional hardware costs. |
SSAStabular modelDirectQueryrow-level securitySSDT / SSMSHybrid ConnectionsAzure ADSSOERP / CRM3.15ThingWorx (PTC)
ThingWorx is developed by PTC (Parametric Technology Corporation). It is a purpose-built IIoT (industrial IoT) platform for rapidly developing and deploying connected applications.
ThingWorx Core
Central platform that manages IoT applications, models and data.
Connection Services
Connectivity between devices and the platform; handles protocols and adapters.
ThingWorx Edge
Lightweight runtime on devices to communicate with the platform.
Key concepts (the ThingWorx data model)
| Concept | Meaning | Example |
|---|---|---|
| Thing Template | Blueprint defining properties, services and behaviours of a "thing" | "CNCMachineTemplate" |
| Thing | Instance created from a template; represents a real device | "CNC_Line3_Unit7" |
| Property | Attribute of a Thing | temperature, status |
| Service | Function the Thing can perform | resetDevice, updateConfig |
| Event | Notification triggered by a change or condition | OverTemperature alert |
| Thing Shape / Data Shape | Reusable sets of attributes / data structures | A "Vibration" shape reused by many machines |
| Entity | Any logical building block of a ThingWorx application | Things, templates, mashups, users |
Why ThingWorx for IoT analytics: rapid drag-and-drop application development; integration with industrial protocols (OPC, MQTT, REST APIs); real-time dashboards (mashups); scalable for IIoT; built-in machine learning and predictive analytics extensions.
Connection Services: integrating AWS IoT with ThingWorx
- Device publishesThe AWS IoT Edge SDK (Node.js) publishes state to the MQTT topic
$aws/things/{thingName}/shadow/update. - Broker and Device ShadowThe AWS IoT MQTT broker updates the Device Shadow, a JSON copy of the device's last known state, and replies on
/accepted,/rejectedor/delta. - Rule Engine → KinesisAn IoT rule (
select … from $aws/things/+/shadow/update/accepted) forwards accepted updates into a Kinesis stream. - Adapter → CoreThe ThingWorx Connection Server's AWS IoT Adapter reads the stream and calls
UpdateSubscribedPropertyValueson the matchingAwsIotThingin ThingWorx Core. - Writes flow backReadProperty/WriteProperty from ThingWorx update the Device Shadow; the device receives the change on the delta topic.
PTCIIoTThing TemplateThing ShapeData ShapeEdgeConnection ServerDevice ShadowMQTTOPC3.16AWS CloudFormation
CloudFormation is an Infrastructure as Code (IaC) service to model, provision and manage AWS resources automatically, so you spend less time managing resources and more on your applications. It can simplify infrastructure management, quickly replicate infrastructure (dev, test, prod, other regions) and control and track changes (templates live in version control).
| Template | Stack | |
|---|---|---|
| What | Blueprint file (JSON or YAML) defining infrastructure and configuration | Running instance of a template: the actual set of AWS resources |
| Analogy | Architectural plan | The building constructed from the plan |
| Nature | Static: a definition, not deployed | Dynamic: live infrastructure |
Structure of a template
| Section | Required? | Purpose |
|---|---|---|
| Format Version | Optional | Version of the template language (2010-09-09) |
| Description | Optional | Human-readable notes |
| Metadata | Optional | Extra data to guide deployment tools |
| Parameters | Optional | Inputs to customise resources (e.g. instance type) |
| Mappings | Optional | Key-value maps for region- or environment-specific values (e.g. AMI ID per region) |
| Conditions | Optional | Logic controlling resource creation (only create RDS in production) |
| Resources | Mandatory | The AWS resources to create (EC2, S3, IAM…) |
| Outputs | Optional | Values returned after creation (load balancer URL, VPC ID) |
AWSTemplateFormatVersion: "2010-09-09"
Description: IoT analytics base network and sensor data lake
Parameters:
EnvName:
Type: String
Default: dev
Resources:
AnalyticsVPC:
Type: AWS::EC2::VPC
Properties:
CidrBlock: 172.31.0.0/16
EnableDnsSupport: true
EnableDnsHostnames: true
PrivateSubnetA:
Type: AWS::EC2::Subnet
Properties:
VpcId: !Ref AnalyticsVPC
CidrBlock: 172.31.0.0/20
AvailabilityZone: ap-south-1a
SensorDataBucket:
Type: AWS::S3::Bucket
Properties:
BucketName: !Sub "iot-sensor-${EnvName}-${AWS::AccountId}"
Outputs:
VpcId:
Value: !Ref AnalyticsVPC
Stack lifecycle
- Creation: launching a stack provisions every resource in the template, in dependency order. If anything fails, it rolls back.
- Update: change the template; CloudFormation works out what to add, modify or delete (preview it with a change set).
- Deletion: deleting the stack removes all its resources.
- Drift detection: checks whether resources were changed manually outside CloudFormation.
Infrastructure as CodetemplatestackResources (mandatory)ParametersMappingsConditionsOutputsdrift detectionchange set3.17Creating an AWS cloud analytics environment: VPC setup
- Create the VPC and define its IP range (pool)Set the boundary with a CIDR block, e.g.
172.31.0.0/16or10.0.0.0/16(65,536 addresses). At least one VPC is required per region. Choose tenancy: default (shared hardware) or dedicated. - Subdivide the range into subnetsSize each subnet to its needs. VPCs are regional; subnets are tied to a specific Availability Zone.
- Create routing tables (optional)AWS creates a main route table by default; create custom ones for specific routing needs.
- Set up an Internet Gateway (IGW)The access point connecting the VPC to the wider internet.
- Configure the route table with the IGW and subnetAdd a route
0.0.0.0/0 → igwand associate the relevant subnets, which makes them public. - Enable public IP configuration on the subnetAuto-assign public IPs so instances there can be reached.
- Enable DNS hostname resolution for the VPCNeeded by services such as EFS and RDS that are addressed by DNS name.
CIDR blockIP pooltenancyinternet gatewayroute tableDNS hostnames5 reserved IPsData Collection, Processing and Exploration
4.1Data collection techniques
Data collection techniques are the methods, tools and processes used to gather raw data from different sources (sensors, applications, logs, user interactions, devices, external systems) for storage, processing and analysis. In cloud environments like AWS they involve streaming, batch ingestion, transformation and querying to make data useful for analytics, decisions and machine learning.
| Characteristic | Meaning | AWS example |
|---|---|---|
| Source diversity | Data from IoT devices, applications, databases, APIs, logs or streams | AWS IoT Core, API Gateway |
| Collection mode | Real-time (streaming) vs batch (periodic uploads) | Kinesis vs scheduled S3 uploads |
| Transformation | Raw data filtered, cleaned or structured | Lambda, Glue ETL |
| Storage destination | S3, databases or data warehouses | S3, DynamoDB, Redshift |
| Analysis readiness | Prepared for querying, dashboards or ML | Athena, QuickSight, SageMaker |
ingestionstreamingbatchETLsource diversityanalysis readiness4.2Amazon Kinesis
A fully managed AWS service for real-time data streaming and processing. Developers can ingest, analyse and respond to large volumes of streaming data from IoT devices, application logs, social media feeds and video streams.
| Component | Purpose | Remember it as |
|---|---|---|
| Kinesis Data Streams | Capture and process real-time streams at scale; you write the consumers | The raw pipe |
| Kinesis Data Firehose | Deliver streaming data to S3, Redshift or Elasticsearch/OpenSearch with no consumer code; can batch, compress and transform | The delivery truck |
| Kinesis Data Analytics | Analyse streams with SQL or Apache Flink in real time | The live calculator |
| Kinesis Video Streams | Ingest and process video for analytics and ML | The camera feed |
How it works
- Data ingestionProducers send records (JSON or binary) from sensors, applications or logs.
- Sharding and scalingRecords are split across shards using a partition key, giving parallel processing and fault tolerance. Add shards to scale horizontally. One shard takes about 1 MB/s or 1,000 records/s in and 2 MB/s out.
- Processing and bufferingTransformations such as filtering or aggregation are applied; data is retained for 24 hours by default (extendable) so consumers can replay it.
- Data access and deliveryProcessed data is exposed via APIs or delivered to other AWS services for storage or analysis.
producerconsumershardpartition keyData StreamsFirehoseData AnalyticsVideo Streamsretention4.3AWS Lambda
AWS Lambda is a serverless computing service that runs your code in response to events without provisioning or managing servers.
| Core feature | Detail |
|---|---|
| Event-driven execution | Functions trigger automatically on events from S3, DynamoDB, API Gateway or Kinesis |
| Fully managed infrastructure | AWS handles provisioning, scaling, patching and monitoring |
| Automatic scaling | Scales with demand, down to zero when idle (you pay nothing while idle) |
| Flexible runtimes | Node.js, Python, Java, Go, .NET, Ruby and custom runtimes |
| MicroVM isolation | Runs in Firecracker microVMs: secure, fast, lightweight execution environments |
- Upload codePackage as a ZIP file or container image.
- Define triggersHTTP requests, file uploads, database changes, stream records.
- Configure runtime and permissionsPick a runtime, allocate memory (CPU scales with it) and attach an IAM execution role.
- Execute and scale automaticallyLambda runs on each trigger and scales with traffic. Limits to remember: max 15 minutes per invocation; first call after idle may see a cold start.
IoT use: a Kinesis stream of temperature readings triggers a Lambda that flags readings above a threshold and writes alerts to DynamoDB or sends them through SNS.
serverlessevent-driventriggerscale to zeroFirecrackerexecution rolecold start4.4Amazon Athena
Amazon Athena is a serverless, interactive query service that analyses data directly in Amazon S3 using standard SQL or Apache Spark.
- Serverless: no infrastructure; you pay only for the queries you run (billed per data scanned).
- SQL and Spark: ad-hoc SQL queries, or analytics applications built with Spark.
- Fast: queries run in parallel and scale automatically for large datasets.
- Integrated with AWS Glue: the Glue Data Catalog stores table metadata (schema, location); Glue also runs ETL jobs.
- Notebook interface: develop Spark applications in Python in a simplified notebook.
SELECT device_id, AVG(temperature) AS avg_temp FROM iot_db.sensor_readings WHERE dt = '2026-10-09' GROUP BY device_id HAVING AVG(temperature) > 45;
Because cost depends on bytes scanned, storing IoT data in columnar formats (Parquet/ORC), compressing it and partitioning it by date cuts both cost and latency. Athena's model is schema-on-read: the schema is applied when you query, not when data is written.
serverless queryS3SQLGlue Data Catalogpay per queryschema-on-readParquet4.5Data processing: batch, stream and message queue
Batch processing
Collect data over a period, then process it all at once, periodically.
Used in: payroll, data warehousing (ETL), end-of-day reporting, large-scale transformation.
Challenges: unsuitable for real-time feedback; data goes stale if intervals are long.
Stream processing
Continuously analyse data as it arrives, in real or near-real time, record by record or in small chunks.
Used in: fraud detection, monitoring (server logs, sensor data), live dashboards, IoT.
Challenges: managing state and reliability; handling out-of-order data and failures.
Message queue
Asynchronous protocol: messages are stored in a queue until a consumer processes them. Decouples sender and receiver.
Used in: microservices, task scheduling, background jobs, event-driven systems, reliable delivery.
| Batch | Stream | Message queue | |
|---|---|---|---|
| Unit of work | Large bounded dataset | Unbounded flow of events | Individual message/task |
| Latency | Minutes to hours | Milliseconds to seconds | Depends on consumer speed |
| Trigger | Schedule or manual | Data arrival | Message in queue |
| Main goal | Throughput | Low latency insight | Decoupling, reliable delivery |
| Tools | Hadoop MapReduce, EMR, Glue | Kinesis, Spark Streaming, Flink | RabbitMQ, Amazon SQS, Kafka |
| IoT example | Nightly energy-usage report per building | Instant alert when a turbine vibrates abnormally | Queue firmware-update jobs for 10,000 devices |
batchstreammessage queuedata stalenessout-of-order datadecouplingasynchronous4.6Hadoop and MapReduce
An open-source framework for distributed storage and processing of large datasets on clusters of commodity hardware. It gives scalable, fault-tolerant data management and is widely used in big data analytics. Core parts: HDFS (storage, files split into replicated blocks), YARN (resource management) and MapReduce (processing).
A programming model and processing framework (Java-based) for large-scale data across clusters. It splits tasks into smaller units, processes them in parallel and aggregates the results.
- Two important tasks: Map converts input into intermediate key/value pairs (tuples); Reduce takes the map output and combines those tuples into a smaller set. Reduce always runs after map.
- The processing primitives are called mappers and reducers.
- Decomposing an application into mappers and reducers can be nontrivial, but once written, scaling it to hundreds, thousands or tens of thousands of machines is merely a configuration change. This easy scalability is its main advantage.
Three stages
- Map stageInput (a file or directory in HDFS) is passed to the mapper line by line; the mapper emits small chunks of key/value pairs.
- Shuffle stageThe framework sorts map output and groups all values with the same key, sending each key to one reducer.
- Reduce stageThe reducer processes each key's list of values and writes the final output back to HDFS. (The slide treats shuffle + reduce together as the "reduce stage".)
Worked example: counting device statuses
Input log (two splits): ok fail ok and ok ok fail.
| Stage | Output |
|---|---|
| Map (split 1) | (ok,1) (fail,1) (ok,1) |
| Map (split 2) | (ok,1) (ok,1) (fail,1) |
| Shuffle & sort | fail → [1,1], ok → [1,1,1,1] |
| Reduce (sum) | (fail,2) (ok,4) |
commodity hardwareHDFSmapperreducerkey/value tuplesshufflefault toleranceHivePigHBase4.7Apache Spark Streaming for IoT
Spark Streaming is an extension of Apache Spark for real-time processing of streaming data from sources such as Kafka, Flume, Twitter or TCP sockets, processed with Spark's core APIs. It is scalable, fault-tolerant and has second-scale latencies.
How it works
- Micro-batching: the stream is chopped into batches of a few seconds (the batch interval).
- DStream (Discretized Stream): the continuous stream represented as a sequence of RDDs, one per batch.
- RDD (Resilient Distributed Dataset): an immutable, partitioned collection processed in parallel. "Resilient" because lost partitions are recomputed from their lineage.
- Operations: transformations (
map,filter,reduceByKey) and window operations (e.g. average temperature over the last 60 s, sliding every 10 s). - Input sources: Kafka, Flume, HDFS, sockets, custom sources. Output operations: HDFS, databases, dashboards, external systems.
micro-batchDStreamRDDreceiverbatch intervallineagewindow operationsecond-scale latency4.8Apache Kafka
Kafka is "publish-subscribe messaging rethought as a distributed commit log". It is fast, scalable, durable and distributed.
Every topic is an append-only log. Producers append records; each record gets an offset. Consumers read at their own pace by tracking offsets, and records stay on disk for a retention period, so several consumers can read the same data independently and replay it.
Why is Kafka so fast?
- Fast writes: Kafka persists all data to disk, but writes essentially go to the OS page cache and are appended sequentially.
- Fast reads: data moves from page cache to the network socket very efficiently (zero-copy transfer).
- Combined: on a cluster where consumers are caught up, you see no read activity on the disks; everything is served from cache.
- Batching, compression and parallel partitions add to throughput.
zerg.hydra has 3 partitions (P0–P2), each replicated on 2 brokers. A bold box marks the leader replica. ZooKeeper stores cluster state.| Term | Meaning (read off Fig 4.9) |
|---|---|
| Broker | A Kafka server; the cluster here has broker1–3 |
| Topic | Named stream of records ("zerg.hydra") |
| Partition | Ordered slice of a topic; unit of parallelism (P0, P1, P2) |
| Replica / leader | Copies of a partition on different brokers; the leader handles reads and writes, followers copy it. P0 leader = broker1, P1 = broker2, P2 = broker3 |
| Producer / consumer | Writes to / reads from topics; consumers in a consumer group split partitions between them |
| ZooKeeper | Coordination service used by brokers, producers and consumers to manage and share state |
distributed commit logpublish-subscribebrokertopicpartitionoffsetreplicaleaderpage cachezero-copyZooKeeper4.9RabbitMQ
RabbitMQ is a lightweight, open-source message broker that lets parts of a system communicate by passing messages through queues. It implements AMQP (Advanced Message Queuing Protocol) and is used for asynchronous, decoupled and reliable messaging in distributed applications.
- Acts as message-oriented middleware implementing AMQP; supports multiple protocols (AMQP, MQTT, STOMP).
- Queues deliver in FIFO (first in, first out) order.
- Enables distributed systems built on asynchronous messaging.
| Exchange | Routing rule | Example from Fig 4.10 |
|---|---|---|
| Direct | Routing key must exactly match the binding key | Key "PDF process" → Queue 1 |
| Topic | Pattern match on dot-separated words: * = exactly one word, # = zero or more words | eu.de.* matches eu.de.berlin; us.# matches us, us.ny, us.ny.temp |
| Fanout | Broadcast to every bound queue, key ignored | One message → Q4, Q5 and Q6 |
Core concepts
- Producer: sends messages (to an exchange, which places them in queues).
- Queue: stores messages until processed.
- Consumer: retrieves and processes messages, then acknowledges them so they are removed.
- Exchange: routes messages to queues based on rules.
- Binding: connects an exchange to a queue with routing logic.
message brokerAMQPexchangebindingrouting keydirect / topic / fanoutFIFOacknowledgement4.10Kafka vs RabbitMQ
| Kafka | RabbitMQ | |
|---|---|---|
| Model | Distributed commit log, pub-sub | Message broker with queues |
| After consumption | Messages retained for a period; can be replayed | Messages deleted once acknowledged |
| Consumer style | Pull; consumer tracks its offset | Push from broker to consumer |
| Routing | By topic and partition key | Rich routing through exchanges and bindings |
| Strength | Very high throughput event streaming, log aggregation, feeding Spark/Flink | Complex routing, task queues, per-message reliability |
| Protocol | Own binary protocol over TCP | AMQP (plus MQTT, STOMP) |
| IoT fit | Ingest millions of sensor events per second | Dispatch commands or jobs to devices and services |
Practice questions
Part A is multiple choice: tap an option to check it and read why. Part B is long-answer: try writing the answer first, then open the model answer.
Part A · Multiple choice
Part B · Long answer
B1Why is the cloud preferred over on-premises infrastructure for IoT analytics? Explain with five benefits.M3 · 5 marks
IoT data is massive, heterogeneous, real-time and geographically distributed, which makes on-premises processing expensive and rigid.
- Scalability and elasticity: resources scale with load, avoiding over-provisioning for peaks.
- Pay-as-you-go: pay only for compute and storage used; CapEx becomes OpEx.
- Variety of services: managed storage (S3), compute (EC2, Lambda), streaming (Kinesis), ML and visualisation.
- Security and compliance: built-in encryption, IAM and auditing for sensitive domains like healthcare and smart cities.
- Agility: rapid experimentation and faster time-to-market.
Example: the voice-driven Mars rover application chains AWS IoT, Lambda, Lex, Polly, DynamoDB, SNS and CloudWatch with no servers to buy.
B2Trace the Mars rover replica example and state the role of each AWS service.M3 · 6 marks
- The user asks for the temperature on Mars through an IoT device; AWS IoT receives it.
- Lambda passes the request to Amazon Lex.
- Lex recognises the intent (get temperature on Mars).
- Lex asks a follow-up: Celsius or Fahrenheit?
- A second Lambda queries DynamoDB for the reading; SNS/SES can send it as text/email.
- Lex replies "Mars is minus 125 degrees Celsius"; Polly converts it to speech. CloudWatch logs and monitors the whole flow.
It demonstrates voice recognition, speech synthesis, storage, device interaction, networking, security and messaging together.
B3Define elastic analytics and explain its five design principles.M3 · 5 marks
Elastic analytics is the ability of an analytics system to dynamically scale computing and storage up or down with demand, giving performance, cost-efficiency and adaptability.
- Separate compute from storage: data in S3/Blob grows independently; clusters come and go.
- Build for scale from the start: one user to a million without major changes.
- Bottleneck should be wetware, not hardware: human thinking limits progress, not machine memory.
- Manage to a spend budget: scale freely within budget, contract quickly.
- Experiment: spin up, terminate failures, iterate, scale.
B4What is distributed computing? When should you prefer a single server instead?M3 · 4 marks
Distributed (cluster) computing is a paradigm where interconnected computers (nodes) share resources and divide tasks to work as one unified system. Frameworks such as Hadoop and Spark handle orchestration so the cluster looks like one machine, whether it has a few nodes or thousands.
It carries a complexity cost: analytics must be designed to run across nodes. Prefer a single server when there is little need for scale, the data is small rather than big, and resource needs are minimal.
B5Discuss key security threats in IoT cloud environments and how public/private key cryptography helps.M3 · 6 marks
Threats: data breaches, DoS attacks, malware/ransomware, unauthorized access. Cloud security in IoT protects data, devices and communication using encryption, authentication, access control and secure APIs; security analytics enables proactive detection.
Asymmetric cryptography: a public key (shared) and private key (secret). Data encrypted with the public key can only be decrypted by the private key, so sharing the public key is safe. It underpins SSL/TLS and HTTPS, and works as a stronger form of username/password authentication (SSH key pairs for EC2, X.509 certificates for IoT devices). Private keys must be protected.
B6Differentiate public and private subnets. Where should an analytics cluster be placed and why?M3 · 4 marks
A subnet is a logical segment of a cloud network. A public subnet routes to an Internet Gateway; resources are reachable only if they have a public IP. A private subnet has no direct internet access; outbound traffic goes through a NAT gateway.
Analytics clusters and databases belong in private subnets because they hold sensitive data and never need inbound internet traffic. This adds complexity (NAT, bastion hosts) but sharply reduces attack surface. Combine with security groups (stateful, instance level) and NACLs (stateless, subnet level).
B7Explain AWS IAM: identities, permissions and how a request is evaluated.M3 · 5 marks
IAM provides secure access control to AWS resources: who can access what.
- Identities (who): users (people/apps, long-term credentials), groups (sets of users), roles (assumed temporarily, temporary credentials, e.g. Lambda execution role), credentials (passwords, access keys, MFA).
- Permissions (what): JSON policies made of statements with Effect, Action, Resource and optional Condition.
- Evaluation: default implicit deny → explicit Allow grants → explicit Deny overrides everything.
Best practice: named accounts, least privilege, no shared credentials.
B8What is AWS CloudFormation? Differentiate a template and a stack, and list the template sections.M3 · 6 marks
CloudFormation is an Infrastructure-as-Code service that models, provisions and manages AWS resources automatically. It simplifies management, replicates infrastructure quickly and tracks changes.
Template: static JSON/YAML blueprint, like an architectural plan. Stack: the live, dynamic set of resources created from the template, like the building.
Sections: Format Version, Description, Metadata, Parameters, Mappings, Conditions, Resources (mandatory), Outputs.
Stack features: creation (provision all), update (CloudFormation applies add/modify/delete), deletion (removes all resources), drift detection (detects manual changes).
B9List and explain the steps to set up a VPC for an AWS analytics environment. How many usable IPs does a /20 subnet give?M3 · 6 marks
- Create the VPC and assign a CIDR range (e.g. 172.31.0.0/16 = 65,536 addresses); choose tenancy. One VPC is required per region.
- Divide the range into subnets; VPCs are regional, subnets are per AZ.
- Create route tables (optional; a default exists).
- Create and attach an Internet Gateway.
- Add the IGW route (0.0.0.0/0) and associate subnets.
- Enable auto-assign public IP on public subnets.
- Enable DNS hostname resolution (needed for EFS, RDS).
/20 → 212 = 4,096 addresses; AWS reserves 5, so 4,091 usable.
B10Describe ThingWorx, its core components and key concepts.M3 · 5 marks
ThingWorx, by PTC, is a purpose-built industrial IoT platform for rapidly building and deploying connected applications.
Components: Core (central management), Connection Services (device-platform connectivity), Edge (lightweight device runtime).
Concepts: Thing Templates (blueprints), Things (device instances), Properties (attributes), Services (functions), Events (notifications), Thing Shapes and Data Shapes (reusable attribute sets/structures), Entities (building blocks).
Why: drag-and-drop development, OPC/MQTT/REST integration, real-time dashboards, IIoT scalability, built-in ML. Integration with AWS IoT runs device → MQTT broker/Device Shadow → Rule Engine → Kinesis → ThingWorx AWS IoT Adapter → Core.
B11Explain the architecture and working of Amazon Kinesis with its components.M4 · 6 marks
Kinesis is a fully managed service for real-time streaming data. Producers (EC2, clients, mobile, servers) write records into a stream made of shards; consumers (EC2 apps) read and deliver to S3, DynamoDB, Redshift, EMR or Firehose.
Components: Data Streams (capture/process), Data Firehose (deliver to S3/Redshift/Elasticsearch), Data Analytics (SQL/Flink on streams), Video Streams (video for ML).
Working: (1) ingestion of JSON/binary records; (2) sharding by partition key for parallelism and fault tolerance, scaling horizontally; (3) processing and buffering (filter, aggregate); (4) access via APIs or delivery to other services.
B12Compare batch processing, stream processing and message queues with use cases and challenges.M4 · 6 marks
Batch: collect data over time, process together periodically. Uses: payroll, ETL/warehousing, end-of-day reports. Challenges: no real-time feedback, data staleness.
Stream: process data continuously as it arrives. Uses: fraud detection, sensor/log monitoring, live dashboards, IoT. Challenges: state management, reliability, out-of-order data, failures.
Message queue: asynchronous; messages wait in a queue for consumers, decoupling sender and receiver. Uses: microservices, background jobs, event-driven systems, reliable delivery.
Summary: batch optimises throughput, stream optimises latency, queues optimise decoupling and delivery guarantees.
B13Explain the MapReduce algorithm with an example. Why is it easy to scale?M4 · 6 marks
MapReduce is a Java-based programming model in Hadoop for processing huge data in parallel on commodity clusters.
- Map: input from HDFS is passed line by line; mapper emits key/value tuples.
- Shuffle: tuples are sorted and grouped by key.
- Reduce: reducer combines each key's values into a smaller set and writes to HDFS.
Example (count statuses in "ok fail ok" / "ok ok fail"): map → (ok,1)(fail,1)(ok,1) and (ok,1)(ok,1)(fail,1); shuffle → ok:[1,1,1,1], fail:[1,1]; reduce → ok 4, fail 2.
Scaling: once written as mappers and reducers, running on thousands of machines is merely a configuration change.
B14How does Spark Streaming work? Explain DStreams and RDDs.M4 · 5 marks
Spark Streaming extends Spark for real-time processing from Kafka, Flume, HDFS, Kinesis, sockets. It is scalable, fault-tolerant, with second-scale latency.
Receivers chop the incoming stream into micro-batches of a few seconds. Each batch is an RDD (Resilient Distributed Dataset: immutable, partitioned, recomputable from lineage). The sequence of these RDDs is a DStream (Discretized Stream). Spark applies RDD operations to each batch and pushes results out in batches to HDFS, databases, dashboards or external systems.
B15Explain Kafka's architecture and why it is fast. How does it differ from RabbitMQ?M4 · 6 marks
Kafka is publish-subscribe messaging rethought as a distributed commit log: fast, scalable, durable, distributed. Producers write to topics split into partitions spread over brokers; each partition has a leader and follower replicas; consumers read by offset; ZooKeeper manages shared state.
Speed: writes go to the OS page cache and are appended sequentially; reads go from page cache straight to the network socket, so caught-up consumers cause no disk reads.
vs RabbitMQ: RabbitMQ is an AMQP message broker using exchanges (direct, topic, fanout), bindings and FIFO queues; messages are deleted after acknowledgement and pushed to consumers. Kafka retains messages for replay, consumers pull, and it is built for very high-throughput streams.