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 2
MLS-C01· AssociateWeek 1 · Day 2~15 min read

Day 2 - Data Storage for ML: S3, EFS, FSx for Lustre, and Data Formats

The most common reason GPUs sit idle during ML training is not that the model is slow — it is that the data does not arrive on time. The GPUs on an ml.p4d instance can consume several GB per second, and if storage cannot keep up, the expensive accelerators idle while waiting on I/O. That is why the Specialty exam asks "which data goes where, in which format" as a cost-versus-performance trade-off.

Today we cover (1) S3 as the center of the data lake, (2) EFS and FSx for Lustre for accelerating training I/O, and (3) ML-friendly formats like RecordIO and Parquet.

S3: The Center of the ML Data Lake

Nearly all SageMaker training data starts in S3. S3 offers virtually unlimited capacity with eleven nines of durability, and SageMaker reads from it natively. The key is choosing the input mode — how you stream data from S3 all the way to the GPU.

Input modeBehaviorBest-fit situation
File modeCopies the entire dataset to instance disk (EBS) before trainingSmall data, random access required
Pipe modeStreams from S3, never lands on diskLarge data, sequential access, minimal startup delay
FastFile modeOn-demand, POSIX-like access to only the files neededLarge data where only part is read, or random access
from sagemaker.inputs import TrainingInput
 
# Pipe mode: stream instead of downloading everything → fast start on large data
train_input = TrainingInput(
    s3_data="s3://my-lake/features/train/",
    input_mode="Pipe",                 # File | Pipe | FastFile
    distribution="ShardedByS3Key",     # split the data across multiple instances
    content_type="application/x-recordio-protobuf",
)
estimator.fit({"train": train_input})

distribution="ShardedByS3Key" makes each instance in multi-instance distributed training read only a different slice of the data, eliminating duplication. FullyReplicated sends the entire dataset to every instance (suitable for small data and validation sets).

💡 Related theory: In File mode, the full copy must finish before the first training step runs. For hundreds of GB, that copy alone takes tens of minutes while expensive GPUs sit idle. Pipe mode starts training as soon as the first batch arrives, so time-to-first-batch is short. However, Pipe is a sequential stream, which makes full shuffling per epoch difficult, and the algorithm must support Pipe. FastFile is the compromise between the two: it supports random access while avoiding the full copy.

EFS and FSx for Lustre: Accelerating Training I/O

S3 is object storage, so it cannot do directory operations or random reads as fast as a POSIX file system. When training must repeat the same data over many epochs or randomly access many small files, file system storage wins.

StorageCharacteristicsFitting ML scenarios
EFSManaged NFS, shared across instances, elastic scalingMedium-sized datasets shared by notebooks and multiple jobs
FSx for LustreHigh-performance parallel file system, S3 integrationLarge-scale distributed training, high-throughput I/O demands

The killer feature of FSx for Lustre is its S3 repository integration. It uses an S3 bucket as the backend, and FSx behaves like a high-performance cache. The data stays in S3 (cheap, durable), while training reads it at Lustre's hundreds of GB/s of throughput.

from sagemaker.inputs import FileSystemInput
 
# Mount FSx for Lustre directly as training input
fsx_input = FileSystemInput(
    file_system_id="fs-0123456789abcdef0",
    file_system_type="FSxLustre",
    directory_path="/fsx/imagenet/train",
    file_system_access_mode="ro",
)
estimator.fit({"train": fsx_input})

💡 Related theory: When you repeat hyperparameter tuning (HPO) dozens to hundreds of times on the same dataset, the cost of downloading from S3 every time adds up. Upload it once to FSx for Lustre and every tuning job shares high-speed access, dramatically reducing overall time and cost. EFS has lower throughput than Lustre but is simpler to set up and good for durable sharing. The core decision rule: repeated, high-throughput = Lustre; shared, general-purpose = EFS; one-off large-scale streaming = S3 Pipe.

Data Formats: RecordIO and Parquet

Feeding raw CSV, JSON, or images directly into training slows I/O down with parsing overhead and the small-files problem. ML favors two formats.

RecordIO-protobuf: The recommended format for SageMaker built-in algorithms. It packs many records into one large binary, optimal for sequential reads and Pipe-mode streaming.

import io, numpy as np
import sagemaker.amazon.common as smac
 
# Serialize a numpy matrix to RecordIO-protobuf and upload to S3
buf = io.BytesIO()
smac.write_numpy_to_dense_tensor(buf, X_train.astype("float32"), y_train.astype("float32"))
buf.seek(0)
 
import boto3
boto3.client("s3").upload_fileobj(buf, "my-lake", "features/train/data.recordio")

Parquet: A columnar storage format. Storing by column rather than by row means (1) you read only the columns you need (projection pushdown), (2) per-column compression ratios are high, and (3) Athena, Glue, and Spark read it natively. It is the de facto standard for structured feature data.

import pandas as pd
# Compared to CSV, Parquet gives column-selective reads + high compression → less ETL/analytics I/O
df.to_parquet("s3://my-lake/features/train.parquet", engine="pyarrow", compression="snappy")
# If training needs only some columns, scan just those → massive I/O reduction
cols = pd.read_parquet("s3://my-lake/features/train.parquet", columns=["age", "amount", "label"])

💡 Related theory: A row-based format (CSV) must read each row in its entirety, so even if you need only 3 of 50 columns, you scan them all. A columnar format (Parquet) stores each column separately, so you read only the 3 you need. Moreover, values in the same column share similar types and distributions, so they compress well. That is why Parquet is the frequent right answer for structured data analytics and ETL, and RecordIO-protobuf for large-scale sequential training with SageMaker built-in algorithms.

The Small-Files Problem and Consolidation

Leaving millions of small images or JSON files as-is in S3 slows training due to per-object request overhead. The fix is sharding: merging small files into large bundles such as RecordIO, TFRecord, or tar. Make each bundle a few hundred MB so sequential I/O is efficient and it pairs well with Pipe mode.

📝 Practice Questions

Click a choice to reveal the answer and explanation.

Question 1

You are training 800GB of data across 4 ml.p3 instances in a distributed setup. To minimize the time GPUs sit idle waiting for data copies while having each instance read only a different slice of the data, what should you use?

Question 2

You run 200 rounds of hyperparameter tuning on the same ImageNet dataset, and the repeated S3 download time is accumulating into significant cost. What is the most appropriate storage strategy?

Question 3

In a structured feature table with 50 columns, analytics and ETL read only 3-5 columns each time. Which format reduces both I/O and storage cost at once?

Question 4

What is the recommended serialization format when training a SageMaker built-in algorithm on large data with Pipe-mode sequential streaming?

Question 5

Multiple data scientists' notebooks and multiple processing jobs need to simultaneously share and modify the same medium-sized dataset as a POSIX file system. Which choice is simple to set up and scales elastically?

PreviousThe ML Lifecycle (from a Specialty Perspective)Week 1 · Day 1Next Data Ingestion: Kinesis, Glue, Batch vs. StreamingWeek 1 · Day 3

On this page

  • S3: The Center of the ML Data Lake
  • EFS and FSx for Lustre: Accelerating Training I/O
  • Data Formats: RecordIO and Parquet
  • The Small-Files Problem and Consolidation
  • Practice Questions