Cloud Data, Analytics and Artificial IntelligenceIntroductionCloud computing has changed data management from a predominantly infrastructure-centred activity into a service-oriented discipline. Organizations can now collect data from applications, sensors, transactions, devices and external sources; store it in several specialized forms; transform it at scale; and apply analytics or artificial intelligence (AI) without purchasing and operating all underlying hardware themselves. This flexibility also creates design responsibilities. A cloud data solution must match data structure, access patterns, latency requirements, governance obligations and cost constraints. A relational database is appropriate for many transactional workloads, but not for every analytical or unstructured-data problem. A data lake offers broad storage flexibility, but can become a poorly governed “data swamp.” Machine learning can produce valuable predictions, but its outputs may be unreliable if training data are incomplete, biased or stale. Generative AI can improve productivity while introducing risks involving confidentiality, hallucination, copyright and accountability. This chapter develops a practical and analytical foundation for selecting cloud data services, designing basic data pipelines, and evaluating managed analytics, machine learning and generative AI services. Learning ObjectivesAfter studying this chapter, you should be able to: - Compare relational, NoSQL, data warehouse, data lake and streaming services.
- Select storage and processing patterns for common cloud workloads.
- Design a basic batch and streaming data pipeline.
- Explain data quality dimensions and their influence on analytical results.
- Evaluate managed analytics, machine learning and generative AI services.
- Identify model risk, security, privacy, compliance and responsible-AI concerns.
- Apply these concepts to a realistic cloud data architecture.
1. The Cloud Data LandscapeA cloud data architecture normally separates several logical stages: - Data sources: business applications, mobile devices, websites, sensors, logs, partner feeds and public datasets.
- Ingestion: movement of data into cloud services, either continuously or in batches.
- Storage: persistence in databases, warehouses, object stores or specialized systems.
- Processing: cleaning, joining, aggregating, transforming and enriching data.
- Analytics: reporting, dashboards, descriptive statistics, diagnostic analysis and forecasting.
- Machine learning and AI: prediction, classification, recommendation, language processing, computer vision and generation.
- Governance: identity, access control, cataloguing, lineage, quality, retention, privacy and audit.
The architecture should be designed around business and technical requirements rather than around product names. Important requirements include: - Volume: how much data must be stored or processed?
- Velocity: how rapidly does data arrive and how quickly must it be available?
- Variety: are the data tabular, semi-structured, text, images, audio or video?
- Veracity: how reliable, complete and consistent are the data?
- Latency: is a response required in milliseconds, seconds, minutes or hours?
- Durability and availability: what loss or outage can the organization tolerate?
- Security and regulation: what confidentiality, residency, retention or audit obligations apply?
These characteristics are often summarized as the “five Vs” of data: volume, velocity, variety, veracity and value. The model is a useful starting point, but it does not replace detailed requirements analysis. 2. Comparing Cloud Data Services2.1 Relational databasesA relational database organizes data into tables containing rows and columns. A schema defines attributes and data types, while primary and foreign keys represent identity and relationships. SQL supports querying, joining, filtering and aggregation. Relational systems are strong where transactions must be accurate and consistent. For example, an online order may require inventory reduction, payment recording and order creation to succeed as one logical unit. This is supported by transaction properties commonly summarized as ACID: - Atomicity: a transaction is completed entirely or not at all.
- Consistency: constraints remain satisfied before and after the transaction.
- Isolation: concurrent transactions do not produce unacceptable interference.
- Durability: committed data survive failures according to the service’s guarantees.
Relational databases are suitable for banking records, customer accounts, order processing and systems with complex relationships. Their limitations may appear when schemas change rapidly, data are very large and varied, or horizontal distribution is required at extreme scale. 2.2 NoSQL databasesNoSQL is a broad category rather than one single technology. Major forms include: | Type | Data model | Typical applications | Main design concern |
|---|
| Key-value | Key mapped to a value | Sessions, carts, caching | Access by known key | | Document | JSON-like documents | Profiles, content, catalogs | Document structure and indexing | | Wide-column | Rows with flexible columns | Large-scale telemetry | Partition-key design | | Graph | Nodes and relationships | Fraud, social networks, recommendation | Traversal performance |
NoSQL systems often prioritize scalable availability and workload-specific access patterns. They may allow flexible schemas and distribute data across many nodes. However, the developer may need to design denormalized records, manage eventual consistency, or accept restrictions on joins and transactions. Consistency is not simply “good” or “bad.” A shopping-cart display may tolerate a brief delay, whereas a payment ledger generally requires stronger consistency. The correct choice depends on business consequences and the guarantees offered by the service. 2.3 Data warehousesA cloud data warehouse is an analytical platform optimized for structured or regularly shaped data, large scans, aggregation and SQL-based reporting. Warehouses commonly use column-oriented storage, compression, parallel processing and separation of compute from storage. A warehouse often contains curated data organized through dimensional modelling. A fact table records measurable events, such as sales, while dimension tables describe entities such as products, customers and dates. A star schema places a fact table at the centre and dimensions around it. Warehouses are valuable for trusted metrics, business intelligence and historical analysis. A warehouse is not merely a large database. Its workload, physical organization and governance are optimized for analytical queries rather than high-frequency operational transactions. Loading data into a warehouse usually requires transformation, validation and management of slowly changing dimensions or other historical requirements. 2.4 Data lakesA data lake stores large quantities of raw or lightly processed data, frequently in object storage. It can contain structured tables, semi-structured files, text, images, audio and other formats. A lake supports exploratory analysis, machine learning and long-term retention at relatively low storage cost. The central risk is loss of meaning. If data lack owners, metadata, quality rules and access controls, users may not know which file is authoritative or whether it contains personal information. A well-managed lake therefore requires: - a catalogue and business glossary;
- schema and format standards;
- data ownership and stewardship;
- partitioning and lifecycle policies;
- lineage and quality checks;
- role-based or attribute-based access control; and
- documented retention and deletion rules.
A lakehouse combines lake-style flexible storage with warehouse-style management, transactions, governance and analytical performance. It is an architectural pattern, not a universal replacement for every database or warehouse. 2.5 Streaming servicesStreaming platforms handle continuously arriving events. An event may represent a click, payment, temperature reading, machine alarm or application log. Important concepts include producers, consumers, topics or streams, partitions, offsets, event time and processing time. Streaming systems support near-real-time dashboards, fraud detection, personalization and operational monitoring. They introduce challenges that do not appear in the same way in batch systems: - duplicate events and retries;
- out-of-order arrival;
- late data;
- changing schemas;
- replay and recovery;
- state management; and
- exactly-once or at-least-once delivery semantics.
An organization should not select streaming merely because data arrive frequently. If a report can be produced hourly without business harm, a scheduled batch process may be simpler and cheaper. 2.6 Comparative selection| Requirement | Commonly suitable service | Reason |
|---|
| Strong transactional integrity | Relational database | Structured schema and ACID transactions | | Flexible document access | Document or key-value NoSQL | Schema flexibility and direct retrieval | | Enterprise reporting | Data warehouse | Curated SQL analytics and aggregation | | Raw multi-format retention | Data lake | Flexible, scalable object storage | | Immediate event processing | Streaming platform | Continuous ingestion and low latency | | Data science experimentation | Lake or lakehouse | Large and varied datasets with analytical access |
These categories can coexist. An e-commerce company may use a relational order system, a streaming service for click events, a lake for raw logs, a warehouse for financial reporting and a feature store or analytical database for machine-learning applications. 3. Basic Cloud Data Pipeline DesignA data pipeline is a repeatable sequence that moves data from sources to useful destinations. A robust design separates ingestion, storage, transformation, serving and governance. 3.1 Batch pipelineA typical batch pipeline is: Source systems → extraction → landing zone → validation → transformation → curated storage → warehouse or analytical application The landing zone preserves received data as evidence of what arrived. Validation then checks file format, required fields, data types, duplicate records and basic business constraints. Transformation may standardize dates, remove invalid records, join reference data and calculate derived measures. Curated outputs are then made available to dashboards, analysts or machine-learning workflows. A pipeline should be idempotent where practical. An operation is idempotent if repeating it produces the same final result as executing it once. For example, loading a partition identified by a source date and replacing that partition can be safer than blindly appending it repeatedly. Idempotence reduces damage caused by retries. 3.2 Streaming pipelineA streaming design may follow this pattern: Event producers → message broker → stream processing → operational store, alerting system, lake and warehouse The processor may filter events, enrich them with reference data, aggregate them over time windows and route invalid events to a dead-letter stream. The design must specify whether event time or processing time controls windows. Event time is usually preferable for business analysis, but it requires policies for late-arriving data. For a time window containing values x1, x2, …, xn, the arithmetic mean is: x̄ = (1/n) ∑ᵢ₌₁ⁿ xᵢ Here, n is the number of observations and x̄ is the mean. The formula assumes numerical observations for which an arithmetic average is meaningful. In streaming systems, the result depends on the defined window, event-time policy and treatment of missing or duplicate events. 3.3 Pipeline reliabilityProduction pipelines require more than data movement. Important controls include: - Schema contracts: agreed field names, types, meanings and compatibility rules.
- Observability: logs, metrics, traces and alerts.
- Checkpoints: recorded progress that supports recovery.
- Dead-letter handling: isolation of records that cannot be processed.
- Back-pressure: slowing producers or scaling consumers when processing falls behind.
- Replay: ability to reprocess historical events safely.
- Data lineage: record of source, transformations and destinations.
- Security: encryption, secret management, network controls and least privilege.
Useful pipeline metrics include throughput, latency, failure rate, freshness and completeness. If [[MATHt_s]] is source-event time and [[MATHt_a]] is arrival or processing time, event latency can be represented as: L = tₐ − tₛ Both times must use the same clock basis and units. In practice, clock synchronization and clearly defined timestamps are essential. A mean latency alone may conceal severe delays in the tail, so percentiles such as the 95th or 99th percentile are often more informative. 4. Data Quality and GovernanceData quality is fitness for a stated use, not an abstract property of a dataset. Common dimensions include: - Accuracy: values represent the real-world entity or event.
- Completeness: required values and records are present.
- Consistency: related systems do not contradict one another without explanation.
- Timeliness: data are available when needed and are sufficiently current.
- Validity: values conform to permitted formats and domains.
- Uniqueness: an entity or event is not incorrectly duplicated.
- Integrity: relationships and constraints remain meaningful.
A simple completeness rate for a required field is: C = (Npresent / Nexpected) × 100% Npresent is the number of records containing an acceptable value and Nexpected is the number of records that should contain one. The measure assumes that the expected population is correctly defined; otherwise a high rate can be misleading. Governance assigns accountability. A data owner makes decisions about business meaning and acceptable use. A data steward manages definitions, quality rules and issue resolution. A platform team operates storage and processing services. Security and privacy specialists address access, classification and regulatory requirements. Good governance should be risk-based. Public weather data and medical records should not receive identical controls. Nevertheless, convenience must not override legal or ethical duties. Personal data should be minimized, protected and retained only as long as justified. De-identification reduces risk but does not guarantee anonymity, especially when datasets can be linked. 5. Managed Analytics and Machine Learning ServicesManaged analytics services provide capabilities such as SQL querying, data integration, dashboards, distributed processing, notebooks and workflow orchestration. Their main advantages are reduced infrastructure administration, elastic capacity and integration with identity and monitoring services. Their disadvantages include vendor dependence, service limits, cost complexity and the risk that abstraction hides important operational behaviour. 5.1 Machine-learning workflowA conventional machine-learning workflow includes: - Define the decision and target variable.
- Collect and govern relevant data.
- Explore and prepare features.
- Split data into training, validation and test sets.
- Train candidate models.
- Evaluate against suitable metrics and business costs.
- Deploy with controlled access.
- Monitor performance, drift and fairness.
- Retrain or retire when conditions change.
A model should be evaluated against a baseline, not only against another complex model. For binary classification, a confusion matrix records true positives, false positives, true negatives and false negatives. Precision and recall are: Precision = TP / (TP + FP) Recall = TP / (TP + FN) Here, TP, FP and FN denote true positives, false positives and false negatives. Precision answers “Of predicted positives, how many were correct?” Recall answers “Of actual positives, how many were found?” The metrics assume a defined classification threshold and labelled evaluation data. Neither metric alone is sufficient for every decision. For imbalanced problems, accuracy can be deceptive. For example, a model that labels every transaction as legitimate may achieve high accuracy when fraud is rare while detecting no fraud. Evaluation should reflect the cost of errors, operational capacity and affected groups. 5.2 Managed versus self-managed machine learningManaged machine-learning platforms commonly provide training jobs, experiment tracking, model registries, deployment endpoints, monitoring and access controls. They can accelerate development, but they do not remove the need for data science judgement. The organization remains responsible for target definition, data provenance, evaluation design, security and decisions made from predictions. A model registry should record model version, training data or data reference, features, hyperparameters, evaluation results, approval status and deployment history. Reproducibility requires versioning code, configuration and relevant data transformations. 6. Generative AI in the CloudGenerative AI systems create text, code, images, audio or other content from prompts and sometimes additional context. Cloud platforms may offer managed foundation models through APIs, model hosting, retrieval-augmented generation (RAG), prompt-management tools and safety controls. In a RAG system, a user query is converted into a representation, relevant documents are retrieved from an approved knowledge base, and the retrieved context is supplied to a generative model. RAG can improve grounding and permit updates without retraining the foundation model. It does not guarantee truth: retrieval may select the wrong document, documents may be outdated, or the model may misinterpret context. A production generative-AI application should consider: - input and output filtering;
- protection of confidential prompts and retrieved documents;
- citation and evidence requirements;
- prompt injection and data-exfiltration attacks;
- hallucination and overconfident answers;
- model and provider changes;
- copyright and licensing;
- accessibility and language coverage;
- human review for consequential decisions; and
- cost and latency controls.
The appropriate evaluation depends on the use case. Useful measures may include factual groundedness, task success, refusal quality, toxicity, privacy leakage, latency and cost per interaction. Human evaluation remains important for open-ended outputs, but it should use clear criteria and documented sampling procedures. 7. Model Risk and Responsible AIModel risk is the possibility that a model is wrong, misused, poorly implemented or applied outside the conditions for which it was validated. Sources include biased samples, label errors, leakage, unstable relationships, incorrect assumptions, coding defects and distribution shift. A model may perform well in testing but poorly after deployment because the world changes. Data drift concerns changes in input distributions. Concept drift concerns changes in the relationship between inputs and outcomes. Monitoring should therefore examine both technical signals and business outcomes. Responsible AI involves several principles: - Fairness: avoid unjustified differences in treatment or performance.
- Transparency: communicate purpose, limitations and relevant factors.
- Accountability: assign human and organizational responsibility.
- Privacy: minimize collection and protect sensitive information.
- Safety and robustness: resist foreseeable failures and attacks.
- Human agency: preserve appropriate review, appeal and override.
- Inclusiveness: consider diverse users and accessibility needs.
Fairness cannot be reduced to one universal formula. Different statistical criteria can conflict, especially when base rates differ between groups. Organizations must define the decision context, identify harms, consult affected stakeholders and document why a chosen criterion is appropriate. A risk assessment should classify use cases by impact. A recommendation for music may tolerate occasional errors; automated denial of employment, credit, housing or essential services requires far stronger controls, explanation, testing and human oversight. Legal obligations vary by jurisdiction, so technical teams must involve legal, compliance and domain experts rather than assuming that a general-purpose AI policy is sufficient. 8. Illustrative Case: Regional Retail Analytics PlatformBackgroundA regional retailer operates stores and an online channel. It has a transactional relational database, point-of-sale devices, website logs and inventory sensors. Managers currently receive a daily spreadsheet, while fraud analysts need faster alerts and executives require consistent sales measures. ProblemThe retailer wants to reduce stockouts, identify suspicious transactions and improve demand planning. It must protect customer information, preserve financial accuracy and control cloud expenditure. AnalysisThe order and payment system requires relational transactions. Website clicks and sensor readings are event streams. Historical logs, product images and semi-structured supplier files are suitable for a data lake. Certified sales and inventory measures should be served from a warehouse. A single database would create competing workloads and would not provide an effective governance boundary. Approach and solution- Transactional records are replicated to a protected landing area without disrupting point-of-sale operations.
- Clicks and sensor events enter a streaming service with schema validation and a dead-letter path.
- Raw data are retained in partitioned lake storage with catalogue entries and retention policies.
- Batch and streaming transformations standardize product identifiers, time zones and store codes.
- Curated sales, inventory and returns tables are loaded into a warehouse.
- A dashboard uses certified warehouse metrics for management reporting.
- A streaming rule flags unusual transaction patterns for analyst review rather than automatically blocking customers.
- A forecasting model is trained using historical demand, promotions, holidays and stock availability; its predictions are monitored against later outcomes.
- A retrieval-based assistant answers staff questions from approved policy and product documents, with citations and human escalation.
OutcomeThe architecture separates operational, analytical and experimental workloads. It supports near-real-time alerts while preserving a governed source for financial reporting. The retailer does not treat model predictions as unquestionable decisions: fraud alerts are reviewed, forecasts display uncertainty and the assistant is prevented from accessing payment-card data. Learning pointsThe case demonstrates that cloud architecture is a portfolio of complementary services. Data quality rules must be attached to business meaning, not added as an afterthought. Low latency is valuable only where it changes a decision. Finally, managed AI services reduce infrastructure effort but do not transfer accountability for outcomes. 9. Best Practices and Contemporary DirectionsEffective cloud data and AI programs commonly follow these practices: - Start with decisions, users and service-level requirements.
- Choose storage according to access patterns rather than fashion.
- Separate raw, curated and serving layers.
- Establish ownership, catalogues, lineage and quality thresholds early.
- Use least privilege, encryption, private connectivity and secrets management.
- Design for retries, idempotence, replay and failure isolation.
- Version schemas, transformations, models and prompts.
- Measure cost by workload and set budgets or alerts.
- Test AI systems with representative, adversarial and out-of-distribution cases.
- Monitor technical performance, business impact and affected-group outcomes.
- Retain human review for high-impact decisions.
- Plan exit strategies for proprietary formats, APIs and model providers.
Current developments include serverless analytical engines, lakehouse architectures, vector search, multimodal foundation models, synthetic data, confidential computing and increasingly automated data operations. These developments can improve capability, but each introduces new questions about evaluation, interoperability, energy use, privacy and accountability. Technical novelty should therefore be assessed against measurable organizational value and risk. Chapter SummaryCloud data architecture uses complementary services rather than one universal data store. Relational databases provide structured transactions and strong integrity; NoSQL systems support workload-specific scalability and flexible models; warehouses support governed analytical querying; lakes store varied raw data; and streaming services process continuously arriving events. A practical pipeline separates ingestion, landing, validation, transformation, serving and governance while addressing retries, latency, schema evolution and lineage. Data quality includes accuracy, completeness, consistency, timeliness, validity, uniqueness and integrity. Managed analytics and machine-learning services reduce infrastructure work but do not remove responsibility for sound targets, representative data, appropriate metrics, monitoring and security. Generative AI can be integrated through managed models and retrieval, but requires controls for hallucination, prompt injection, privacy, copyright and human oversight. Model risk and responsible AI require risk-based governance, fairness analysis, transparency, accountability and continuing monitoring after deployment. Key TermsRelational database: A table-based database using schemas, keys and SQL. NoSQL: A family of non-relational databases optimized for particular access patterns. Data warehouse: A curated analytical store designed for reporting and large-scale queries. Data lake: Flexible storage for raw or lightly processed data in many formats. Lakehouse: An architecture combining lake storage flexibility with warehouse-style management. Streaming: Continuous processing of data events as they arrive. Batch processing: Processing data in scheduled or accumulated groups. Schema: The defined structure, types and relationships of data. Data lineage: Information about data origin, transformations and destinations. Data quality: Fitness of data for a specified purpose. Idempotence: The property that repeating an operation produces the same final effect. Event time: The time at which an event actually occurred. Data drift: Change in the distribution of model inputs over time. Concept drift: Change in the relationship between inputs and outcomes. Model risk: Risk arising from incorrect, misused or poorly implemented models. RAG: Retrieval-augmented generation using retrieved information as model context. Foundation model: A broadly trained model adaptable to many downstream tasks. Responsible AI: The governance and design of AI for fairness, safety, transparency and accountability. Data steward: A person responsible for data meaning, quality and governance practices. Feature: An input variable used by a machine-learning model. Review QuestionsShort Answer Questions- What is the principal difference between a data warehouse and a data lake?
- Name four common dimensions of data quality.
- Why is idempotence useful in a data pipeline?
- What is the difference between data drift and concept drift?
- State two risks associated with generative-AI applications.
Long Answer Questions- Compare relational, NoSQL, warehouse, lake and streaming services, including a suitable use case and limitation for each.
- Explain the stages of a governed batch data pipeline from source extraction to analytical serving.
- Discuss why accuracy alone is insufficient for evaluating a classification model.
- Explain how RAG works and analyse its benefits and limitations.
- Discuss the responsibilities that remain with an organization when it uses a managed machine-learning service.
Analytical / Application Questions- A hospital needs transactional patient records, real-time device alerts and long-term research analysis. Design a multi-service cloud data architecture and justify each service choice.
- A fraud model has high accuracy but detects very few fraudulent cases. Which evaluation metrics and operational information should be investigated, and why?
- Design governance controls for a generative-AI assistant that answers employee questions using confidential organizational documents. Address access, retrieval, evaluation, monitoring and human escalation.
Multiple Choice Questions with AnswersQuestion 1Which service is most appropriate for maintaining strongly consistent order and payment transactions? A. Relational database B. Object storage data lake C. Streaming topic D. Data warehouse Correct Answer: A. Relational database Question 2What is the main purpose of a data warehouse? A. To store only unprocessed images B. To support curated analytical queries and reporting C. To replace every operational database D. To provide message delivery between devices Correct Answer: B. To support curated analytical queries and reporting Question 3Which property means that repeating a pipeline operation produces the same final effect as executing it once? A. Durability B. Partitioning C. Idempotence D. Elasticity Correct Answer: C. Idempotence Question 4A pipeline receives events continuously and must issue alerts within seconds. Which design is most suitable? A. Annual archival processing B. Streaming ingestion and processing C. Manual spreadsheet consolidation D. A relational backup without consumers Correct Answer: B. Streaming ingestion and processing Question 5If a classifier has TP = 80 and FP = 20, what is its precision? A. 20% B. 40% C. 80% D. 90% Correct Answer: D. 90% Question 6Which metric answers: “Of the actual positive cases, how many did the model identify?” A. Recall B. Precision C. Latency D. Completeness Correct Answer: A. Recall Question 7What is a key benefit of retrieval-augmented generation? A. It guarantees that every generated answer is true B. It supplies retrieved context from an approved knowledge source C. It eliminates the need for access control D. It prevents all prompt-injection attacks Correct Answer: B. It supplies retrieved context from an approved knowledge source Question 8Which situation is an example of concept drift? A. The input file changes from CSV to JSON B. The distribution of customer ages changes slightly C. The relationship between observed features and the target outcome changes D. A dashboard changes its colour scheme Correct Answer: C. The relationship between observed features and the target outcome changes Question 9Which control is most appropriate for a high-impact automated decision? A. Remove all audit records B. Use human review, documented criteria and an appeal process C. Allow any employee to change the model D. Evaluate the model only once before deployment Correct Answer: B. Use human review, documented criteria and an appeal process Question 10A required field appears in 950 of 1,000 expected records. What is the completeness rate? A. 5% B. 50% C. 95% D. 99.5% Correct Answer: C. 95%
|