Cert Notes/ Commute Study Notes
Roadmap
KOEN
CLF-C02 · FoundationalCloud Practitioner - Foundational
DVA-C02 · AssociateDeveloper - Associate
SAA-C03 · AssociateSolutions Architect - Associate
SOA-C02 · AssociateCloudOps Engineer - Associate
SAP-C02 · ProfessionalSolutions Architect - Professional
DOP-C02 · ProfessionalDevOps Engineer - Professional
SCS-C03 · SpecialtySecurity - Specialty
MLA-C01 · AssociateMachine Learning Engineer - Associate
AIF-C01 · FoundationalAI Practitioner - Foundational
DEA-C01 · AssociateData Engineer - Associate
MLS-C01 · SpecialtyMachine Learning - Specialty
  • Week 1
    • 1.The ML Lifecycle (from a Specialty Perspective)
    • 2.Data Storage for ML: S3, EFS, FSx for Lustre, and Data Formats
    • 3.Data Ingestion: Kinesis, Glue, Batch vs. Streaming
    • 4.Data Labeling: SageMaker Ground Truth, Active Learning, Label Quality
    • 5.Week 1 Comprehensive Review: ML Overview & Data Engineering 1
  • Week 2
    • 1.Data Transformation and ETL: AWS Glue, Spark, and EMR
    • 2.Automating ML Training Pipelines: Step Functions and SageMaker Pipelines
    • 3.Data Augmentation and Synthesis: Addressing Insufficient and Imbalanced Data
    • 4.Data Storage and Access Optimization: Pipe vs File Mode, FSx for Lustre, Distributed Training
    • 5.Week 2 Comprehensive Review: From Transformation to Distributed Training Data Supply
  • Week 3
    • 1.Data Cleaning: Missing Values, Outlier Detection, Duplicates and Errors
    • 2.Feature Engineering: Scaling, Encoding, and Binning
    • 3.Time Series, Text Features, and High-Cardinality Categorical Handling
    • 4.SageMaker Tools: Data Wrangler, Processing Job, Feature Store
    • 5.Week 3 Comprehensive Review: Cleaning and Feature Engineering
  • Week 4
    • 1.Dimensionality Reduction: PCA, t-SNE, and the Curse of Dimensionality
    • 2.Feature Selection: Filter, Wrapper, Embedded, Importance, Multicollinearity
    • 3.Data Visualization: Distribution, Correlation, QuickSight, Insights
    • 4.Handling Class Imbalance: Over/Undersampling, SMOTE, Class Weights, Evaluation
    • 5.Week 4 Comprehensive Review: Dimensionality, Feature Selection, Visualization, Imbalance
  • Week 5
    • 1.Statistical Foundations: Distribution, Central Tendency, Dispersion, Transformations, Sample and Population
    • 2.Correlation and Relationships: Correlation Coefficients, Causation vs. Correlation, Multivariate Relationships
    • 3.Data Leakage: Causes, Detection, Prevention; Time Series Leakage; Target Leakage
    • 4.Validation Design: train/validation/test Split, Cross-Validation, Time Series Split, Stratified Sampling
    • 5.Week 5 Comprehensive Review: Statistics and Validation Design
  • Week 6
    • 1.Algorithm Selection: Problem Type to Mapping
    • 2.SageMaker Builtin 1: XGBoost, Linear Learner, K-Means, KNN
    • 3.SageMaker Builtin 2: Text, Image, Time Series, Recommendation
    • 4.Unsupervised/Anomaly Detection: RCF, PCA, IP Insights, Topic Models (LDA/NTM)
    • 5.Week 6 Comprehensive Review: Algorithm Selection and SageMaker Builtins
  • Week 7
    • 1.Neural Network Foundations: Perceptron to Backpropagation
    • 2.CNN: Convolutional Neural Networks and Computer Vision
    • 3.RNNs and Sequences: From LSTM to Transformer
    • 4.Learning Techniques and Transfer Learning
    • 5.Week 7 Synthesis: Deep Learning Summary
  • Week 8
    • 1.SageMaker Training Jobs: Estimator, Input Modes, Distributed Learning, Spot
    • 2.Hyperparameter Tuning (AMT): Bayesian, Random, Hyperband
    • 3.Overfitting/Underfitting: Diagnosis and Regularization/Data Augmentation
    • 4.Learning Optimization: Batch Size, Learning Rate, Gradient Issues, Debugger/Profiler
    • 5.Week 8 Review: Training, Tuning, Generalization
  • Week 9
    • 1.Classification Evaluation Metrics: Accuracy, Precision, Recall, F1 and Confusion Matrix
    • 2.ROC/AUC and Threshold Adjustment: Reading Model Performance with Curves
    • 3.Regression Evaluation Metrics: RMSE, MAE, MAPE, R² and Residual Analysis
    • 4.Model Debugging and Bias: SageMaker Debugger and Clarify
    • 5.Week 9 Review: Evaluation and Debugging
  • Week 10
    • 1.Inference Options: Real-time vs Serverless vs Asynchronous vs Batch Transform
    • 2.Real-time Endpoint Operations: Configuration, Auto Scaling, Multi-Model
    • 3.Inference Optimization: Neo, Elastic Inference, Inferentia, Inference Pipelines
    • 4.Deployment Strategies: A/B Testing, Blue/Green, Canary, Shadow, Rollback
    • 5.Week 10 Review: ML Implementation & Operations 1 — Deployment & Inference
  • Week 11
    • 1.Model Monitoring: SageMaker Model Monitor and Drift Response
    • 2.MLOps: SageMaker Pipelines, Model Registry, CI/CD
    • 3.ML Security: IAM Execution Roles, VPC Isolation, KMS Encryption
    • 4.Operations & Cost: Cost Optimization, Logging/Audit, Disaster Recovery
    • 5.Week 11 Review: Monitoring, MLOps, Security, Operations
  • Week 12
    • 1.Domains 1 & 2 Integration: Data Engineering + EDA
    • 2.Domain 3 Integration: Modeling (Algorithm to Evaluation)
    • 3.Domain 4 Integration: ML Implementation & Operations
    • 4.Synthesis: 4 Domains + End-to-End Scenarios
    • 5.D-Day Wrap-Up: Exam Structure, Time Allocation, Requirement Translation Tables, Trap Roundup
← MLS-C01/Week 1/Day 3
MLS-C01· AssociateWeek 1 · Day 3~15 min read

Day 3 - Data Ingestion: Kinesis, Glue, Batch vs. Streaming

Training data has to flow in from somewhere. Click logs, IoT sensors, and transaction events pour in as real-time streams, while data from operational databases and external systems arrives in periodic batches. The Specialty exam asks scenario questions like "Which Kinesis service for this ingestion requirement? How do you use Glue?"

Today we cover (1) distinguishing the four Kinesis services (Data Streams, Firehose, Managed Service for Flink, Video), (2) Glue's ETL, catalog, and crawlers, and (3) the difference between batch training data and streaming training data.

Distinguishing the Four Kinesis Services: A Specialty Staple

"Kinesis" is not one service but four. The names are easy to mix up, so you must distinguish them precisely.

ServiceRoleKey characteristics
Data Streams (KDS)Real-time stream ingestion & storageShard-based, requires your own consumer code, data retention (up to 365 days)
Data FirehoseStream→destination delivery (ETL loading)Fully managed, auto-delivers to S3/Redshift/OpenSearch, buffering & transformation
Managed Service for FlinkReal-time stream analyticsWindowed aggregation & anomaly detection with SQL/Flink
Video StreamsVideo stream ingestionVideo input for ML (facial recognition, etc.)

The decision tree for the most commonly confused pair, KDS vs. Firehose:

  • Only need automatic delivery to a destination? → Firehose (delivers to S3 etc. with no code)
  • Multiple consumers processing the same stream differently? Custom processing? Data replay? → Data Streams
import boto3, json
kinesis = boto3.client("kinesis")
 
# Put an event into Data Streams — PartitionKey distributes across shards
kinesis.put_record(
    StreamName="clickstream",
    Data=json.dumps({"user_id": "u123", "event": "click", "ts": 1719300000}),
    PartitionKey="u123",     # same key → same shard → unit of ordering guarantee
)
# Firehose: automatic delivery to S3 with no code + buffering configuration (delivery stream example)
firehose = boto3.client("firehose")
firehose.put_record(
    DeliveryStreamName="to-datalake",
    Record={"Data": json.dumps({"user_id": "u123", "amount": 42.0}) + "\n"},
)
# Once the buffer fills (e.g., 5MB or 60 seconds), Firehose converts to Parquet, compresses, and lands it in S3

💡 Related theory: KDS scales throughput in units of shards. One shard handles 1MB/s or 1,000 records/s of writes and 2MB/s of reads, so as traffic grows you must add shards (or use on-demand mode). KDS also retains data, so multiple consumers can read the same data independently and reprocess it (replay). Firehose, by contrast, has no retention or replay — it is a "fire and forget" pipe responsible only for delivering to a destination. The key branch: "multiple consumers/reprocessing = KDS, simple delivery = Firehose."

Glue: Serverless ETL and the Data Catalog

AWS Glue is a serverless service that bundles three things.

  1. Glue Data Catalog: A central repository of data metadata (schema, location, partitions). Shared by Athena, Redshift Spectrum, and EMR.
  2. Glue Crawler: Scans S3 and other stores, automatically infers schemas, and registers them as tables in the catalog.
  3. Glue ETL Jobs: Serverless transformation jobs based on Spark (or Python shell).
# Glue ETL job (PySpark) — read a catalog table, clean it, and save as Parquet
import sys
from awsglue.context import GlueContext
from awsglue.transforms import DropNullFields
from pyspark.context import SparkContext
 
glueContext = GlueContext(SparkContext.getOrCreate())
 
# Load the table the crawler registered in the catalog as a DynamicFrame
dyf = glueContext.create_dynamic_frame.from_catalog(
    database="raw_db", table_name="clickstream"
)
clean = DropNullFields.apply(frame=dyf)          # drop null columns
 
# Save as Parquet in the training feature location (with partitioning)
glueContext.write_dynamic_frame.from_options(
    frame=clean,
    connection_type="s3",
    connection_options={"path": "s3://my-lake/features/", "partitionKeys": ["dt"]},
    format="parquet",
)

💡 Related theory: Glue's DynamicFrame is an ML/ETL-friendly extension of the Spark DataFrame that can handle semi-structured data with inconsistent schemas (like JSON) without schema enforcement (rows with schema mismatches are preserved rather than dropped). Once structured transformation is done, call toDF() to convert to a regular Spark DataFrame and use familiar operations. Thanks to the Data Catalog populated by the crawler, you can explore data immediately with SQL in Athena, speeding up the data-understanding (EDA) stage before ML preprocessing.

Batch Training Data vs. Streaming Training Data

ML data ingestion splits into two patterns.

AspectBatchStreaming
Arrival patternPeriodic bulk loads (daily/hourly)As soon as each event arrives
Typical toolsGlue, EMR, Batch, S3Kinesis, MSK (Kafka)
LatencyMinutes to hoursSeconds to milliseconds
Training fitMost model retrainingReal-time features & online learning
FreshnessStaleness acceptableRecency is the value

Most ML training is batch — for example, retraining the model each night on accumulated data. Streaming is needed when (1) real-time features (transaction count in the last 5 minutes) must feed inference, or (2) an immediate score is required, as in fraud detection.

# Lambda architecture pattern: process the stream immediately while also landing it in S3 for later batch retraining
# Firehose → S3 (accumulate the data lake for batch training)
# KDS → Flink → real-time features → inference endpoint (immediate processing)

💡 Related theory: The lambda architecture processes the same data simultaneously through a speed layer (streaming, low-latency approximation) and a batch layer (periodic, accurate and complete), combining the strengths of both. In ML it is commonly used as: accumulate every event in S3 via Firehose (for batch retraining) while computing real-time features with KDS+Flink (for immediate inference). Note that if the feature computation logic diverges between the two paths, training-serving skew arises, so consistency management is important.

Thinking Through Ingestion Pipeline Design

When solving exam scenarios, ask in order: (1) Is the data a stream or a batch? (2) If a stream, is it simple delivery (Firehose) or custom/multi-consumer (KDS)? (3) Is transformation needed (Glue ETL)? (4) Is the destination a data lake (S3) or analytics (Redshift/OpenSearch)? These four questions solve most ingestion problems.

📝 Practice Questions

Click a choice to reveal the answer and explanation.

Question 1

An IoT sensor stream just needs to be automatically delivered as-is into an S3 data lake as Parquet, with no separate transformation or code. Which service fits best?

Question 2

A single clickstream must be consumed independently by (1) a real-time dashboard, (2) a fraud detection model, and (3) later reprocessing, and the data must be re-readable after a failure. Which service fits?

Question 3

A large volume of JSON logs with unknown schemas has piled up in S3. Before starting SQL exploration with Athena, you want to automatically create the tables and schemas. Which tool do you use?

Question 4

What is the biggest reason most ML model retraining happens in batch rather than streaming?

Question 5

Which architecture pattern uses the same event data for both real-time feature computation (immediate inference) and periodic model retraining (accurate and complete)?

PreviousData Storage for ML: S3, EFS, FSx for Lustre, and Data FormatsWeek 1 · Day 2Next Data Labeling: SageMaker Ground Truth, Active Learning, Label QualityWeek 1 · Day 4

On this page

  • Distinguishing the Four Kinesis Services: A Specialty Staple
  • Glue: Serverless ETL and the Data Catalog
  • Batch Training Data vs. Streaming Training Data
  • Thinking Through Ingestion Pipeline Design
  • Practice Questions