275  Cloud IoT Platforms and Message Queues

275.1 Learning Objectives

By the end of this chapter, you will be able to:

  • Compare Cloud Platforms: Evaluate AWS IoT, Azure IoT Hub, and alternatives for specific requirements
  • Select Message Brokers: Choose appropriate message queue technologies for IoT workloads
  • Design Message Architecture: Apply pub/sub patterns with appropriate QoS levels
  • Estimate Capacity: Calculate message broker requirements for IoT deployments

275.2 Prerequisites

Before diving into this chapter, you should be familiar with:

275.3 Major Cloud IoT Platforms

Platform Strengths Best For
AWS IoT Core Most features, largest ecosystem Enterprise, complex needs
Azure IoT Hub Best Microsoft integration Existing Microsoft shops
ClearBlade Best ML/AI integration (Google partner) Data analytics focus
IBM Watson IoT Industry-specific solutions Manufacturing, logistics

Note (2025): Google Cloud IoT Core was discontinued in August 2023. Google recommends ClearBlade as the migration path for IoT device management. Google Cloud services like Pub/Sub, BigQuery, and Vertex AI remain available for data processing and analytics.

275.4 AWS IoT Core vs Azure IoT Hub

WarningTradeoff: AWS IoT Core vs Azure IoT Hub

Option A (AWS IoT Core): Largest IoT ecosystem with 200+ integrated services. Pricing at $1.00 per million messages plus $0.08 per million connection-minutes. Best-in-class rule engine with SQL-like filtering. Free tier: 250,000 messages/month for 12 months.

Option B (Azure IoT Hub): Tightest integration with Microsoft ecosystem (Active Directory, Power BI, Dynamics 365). Tier-based pricing starting at $10/month (S1: 400,000 messages/day). Built-in device twin synchronization. Superior hybrid cloud support with Azure Stack.

Decision Factors:

  • Choose AWS when: Your team has AWS experience, you need maximum service breadth (200+ services), cost optimization at scale is critical, or you require advanced rule engine capabilities.

  • Choose Azure when: Your organization uses Microsoft 365, Active Directory, or Dynamics 365, you need hybrid on-premises deployment, or predictable tier-based pricing is preferred for budgeting.

  • Cost comparison at scale: 100,000 devices sending 10 messages/day = 30M messages/month. AWS: ~$462/month. Azure S2: ~$400/month. At this scale, Azure is 13% cheaper with predictable costs.

275.5 Managed Services vs Self-Hosted

WarningTradeoff: Managed IoT Services vs Self-Hosted Open Source

Option A (Managed Services): AWS IoT Core, Azure IoT Hub, or HiveMQ Cloud. Zero infrastructure management, automatic scaling, 99.9% SLA, pay-per-use pricing.

Option B (Self-Hosted): EMQX, Mosquitto, or VerneMQ on your own infrastructure. Full control, no per-message fees, data sovereignty guaranteed. Requires DevOps expertise and 24/7 operations.

Decision Factors:

  • Choose Managed Services when: Team lacks Kubernetes/infrastructure expertise, time-to-market is critical, device count is under 100,000, or you need global distribution without building multi-region infrastructure.

  • Choose Self-Hosted when: Message volume exceeds 100M/month where managed pricing becomes prohibitive, regulatory requirements mandate data residency on specific infrastructure, or custom protocol extensions are needed.

  • Break-even calculation: At 50M messages/month, AWS IoT Core costs ~$50. Self-hosted EMQX on 3x m5.large ($210/month) handles 500M messages/month. Self-hosted becomes cheaper above 200M messages/month, but add DevOps engineer time.

275.6 Message Queue Selection for IoT

275.6.1 Message Queue Categories

Category Examples Best For
MQTT Brokers Mosquitto, EMQX, HiveMQ Device-to-cloud, pub/sub
General Message Queues RabbitMQ, ActiveMQ Enterprise integration
Streaming Platforms Apache Kafka, Pulsar, Kinesis High-throughput analytics

275.6.2 Selection by Connection Scale

< 1,000 devices      -> Mosquitto (single-node), RabbitMQ
1,000 - 100,000      -> EMQX cluster, HiveMQ, Kafka
100,000 - 1,000,000  -> EMQX Enterprise, HiveMQ Enterprise
> 1,000,000          -> Multi-cluster architecture required

275.6.3 Selection by Throughput

Throughput Recommended Technology
< 1,000 msg/sec Mosquitto, RabbitMQ
1K - 100K msg/sec EMQX, Kafka (3-node)
100K - 1M msg/sec Kafka (5+ nodes), Pulsar
> 1M msg/sec Multi-region Kafka, Pulsar

275.6.4 Latency Profiles

# Typical end-to-end latencies (publish to subscribe)

latency_profiles = {
    "mosquitto_local": {
        "p50": "0.5 ms",
        "p99": "2 ms",
        "use_case": "Local gateway aggregation"
    },
    "emqx_cluster": {
        "p50": "3 ms",
        "p99": "15 ms",
        "use_case": "Regional IoT platform"
    },
    "kafka_cluster": {
        "p50": "5 ms",
        "p99": "50 ms",
        "use_case": "Analytics pipeline (batch-friendly)"
    },
    "cloud_mqtt_service": {
        "p50": "20 ms",
        "p99": "100 ms",
        "use_case": "Global consumer IoT"
    }
}

For real-time control (<10ms required): Use local MQTT broker at edge.

For monitoring (<1 second acceptable): Cloud MQTT services work well.

For analytics (seconds to minutes acceptable): Kafka/Pulsar provide better throughput.

275.7 Message Broker Selection Flowchart

%%{init: {'theme': 'base', 'themeVariables': {'primaryColor': '#2C3E50', 'primaryTextColor': '#fff', 'primaryBorderColor': '#16A085', 'lineColor': '#16A085', 'secondaryColor': '#E67E22', 'tertiaryColor': '#7F8C8D'}}}%%
flowchart TD
    START["What's your primary use case?"] --> MQTT["Device-to-Cloud Messaging<br/>(MQTT protocol required)"]
    START --> STREAM["Event Streaming /<br/>Analytics Pipeline"]
    START --> ENTERPRISE["Enterprise Integration<br/>(existing systems)"]

    MQTT --> M1["< 10K devices, simple setup"]
    MQTT --> M2["10K-100K devices, HA required"]
    MQTT --> M3["> 100K devices, enterprise support"]
    MQTT --> M4["Managed service preference"]

    M1 --> R1[("Mosquitto")]
    M2 --> R2[("EMQX Open Source")]
    M3 --> R3[("HiveMQ / EMQX Enterprise")]
    M4 --> R4[("AWS IoT Core / Azure IoT Hub")]

    STREAM --> S1["Need replay / event sourcing"]
    STREAM --> S2["Complex routing / transforms"]
    STREAM --> S3["Serverless / managed"]

    S1 --> RS1[("Kafka or Pulsar")]
    S2 --> RS2[("Kafka + Kafka Streams")]
    S3 --> RS3[("AWS Kinesis / Azure Event Hubs")]

    ENTERPRISE --> E1["AMQP / JMS compatibility"]
    ENTERPRISE --> E2["Complex routing patterns"]

    E1 --> RE1[("RabbitMQ / ActiveMQ")]
    E2 --> RE2[("RabbitMQ (exchanges)")]

    style START fill:#2C3E50,stroke:#16A085,color:#fff
    style MQTT fill:#E67E22,stroke:#16A085,color:#fff
    style STREAM fill:#E67E22,stroke:#16A085,color:#fff
    style ENTERPRISE fill:#E67E22,stroke:#16A085,color:#fff

Figure 275.1: Message broker selection flowchart for IoT use cases.

275.8 MQTT Broker Comparison

Broker Connections Throughput Clustering License
Mosquitto 100K 50K msg/s Bridge only EPL/EDL
EMQX 1M+ 1M+ msg/s Native Apache 2.0
HiveMQ 10M+ 1M+ msg/s Native Commercial
VerneMQ 1M+ 500K msg/s Native Apache 2.0

275.9 QoS Trade-offs

QoS Level Delivery Broker CPU Latency Use Case
QoS 0 At most once Low Lowest Telemetry, non-critical
QoS 1 At least once Medium Medium Commands, events
QoS 2 Exactly once High Highest Financial, safety-critical

Rule of thumb: 90% of IoT traffic should use QoS 0 or QoS 1. QoS 2 overhead is significant.

275.10 Capacity Planning Example

Scenario: Smart city with 500,000 parking sensors

Requirements:
  devices: 500,000
  message_rate: 2 msg/device/hour (state changes)
  message_size: 128 bytes (JSON payload)
  peak_multiplier: 5x (morning/evening rush)

Calculations:
  avg_throughput: 500,000 x 2 / 3600 = 278 msg/sec
  peak_throughput: 278 x 5 = 1,390 msg/sec
  bandwidth: 1,390 x 128 = 178 KB/sec = 1.4 Mbps

  # Session memory (persistent sessions)
  session_memory: 500,000 x 2 KB = 1 GB

Recommendation:
  technology: EMQX cluster (3 nodes)
  node_spec: 8 vCPU, 16 GB RAM, SSD
  estimated_cost: ~$500/month (cloud VMs)

Alternative:
  technology: AWS IoT Core
  pricing: $1.00 per million messages + $0.08 per million minutes
  estimated_cost: ~$1,728/month

275.12 Summary

This chapter covered cloud IoT platforms and message queues:

  1. Platform Selection: AWS for breadth, Azure for Microsoft integration
  2. Managed vs Self-Hosted: Break-even around 200M messages/month
  3. Message Broker Types: MQTT for devices, Kafka for analytics
  4. QoS Levels: 90% of traffic should use QoS 0 or 1
  5. Capacity Planning: Calculate connections, throughput, and memory requirements

275.13 Further Reading

  1. Mell, P., & Grance, T. (2011). “The NIST Definition of Cloud Computing.” NIST Special Publication 800-145.

  2. Botta, A., et al. (2016). “Integration of Cloud computing and Internet of Things: A survey.” Future Generation Computer Systems, 56, 684-700.

  3. Gubbi, J., et al. (2013). “Internet of Things (IoT): A vision, architectural elements, and future directions.” Future Generation Computer Systems, 29(7), 1645-1660.

275.14 What’s Next?

You’ve completed the cloud computing series. Continue with:

Continue to Edge-Fog-Cloud Overview ->