CertNote/ 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
Linux Master 2 · 2급KAIT Linux Master - Level 2
SCS-C03 · SpecialtySecurity - Specialty
Linux Master 1 · 1급KAIT Linux Master - Level 1
MLA-C01 · AssociateMachine Learning Engineer - Associate
  • Week 1
    • 1.The ML Lifecycle and the Role of the ML Engineer
    • 2.ML Problem Types and Evaluation Metric Basics
    • 3.AWS ML Stack at a Glance
    • 4.SageMaker Overview: Studio, Training/Inference, Built-in Algorithms
    • 5.Week 1 Comprehensive Review — ML Fundamentals & AWS Stack
  • Week 2
    • 1.Data Collection: S3 Data Lake, Kinesis, Batch Ingestion, Data Formats
    • 2.Data Catalog & ETL: AWS Glue and DataBrew
    • 3.Query & Exploration: Athena, Redshift, EDA Basics
    • 4.Data Storage Strategy: Partitioning, Format Optimization, Training Preparation
    • 5.Week 2 Comprehensive Review — Data Collection & Storage Recap
  • Week 3
  • Week 4
  • Week 5
  • Week 6
  • Week 7
  • Week 8
  • Week 9
  • Week 10
AIF-C01 · FoundationalAI Practitioner - Foundational
DEA-C01 · AssociateData Engineer - Associate
MLS-C01 · SpecialtyMachine Learning - Specialty
SQLD · 개발자SQL Developer (SQLD)

© CertNote · 주간랩스

  • About
  • Changelog
  • Contact
  • Terms
  • Privacy
← MLA-C01/Week 2/Day 5

Based on the MLA-C01 exam guide·Report an error

MLA-C01· AssociateWeek 2 · Day 5~27 min read

Day 5 - Week 2 Comprehensive Review — Data Collection & Storage Recap

📌 Key Takeaways

  • The big picture of this week is a data lake centered on S3. Every service shares S3 as its input and output.
  • Pick the ingestion tool by the shape in which data arrives — Kinesis for streaming, DMS for databases, DataSync for files.
  • Storage is processed for training — Parquet + Snappy + date partitioning + sharding.
  • Glue is the hub for cataloging and transformation — Crawlers register schemas, and ETL Jobs/DataBrew transform the data.
  • Athena bills by bytes scanned, so format and partition design is the cost. The SELECT * habit inflates the bill.

The Entire Data Pipeline at a Glance

Rather than memorizing this week's services one by one, it is more efficient for exam prep to place them on the flow of "raw data comes in and becomes a trainable dataset."

[Source]
  │  ① Ingestion
  ├─ Streaming ──> Kinesis Data Streams / Firehose ─┐
  └─ Batch ──────> DMS / DataSync / direct upload ──┤
                                                    v
                                           ┌─────────────────────┐
                                           │   S3 data lake      │  ② Storage
                                           │ (single source of   │
                                           │  truth)             │
                                           └─────────────────────┘
                                                    │  ③ Catalog & transform
                                           Glue Crawler → Data Catalog
                                           Glue ETL Job (cleaning, format conversion)
                                                    │  ④ Query & explore
                                           Athena (serverless SQL, EDA)
                                                    │
                                                    v
                                           SageMaker training (Parquet, Pipe mode)

The key point is that S3 is at the center. Every service uses S3 as its input and output, and training ultimately reads its data from S3 as well.

This structure is the classic "data lake." A data warehouse loads structured data into a predefined schema up front (schema-on-write), whereas a data lake first piles raw data into S3 as it is and applies the schema when the data is read (schema-on-read). ML works with structured, semi-structured, and unstructured data, and it does not know in advance which features will turn out to be useful, so the data lake model of "collect everything first and interpret it later" fits well.

Ingestion: Streaming vs Batch

The tool depends on the shape in which the data arrives. This is an easy distinction to mix up.

CategoryServiceSuitable situationAnswer keywords
Real-time streamingKinesis Data StreamsLow latency, many consumers, direct processing"under 1 second", "multiple apps consume", "replay"
Streaming → storageKinesis Data FirehoseAutomatic delivery to S3/Redshift, no management"load without code", "minimal management overhead"
DB migrationDMSReplicate on-premises/RDS → S3/Redshift"CDC", "continuous DB replication"
Bulk file transferDataSyncSync on-premises files → S3"NFS/SMB file server"
Physical transferSnowballScale that would take months over the network line"100 TB + slow line"

You need to tell the two Kinesis siblings apart. Data Streams lets you attach your own consumers to process data in real time and requires you to manage shards (flexible, low latency). Firehose is fully managed: it buffers the data and then delivers it automatically to S3/Redshift (when you only want delivery without writing code).

import boto3
kinesis = boto3.client("kinesis")
 
# Put a real-time event into Kinesis Data Streams
kinesis.put_record(
    StreamName="clickstream",
    Data=b'{"user_id": "u123", "event": "click", "ts": "2026-06-25T10:00:00Z"}',
    PartitionKey="u123",     # Same key → same shard → order preserved
)

If the need is "real-time, but just pile it into S3 without code," it is Firehose; if "multiple apps each process the real-time stream and replay is also needed," it is Data Streams. The PartitionKey sends records with the same key to the same shard, which preserves order — use user_id as the key when the per-user event order matters.

⚠️ Trap: Reducing the stream to 1 shard to preserve order is the wrong answer. Order is guaranteed within a shard, so with a well-chosen PartitionKey you can keep several shards and still preserve order per key. Cutting down to 1 shard only reduces overall throughput.

Storage: Format and Partitioning

Collected data is not left as it is; it is processed to favor training. Summarizing the gist of the storage strategy from yesterday:

DecisionDefaultReason
FormatParquetColumnar, compressed, splittable
CompressionSnappyDecompression speed matters for frequently read data
PartitioningDate (year=/month=/day=)Most queries filter by date
File sizeSeveral reasonably sized shardsDistributed reads and ShardedByS3Key behavior
Input modePipe/FastFile when data is largeRemoves copy wait, prevents starving the GPU

These five decisions determine both the Athena query cost (billed by bytes scanned) and the SageMaker training speed.

Common storage mistakes and their symptoms

MistakeSymptomFix
Training directly on CSVSlow training start, high I/O costConvert to Parquet
Flat storage without partitionsAthena bill explodesDate partitioning
Single Gzip CSV fileOnly 1 worker works, the rest sit idleSplittable format + sharding
Per-second partitionsMillions of small files, metadata explosionGroup by day or month
Single giant file + ShardedByS3KeyNo distribution at allSplit into multiple objects

Catalog & Transform: Glue

The center of the ETL that turns raw data into a trainable form is AWS Glue.

Glue componentRoleWhen to choose it
CrawlerScan S3 → infer schema → register tables in the CatalogAutomatically register schemas for thousands of files
Data CatalogCentral metadata store (shared by Athena, Spectrum, EMR)When several engines must see the same definition
ETL Job (Spark)Large-scale distributed cleaning, transformation, and format conversionGB to TB scale transformations
Python Shell JobSingle-process scriptSmall transformations of a few MB
DataBrewVisual cleaning and profiling without codeNon-technical users, quick exploration
# Glue PySpark ETL: clean the CSV and save it as partitioned Parquet
from awsglue.context import GlueContext
from pyspark.context import SparkContext
 
glueContext = GlueContext(SparkContext.getOrCreate())
df = glueContext.create_dynamic_frame.from_catalog(
    database="ml_datalake", table_name="raw_events"
).toDF()
 
df.write.partitionBy("year", "month").mode("overwrite") \
    .parquet("s3://ml-datalake/curated/events/")

The Glue Data Catalog acts as the "single source of truth for metadata." Once a Crawler registers a schema, Athena, Redshift Spectrum, and EMR share the same table definition. Separating the data (S3) from the metadata (Catalog), so that several query engines can each read the same data in their own way, is the core design of a data lake architecture.

Query & Explore: Athena

This is the stage where you read and understand the prepared data. Athena queries S3 directly with serverless SQL and bills by the amount of data scanned ($5/TB). That is why Parquet + partitioning + compression translate directly into cost savings. It is the main venue for EDA (checking distributions, missing values, class imbalance, and data leakage), and with CTAS you can turn query results straight into a Parquet training dataset.

-- Reduce the scan volume with a partition filter while checking class imbalance
SELECT churned, COUNT(*) AS cnt
FROM ml_datalake.events
WHERE year = '2026' AND month = '06'
GROUP BY churned;

⚠️ Trap: If you forget that Athena cost is proportional to the amount scanned and full-scan everything with SELECT *, it gets expensive. The habit of selecting only the columns you need (taking advantage of Parquet's column skipping) and filtering by partition keys cuts cost by tens of times.

Week 2 One-Line Checklist

QuestionAnswer
What is the single source of truth for ML data?S3
Is it OK to overwrite the originals in the Raw zone?No. The reprocessing path disappears
How do you load a stream into S3 without code?Kinesis Data Firehose
What if you need low latency + multiple consumers + replay?Kinesis Data Streams
How do you continuously replicate a relational DB?DMS (CDC)
What if you must move 100 TB over a slow line?Snowball
What is the default training data format?Parquet + Snappy
How do you register schemas for thousands of files?Glue Crawler
What if you use Spark for a few-MB transformation?The overhead is large, so Python Shell is better
What should you check first when the Athena bill is large?Scan volume — format, partitions, column selection

Service Wrong-Answer Matching Summary

On the exam, wrong answer options usually slip in "a service from a different stage." If you pin down which stage each service belongs to, you can filter them out.

ServiceStageEasily confused with
Kinesis Data StreamsIngestion (streaming)Differs from Firehose in management overhead and latency
Kinesis Data FirehoseIngestion → deliveryDiffers from Data Streams in the consumer structure
Kinesis Data AnalyticsStream analyticsBe careful not to confuse it with delivery purposes
DMSIngestion (DB replication)DataSync has a different source type
DataSyncIngestion (files)DMS has a different source type
SnowballIngestion (physical transfer)Differs from DataSync in the network line condition
Glue CrawlerCatalogIts role differs from an ETL Job
Glue ETL JobTransformIts interface differs from Crawler and DataBrew
Glue DataBrewTransform (no-code)Its user base differs from an ETL Job
AthenaQueryDiffers from Redshift in billing and in whether data is loaded
RedshiftAnalytics (load-based)Its workload character differs from Athena
Redshift SpectrumAnalytics (S3 join)Its execution engine differs from Athena

This Week Revisited from a Cost Perspective

StageWhere cost is incurredHow to reduce it
Ingestion (streaming)Number of shards × hoursShards matched to throughput, Firehose when possible
StorageStorage volume × durationCompression, lifecycle policies, storage class per zone
CatalogCrawler run timeCrawl only new folders, partition projection
TransformDPU × run timeAppropriate Job type, incremental processing
QueryBytes scannedParquet + partitioning + column selection
Training inputGPU idle timePipe/FastFile, sharding, efficient formats

A single storage design decision drives the cost of every later stage. Parquet + date partitioning + appropriate sharding pays off in three stages at once: catalog, query, and training.

Five Things That Ruin a Pipeline

MistakeWhere it blows up
Overwriting the Raw zoneCannot reprocess when a transformation bug is found
Choosing partition keys unrelated to queriesAthena bill does not shrink
Storing training data as Gzip CSVOnly one worker works in distributed training
Running the crawler just once with no scheduleNew partitions and columns are not reflected
Using a Spark Job for a few-MB transformationStartup overhead exceeds the processing time

This week's services are asked about not as "what does it do" but as "under what conditions is it the best choice." Memorizing service names and features is not enough; you must be able to compare them along four axes: latency, management overhead, cost, and data size.

Week 2 in One Sentence

"Pile up the originals in S3 as immutable data, catalog and transform them with Glue and reorganize them into Parquet + date partitioning, then explore them with Athena and let SageMaker read them as they are for training."

StageOne wordDo not forget
IngestionShapeStreaming, batch, and physical transfer diverge
StorageImmutableNever overwrite the Raw zone
CatalogSharedEvery engine sees one definition
TransformScaleData size decides the Job type
QueryScan volumeYou pay for what you read
Training inputBottleneckThe goal is to not starve the GPU

Next week (Week 3) covers feature engineering, which turns the data prepared this way into a form the model can read, along with checking the data for bias and quality.

📖 Glossary

  • Data pipeline : The series of steps that move and refine data from the source to the training dataset.
  • Ingestion : The process of bringing external data into AWS (mainly S3). It is divided into streaming and batch.
  • PartitionKey : The value in Kinesis that decides which shard a record goes to. The same key goes to the same shard, so order is preserved.
  • Replay : Re-reading stream data within the retention period from the beginning. Possible only with Data Streams.
  • Buffering : The way Firehose gathers data up to a certain size or time and then flushes it all at once.
  • schema-on-write : The traditional DB approach that enforces the schema at the moment data is inserted. Contrasts with a data lake.
  • Glue Crawler : A tool that scans a data store, automatically discovers the schema and partitions, and registers them in the catalog.
  • Data Catalog : A central store of table definitions shared by several query engines. It does not hold the data itself.
  • Sharding : Splitting data into several appropriately sized files so that parallel reads become possible.
  • Scan-based billing : A model where the charge is proportional to the bytes a query actually reads. The key constraint in Athena design.

📝 Practice Questions

Click a choice to reveal the answer and explanation.

Question 1

Real-time clickstream needs buffering and auto-loading to S3 without separate processing code. What is most suitable?

Question 2

What is the core role Glue Crawler performs?

Question 3

Why does S3 play the "single source of truth" role in an ML data lake?

Question 4

During Athena EDA, costs exceeded expectations because all queries used SELECT * scanning entire data. What most appropriately reduces cost?

Question 5

To guarantee processing order for events with same user_id in Kinesis Data Streams, what do you do?

PreviousData Storage Strategy: Partitioning, Format Optimization, Training PreparationWeek 2 · Day 4Next Feature Engineering: The Art of Turning Data into Numbers a Model Can ReadWeek 3 · Day 1

Official references

  • MLA-C01 official exam page(opens in a new tab)
  • Amazon S3 documentation(opens in a new tab)
  • Amazon Athena documentation(opens in a new tab)
  • AWS Glue documentation(opens in a new tab)
  • Amazon Data Firehose documentation(opens in a new tab)
  • Amazon Redshift documentation(opens in a new tab)

On this page

  • Key Takeaways
  • The Entire Data Pipeline at a Glance
  • Ingestion: Streaming vs Batch
  • Storage: Format and Partitioning
  • Catalog & Transform: Glue
  • Query & Explore: Athena
  • Week 2 One-Line Checklist
  • Service Wrong-Answer Matching Summary
  • This Week Revisited from a Cost Perspective
  • Five Things That Ruin a Pipeline
  • Week 2 in One Sentence
  • Glossary
  • Practice Questions