@xdev-asia/xdev-knowledge-mcp 1.0.42 → 1.0.44

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/content/pages/xoa-du-lieu-nguoi-dung.md +68 -0
  2. package/content/series/luyen-thi/luyen-thi-aws-ml-specialty/chapters/01-phan-1-data-engineering/lessons/01-bai-1-data-repositories-ingestion.md +198 -0
  3. package/content/series/luyen-thi/luyen-thi-aws-ml-specialty/chapters/01-phan-1-data-engineering/lessons/02-bai-2-data-transformation.md +183 -0
  4. package/content/series/luyen-thi/luyen-thi-aws-ml-specialty/chapters/01-phan-1-data-engineering/lessons/03-bai-3-data-analysis.md +159 -0
  5. package/content/series/luyen-thi/luyen-thi-aws-ml-specialty/chapters/02-phan-2-modeling/lessons/04-bai-4-sagemaker-built-in-algorithms.md +186 -0
  6. package/content/series/luyen-thi/luyen-thi-aws-ml-specialty/chapters/02-phan-2-modeling/lessons/05-bai-5-training-hyperparameter-tuning.md +159 -0
  7. package/content/series/luyen-thi/luyen-thi-aws-ml-specialty/chapters/02-phan-2-modeling/lessons/06-bai-6-model-evaluation.md +169 -0
  8. package/content/series/luyen-thi/luyen-thi-aws-ml-specialty/chapters/03-phan-3-implementation-operations/lessons/07-bai-7-model-deployment.md +193 -0
  9. package/content/series/luyen-thi/luyen-thi-aws-ml-specialty/chapters/03-phan-3-implementation-operations/lessons/08-bai-8-model-monitoring-mlops.md +184 -0
  10. package/content/series/luyen-thi/luyen-thi-aws-ml-specialty/chapters/03-phan-3-implementation-operations/lessons/09-bai-9-security-cost.md +166 -0
  11. package/content/series/luyen-thi/luyen-thi-aws-ml-specialty/chapters/04-phan-4-on-tap/lessons/10-bai-10-bai-toan-thuong-gap.md +181 -0
  12. package/content/series/luyen-thi/luyen-thi-aws-ml-specialty/chapters/04-phan-4-on-tap/lessons/11-bai-11-cheat-sheet.md +110 -0
  13. package/content/series/luyen-thi/luyen-thi-aws-ml-specialty/chapters/04-phan-4-on-tap/lessons/12-bai-12-chien-luoc-thi.md +113 -0
  14. package/content/series/luyen-thi/luyen-thi-aws-ml-specialty/index.md +1 -1
  15. package/content/series/luyen-thi/luyen-thi-cka/index.md +217 -0
  16. package/content/series/luyen-thi/luyen-thi-ckad/index.md +199 -0
  17. package/content/series/luyen-thi/luyen-thi-gcp-ml-engineer/chapters/01-phan-1-problem-framing/lessons/01-bai-1-framing-ml-problems.md +136 -0
  18. package/content/series/luyen-thi/luyen-thi-gcp-ml-engineer/chapters/01-phan-1-problem-framing/lessons/02-bai-2-gcp-ai-ml-ecosystem.md +160 -0
  19. package/content/series/luyen-thi/luyen-thi-gcp-ml-engineer/chapters/02-phan-2-data-engineering/lessons/03-bai-3-data-pipeline.md +174 -0
  20. package/content/series/luyen-thi/luyen-thi-gcp-ml-engineer/chapters/02-phan-2-data-engineering/lessons/04-bai-4-feature-engineering.md +156 -0
  21. package/content/series/luyen-thi/luyen-thi-gcp-ml-engineer/chapters/03-phan-3-model-development/lessons/05-bai-5-vertex-ai-training.md +155 -0
  22. package/content/series/luyen-thi/luyen-thi-gcp-ml-engineer/chapters/03-phan-3-model-development/lessons/06-bai-6-bigquery-ml-tensorflow.md +141 -0
  23. package/content/series/luyen-thi/luyen-thi-gcp-ml-engineer/chapters/04-phan-4-deployment-mlops/lessons/07-bai-7-model-deployment.md +134 -0
  24. package/content/series/luyen-thi/luyen-thi-gcp-ml-engineer/chapters/04-phan-4-deployment-mlops/lessons/08-bai-8-vertex-ai-pipelines-mlops.md +149 -0
  25. package/content/series/luyen-thi/luyen-thi-gcp-ml-engineer/chapters/05-phan-5-responsible-ai/lessons/09-bai-9-responsible-ai.md +128 -0
  26. package/content/series/luyen-thi/luyen-thi-gcp-ml-engineer/chapters/05-phan-5-responsible-ai/lessons/10-bai-10-cheat-sheet-chien-luoc-thi.md +108 -0
  27. package/content/series/luyen-thi/luyen-thi-gcp-ml-engineer/index.md +1 -1
  28. package/content/series/luyen-thi/luyen-thi-kcna/index.md +168 -0
  29. package/data/quizzes/aws-ai-practitioner.json +362 -0
  30. package/data/quizzes/aws-ml-specialty.json +200 -0
  31. package/data/quizzes/gcp-ml-engineer.json +200 -0
  32. package/package.json +1 -1
@@ -0,0 +1,193 @@
1
+ ---
2
+ id: 82fb04d8-e74e-4cf3-8b90-cfa274629073
3
+ title: 'Bài 7: Model Deployment — Endpoints & Inference'
4
+ slug: bai-7-model-deployment
5
+ description: >-
6
+ Real-time Endpoints, Batch Transform, Async Inference, Serverless Inference.
7
+ Multi-Model Endpoints, Inference Pipeline.
8
+ Elastic Inference, SageMaker Neo (edge deployment).
9
+ A/B Testing Production Variants.
10
+ duration_minutes: 60
11
+ is_free: true
12
+ video_url: null
13
+ sort_order: 7
14
+ section_title: "Phần 3: ML Implementation & Operations (20%)"
15
+ course:
16
+ id: 019c9619-lt02-7002-c002-lt0200000002
17
+ title: 'Luyện thi AWS Certified Machine Learning - Specialty'
18
+ slug: luyen-thi-aws-ml-specialty
19
+ ---
20
+
21
+ <div style="text-align: center; margin: 2rem 0;">
22
+ <img src="/storage/uploads/2026/04/aws-mls-bai7-deployment-options.png" alt="SageMaker Model Deployment Options" style="max-width: 800px; width: 100%; border-radius: 12px;" />
23
+ <p><em>SageMaker Deployment: Real-time Endpoint, Serverless, Async Inference, và Batch Transform</em></p>
24
+ </div>
25
+
26
+ <h2 id="deployment-options"><strong>1. SageMaker Deployment Options</strong></h2>
27
+
28
+ <p>SageMaker cung cấp nhiều inference patterns — mỗi loại phù hợp với workload khác nhau. Phần này thường có 5-8 câu trong đề thi MLS-C01.</p>
29
+
30
+ <blockquote>
31
+ <p><strong>Exam tip:</strong> Key decision factors: latency requirement, volume, cost, payload size. Map these to: Real-time (low latency) → Async (large payload) → Serverless (sporadic) → Batch (no latency need).</p>
32
+ </blockquote>
33
+
34
+ <table>
35
+ <thead><tr><th>Deployment Type</th><th>Latency</th><th>Throughput</th><th>Cost Model</th><th>Best For</th></tr></thead>
36
+ <tbody>
37
+ <tr><td><strong>Real-time Endpoint</strong></td><td>Milliseconds</td><td>High</td><td>Always-on (pay per hour)</td><td>Interactive apps, APIs</td></tr>
38
+ <tr><td><strong>Serverless Inference</strong></td><td>Seconds (cold start)</td><td>Variable</td><td>Pay-per-invocation</td><td>Sporadic, unpredictable traffic</td></tr>
39
+ <tr><td><strong>Async Inference</strong></td><td>Minutes</td><td>High queued</td><td>Pay per processing</td><td>Large payloads, non-urgent</td></tr>
40
+ <tr><td><strong>Batch Transform</strong></td><td>No real-time</td><td>Very high</td><td>Pay per batch job</td><td>Scheduled offline predictions</td></tr>
41
+ </tbody>
42
+ </table>
43
+
44
+ <h2 id="realtime-endpoint"><strong>2. Real-time Inference</strong></h2>
45
+
46
+ <p>Standard deployment — persistent endpoint chạy constantly, responds synchronously.</p>
47
+
48
+ <pre><code class="language-text">Real-time Endpoint Architecture:
49
+
50
+ Client ──→ HTTPS Request
51
+
52
+ SageMaker Endpoint
53
+ ┌────────────────┐
54
+ │ Model Server │ ← Instance running 24/7
55
+ │ (TorchServe, │
56
+ │ TensorFlow │
57
+ │ Serving, etc) │
58
+ └────────────────┘
59
+
60
+ Response (ms)
61
+ </code></pre>
62
+
63
+ <h3 id="autoscaling"><strong>2.1. Auto Scaling cho Endpoints</strong></h3>
64
+
65
+ <p>Endpoints có thể scale dựa trên <strong>InvocationsPerInstance</strong> metric qua Application Auto Scaling.</p>
66
+
67
+ <h2 id="serverless"><strong>3. Serverless Inference</strong></h2>
68
+
69
+ <p>Phù hợp khi traffic <strong>không đều, khó dự đoán</strong>. AWS tự động scale, kể cả về 0 khi không có traffic.</p>
70
+
71
+ <table>
72
+ <thead><tr><th>Feature</th><th>Detail</th></tr></thead>
73
+ <tbody>
74
+ <tr><td>Cold start latency</td><td>~1-2 seconds (đầu tiên sau thời gian nhàn rỗi)</td></tr>
75
+ <tr><td>Memory config</td><td>1 GB → 6 GB</td></tr>
76
+ <tr><td>Max payload</td><td>4 MB</td></tr>
77
+ <tr><td>Pricing</td><td>Per inference requests + processing time</td></tr>
78
+ </tbody>
79
+ </table>
80
+
81
+ <h2 id="async"><strong>4. Async Inference</strong></h2>
82
+
83
+ <p>Phù hợp cho <strong>large media files, long processing time</strong>. Request được queued, response lưu vào S3.</p>
84
+
85
+ <pre><code class="language-text">Async Inference Flow:
86
+
87
+ Client ──→ Upload payload to S3 ──→ Invoke Endpoint
88
+
89
+ Queue Request
90
+
91
+ Process when instance available
92
+
93
+ Save output to S3
94
+
95
+ SNS Notification → Client
96
+ </code></pre>
97
+
98
+ <table>
99
+ <thead><tr><th>Feature</th><th>Detail</th></tr></thead>
100
+ <tbody>
101
+ <tr><td>Max payload</td><td>1 GB (vs 6 MB for real-time)</td></tr>
102
+ <tr><td>Auto-scale to 0</td><td>Yes — scales down when queue empty</td></tr>
103
+ <tr><td>Response</td><td>S3 output path + SNS notification</td></tr>
104
+ </tbody>
105
+ </table>
106
+
107
+ <h2 id="batch-transform"><strong>5. Batch Transform</strong></h2>
108
+
109
+ <p>Chạy predictions trên <strong>toàn bộ dataset</strong> theo lịch. Không có endpoint — chỉ chạy khi cần.</p>
110
+
111
+ <pre><code class="language-text">Batch Transform:
112
+
113
+ Input S3 ──→ Batch Transform Job ──→ Output S3
114
+ (CSV/ (ephemeral compute) (CSV/JSON
115
+ JSON/ predictions)
116
+ Parquet) ↑
117
+ No persistent endpoint
118
+ Pay only when running
119
+ </code></pre>
120
+
121
+ <h2 id="multi-model"><strong>6. Multi-Model Endpoints (MME)</strong></h2>
122
+
123
+ <p><strong>MME</strong> cho phép host <strong>nhiều models</strong> trên một endpoint, giảm chi phí inference infrastructure.</p>
124
+
125
+ <table>
126
+ <thead><tr><th>Feature</th><th>Detail</th></tr></thead>
127
+ <tbody>
128
+ <tr><td>Cost saving</td><td>Một endpoint phục vụ hàng ngàn models</td></tr>
129
+ <tr><td>Dynamic loading</td><td>Models loaded into memory on-demand, cached</td></tr>
130
+ <tr><td>Use case</td><td>SaaS multi-tenant với model per customer</td></tr>
131
+ </tbody>
132
+ </table>
133
+
134
+ <h2 id="neo"><strong>7. SageMaker Neo — Edge Deployment</strong></h2>
135
+
136
+ <p><strong>SageMaker Neo</strong> compiles models và optimize cho specific hardware (edge devices, mobile).</p>
137
+
138
+ <pre><code class="language-text">Neo Workflow:
139
+
140
+ Trained Model (S3)
141
+
142
+ Neo Compiler
143
+ (optimizes for target hardware)
144
+
145
+ Optimized Model
146
+
147
+ ├── Deploy to IoT Greengrass (edge)
148
+ ├── Deploy to ARM devices
149
+ └── Deploy to mobile (Android/iOS)
150
+ </code></pre>
151
+
152
+ <h2 id="cheat-sheet"><strong>8. Cheat Sheet — Deployment Decision</strong></h2>
153
+
154
+ <table>
155
+ <thead><tr><th>Scenario</th><th>Deployment Type</th></tr></thead>
156
+ <tbody>
157
+ <tr><td>Mobile app, real-time response (&lt;100ms)</td><td>Real-time Endpoint</td></tr>
158
+ <tr><td>Traffic is sporadic (few req/hour)</td><td>Serverless Inference</td></tr>
159
+ <tr><td>Video/audio processing (large files)</td><td>Async Inference</td></tr>
160
+ <tr><td>Nightly predictions on full dataset</td><td>Batch Transform</td></tr>
161
+ <tr><td>Thousands of customer-specific models</td><td>Multi-Model Endpoints</td></tr>
162
+ <tr><td>IoT edge device deployment</td><td>SageMaker Neo + Greengrass</td></tr>
163
+ </tbody>
164
+ </table>
165
+
166
+ <h2 id="practice"><strong>9. Practice Questions</strong></h2>
167
+
168
+ <p><strong>Q1:</strong> A company runs an e-commerce chatbot that requires sub-100ms response times during peak shopping hours. Which SageMaker inference type should they use?</p>
169
+ <ul>
170
+ <li>A) Batch Transform</li>
171
+ <li>B) Async Inference</li>
172
+ <li>C) Serverless Inference</li>
173
+ <li>D) Real-time Endpoint ✓</li>
174
+ </ul>
175
+ <p><em>Explanation: Real-time Endpoints provide persistent, always-on inference with millisecond latency. Serverless has cold start delays, Async is asynchronous (not sub-100ms), and Batch Transform is for scheduled offline processing.</em></p>
176
+
177
+ <p><strong>Q2:</strong> A media company wants to run ML classification on 1 GB video files. Processing time is not urgent. Which SageMaker inference option is MOST appropriate?</p>
178
+ <ul>
179
+ <li>A) Real-time Endpoints</li>
180
+ <li>B) Serverless Inference</li>
181
+ <li>C) Async Inference ✓</li>
182
+ <li>D) Batch Transform</li>
183
+ </ul>
184
+ <p><em>Explanation: Async Inference supports payloads up to 1 GB and queues requests for processing, making it ideal for large media files. Real-time is limited to 6 MB payload, Serverless to 4 MB, and Batch Transform is for scheduled bulk predictions without real-time queue.</em></p>
185
+
186
+ <p><strong>Q3:</strong> A SaaS company provides individual ML models for each of their 10,000 enterprise customers. Hosting each on a separate endpoint is too expensive. What is the BEST solution?</p>
187
+ <ul>
188
+ <li>A) Merge all models into one large model</li>
189
+ <li>B) Use SageMaker Multi-Model Endpoints ✓</li>
190
+ <li>C) Deploy all models on a single Batch Transform job</li>
191
+ <li>D) Use Serverless Inference for each model</li>
192
+ </ul>
193
+ <p><em>Explanation: Multi-Model Endpoints (MME) host multiple models on a single endpoint, dynamically loading them into memory on-demand. This is exactly designed for multi-tenant scenarios where each customer has their own model, reducing infrastructure costs by orders of magnitude.</em></p>
@@ -0,0 +1,184 @@
1
+ ---
2
+ id: 5ffdff76-3b56-4c4f-9e66-f0aa1c6642d1
3
+ title: 'Bài 8: Model Monitoring & MLOps'
4
+ slug: bai-8-model-monitoring-mlops
5
+ description: >-
6
+ SageMaker Model Monitor: Data Quality, Model Quality, Bias Drift, Feature Attribution Drift.
7
+ SageMaker Pipelines cho CI/CD ML. Model Registry, Experiments.
8
+ Ground Truth cho data labeling. Autopilot cho AutoML.
9
+ duration_minutes: 60
10
+ is_free: true
11
+ video_url: null
12
+ sort_order: 8
13
+ section_title: "Phần 3: ML Implementation & Operations (20%)"
14
+ course:
15
+ id: 019c9619-lt02-7002-c002-lt0200000002
16
+ title: 'Luyện thi AWS Certified Machine Learning - Specialty'
17
+ slug: luyen-thi-aws-ml-specialty
18
+ ---
19
+
20
+ <div style="text-align: center; margin: 2rem 0;">
21
+ <img src="/storage/uploads/2026/04/aws-mls-bai8-mlops-pipeline.png" alt="SageMaker MLOps Pipeline" style="max-width: 800px; width: 100%; border-radius: 12px;" />
22
+ <p><em>SageMaker MLOps: Model Monitor, SageMaker Pipelines, và CI/CD cho ML workflows</em></p>
23
+ </div>
24
+
25
+ <h2 id="model-monitor"><strong>1. SageMaker Model Monitor</strong></h2>
26
+
27
+ <p><strong>SageMaker Model Monitor</strong> tự động monitor deployed models để phát hiện quality issues trong production. Đây là một trong các topics quan trọng nhất cho MLOps.</p>
28
+
29
+ <table>
30
+ <thead><tr><th>Monitor Type</th><th>What It Detects</th><th>Baseline From</th></tr></thead>
31
+ <tbody>
32
+ <tr><td><strong>Data Quality Monitor</strong></td><td>Statistical drift trong input features (mean, std, completeness)</td><td>Training data statistics</td></tr>
33
+ <tr><td><strong>Model Quality Monitor</strong></td><td>Model performance degradation (accuracy, F1 drop)</td><td>Ground truth labels</td></tr>
34
+ <tr><td><strong>Bias Drift Monitor</strong></td><td>Fairness metric shifts in predictions</td><td>Clarify baseline</td></tr>
35
+ <tr><td><strong>Feature Attribution Drift</strong></td><td>SHAP value changes — features changing importance</td><td>Clarify baseline</td></tr>
36
+ </tbody>
37
+ </table>
38
+
39
+ <blockquote>
40
+ <p><strong>Exam tip:</strong> Model Monitor cần <strong>baseline</strong> để compare against. Baseline được tạo từ training data khi deploy. Monitor chạy theo schedule (hourly/daily), so sánh incoming data với baseline và alert nếu drift vượt threshold.</p>
41
+ </blockquote>
42
+
43
+ <h3 id="drift-types"><strong>1.1. Types of Drift</strong></h3>
44
+
45
+ <pre><code class="language-text">Data Drift Types:
46
+
47
+ ┌─────────────────────────────────────────────────────┐
48
+ │ Covariate Shift (Input Drift): │
49
+ │ Input distribution P(X) changes │
50
+ │ Example: model trained on summer data, │
51
+ │ production gets winter data │
52
+ │ │
53
+ │ Concept Drift (Label Drift): │
54
+ │ Relationship P(Y|X) changes │
55
+ │ Example: fraud patterns evolve over time │
56
+ │ │
57
+ │ Prior Probability Shift: │
58
+ │ P(Y) class distribution changes │
59
+ │ Example: seasonal products change target balance │
60
+ └─────────────────────────────────────────────────────┘
61
+ </code></pre>
62
+
63
+ <h2 id="pipelines"><strong>2. SageMaker Pipelines — MLOps CI/CD</strong></h2>
64
+
65
+ <p><strong>SageMaker Pipelines</strong> là MLOps workflow orchestration tool — tạo reproducible, automatable ML pipelines.</p>
66
+
67
+ <pre><code class="language-text">SageMaker Pipeline Example:
68
+
69
+ ProcessingStep ──→ TrainingStep ──→ EvaluationStep ──→ ConditionStep
70
+ ↓ ↓ ↓ ↓
71
+ Clean Data Train Model Compute Metrics If accuracy > 0.85
72
+ Feature Eng Save Artifact to S3 ↓ ↓
73
+ Register Fail Pipeline
74
+ Model
75
+ </code></pre>
76
+
77
+ <table>
78
+ <thead><tr><th>Step Type</th><th>What It Does</th></tr></thead>
79
+ <tbody>
80
+ <tr><td><strong>ProcessingStep</strong></td><td>Data preprocessing via Processing Jobs</td></tr>
81
+ <tr><td><strong>TrainingStep</strong></td><td>Model training via Training Jobs</td></tr>
82
+ <tr><td><strong>EvaluationStep</strong></td><td>Model evaluation, compute metrics</td></tr>
83
+ <tr><td><strong>ConditionStep</strong></td><td>Branching logic based on metrics</td></tr>
84
+ <tr><td><strong>RegisterModelStep</strong></td><td>Register approved model to Model Registry</td></tr>
85
+ <tr><td><strong>TransformStep</strong></td><td>Batch Transform inference</td></tr>
86
+ </tbody>
87
+ </table>
88
+
89
+ <h2 id="model-registry"><strong>3. SageMaker Model Registry</strong></h2>
90
+
91
+ <p><strong>Model Registry</strong> là centralized catalog để track và govern ML models qua vòng đời của chúng.</p>
92
+
93
+ <table>
94
+ <thead><tr><th>Feature</th><th>Description</th></tr></thead>
95
+ <tbody>
96
+ <tr><td><strong>Model Groups</strong></td><td>Logical grouping các versions của cùng 1 model</td></tr>
97
+ <tr><td><strong>Approval Status</strong></td><td>PendingManualApproval → Approved → Rejected</td></tr>
98
+ <tr><td><strong>Model Lineage</strong></td><td>Track training job, data, artifacts for each version</td></tr>
99
+ <tr><td><strong>Deployment</strong></td><td>Deploy directly from Registry to endpoint</td></tr>
100
+ </tbody>
101
+ </table>
102
+
103
+ <h2 id="ground-truth"><strong>4. SageMaker Ground Truth</strong></h2>
104
+
105
+ <p><strong>Ground Truth</strong> giúp tạo <strong>high-quality labeled training datasets</strong> kết hợp human labelers và automated labeling.</p>
106
+
107
+ <pre><code class="language-text">Ground Truth Workflow:
108
+
109
+ Raw Data (S3) ──→ Labeling Job
110
+
111
+ ┌─── Auto Labeling ───┐
112
+ │ (ML model labels │
113
+ │ easy examples) │
114
+ │ │
115
+ └─── Human Labeling ──┘
116
+ (Mechanical Turk
117
+ or private team
118
+ for hard examples)
119
+
120
+ Labeled Dataset (S3)
121
+ </code></pre>
122
+
123
+ <h2 id="autopilot"><strong>5. SageMaker Autopilot — AutoML</strong></h2>
124
+
125
+ <p><strong>Autopilot</strong> automatically trains và tunes ML models — full AutoML với explainability.</p>
126
+
127
+ <table>
128
+ <thead><tr><th>What Autopilot Does</th><th>Detail</th></tr></thead>
129
+ <tbody>
130
+ <tr><td>Auto feature engineering</td><td>Detects data types, handles missing values, encoding</td></tr>
131
+ <tr><td>Algorithm selection</td><td>Tries multiple algorithms (XGBoost, Deep Learning, Linear)</td></tr>
132
+ <tr><td>Hyperparameter tuning</td><td>Bayesian optimization per algorithm</td></tr>
133
+ <tr><td>Explainability</td><td>SageMaker Clarify integration — SHAP values</td></tr>
134
+ <tr><td>Leaderboard</td><td>Ranked models by target metric</td></tr>
135
+ </tbody>
136
+ </table>
137
+
138
+ <blockquote>
139
+ <p><strong>Exam tip:</strong> Autopilot chỉ hỗ trợ <strong>tabular data</strong>. Khi đề hỏi "automate model building for non-technical users" → Autopilot. Khác với SageMaker JumpStart (pre-built models) và Canvas (no-code for business users).</p>
140
+ </blockquote>
141
+
142
+ <h2 id="cheat-sheet"><strong>6. Cheat Sheet — MLOps Services</strong></h2>
143
+
144
+ <table>
145
+ <thead><tr><th>Scenario</th><th>Service</th></tr></thead>
146
+ <tbody>
147
+ <tr><td>Detect data drift in production</td><td>SageMaker Model Monitor (Data Quality)</td></tr>
148
+ <tr><td>Automated ML pipeline CI/CD</td><td>SageMaker Pipelines</td></tr>
149
+ <tr><td>Track và govern model versions</td><td>SageMaker Model Registry</td></tr>
150
+ <tr><td>Label training data at scale</td><td>SageMaker Ground Truth</td></tr>
151
+ <tr><td>AutoML without coding</td><td>SageMaker Autopilot</td></tr>
152
+ <tr><td>Track experiments (metrics, params)</td><td>SageMaker Experiments</td></tr>
153
+ <tr><td>Model performance drop alert</td><td>Model Monitor + CloudWatch Alarms</td></tr>
154
+ </tbody>
155
+ </table>
156
+
157
+ <h2 id="practice"><strong>7. Practice Questions</strong></h2>
158
+
159
+ <p><strong>Q1:</strong> A deployed fraud detection model's accuracy dropped significantly after 3 months. Investigation shows the input feature distributions have changed. What tool should be used to automatically detect this going forward?</p>
160
+ <ul>
161
+ <li>A) SageMaker Clarify</li>
162
+ <li>B) SageMaker Experiments</li>
163
+ <li>C) SageMaker Model Monitor — Data Quality Monitor ✓</li>
164
+ <li>D) SageMaker Ground Truth</li>
165
+ </ul>
166
+ <p><em>Explanation: SageMaker Model Monitor's Data Quality Monitor continuously compares incoming inference data statistics against a baseline from training data. It detects feature drift (changed distributions) and sends CloudWatch alerts when thresholds are exceeded.</em></p>
167
+
168
+ <p><strong>Q2:</strong> A team wants to create a reproducible ML pipeline that automatically retrains and deploys a model when new data arrives, with a human approval step before production deployment. Which service provides this?</p>
169
+ <ul>
170
+ <li>A) SageMaker Autopilot</li>
171
+ <li>B) SageMaker Pipelines + Model Registry ✓</li>
172
+ <li>C) AWS Step Functions only</li>
173
+ <li>D) SageMaker Ground Truth</li>
174
+ </ul>
175
+ <p><em>Explanation: SageMaker Pipelines orchestrates the ML workflow (data prep → train → evaluate → register). Model Registry provides the approval workflow (PendingManualApproval → Approved) with human gate before deployment — the combination is the standard MLOps solution on AWS.</em></p>
176
+
177
+ <p><strong>Q3:</strong> A company needs to label 100,000 images for object detection training. They want to minimize labeling cost by using ML to automatically label easy examples. Which service should they use?</p>
178
+ <ul>
179
+ <li>A) SageMaker Autopilot</li>
180
+ <li>B) Amazon Rekognition Custom Labels</li>
181
+ <li>C) SageMaker Ground Truth with auto-labeling ✓</li>
182
+ <li>D) AWS Glue DataBrew</li>
183
+ </ul>
184
+ <p><em>Explanation: SageMaker Ground Truth uses automated labeling where an ML model labels high-confidence examples automatically, and only uncertain examples are sent to human workers. This can reduce labeling costs by up to 70%.</em></p>
@@ -0,0 +1,166 @@
1
+ ---
2
+ id: bb3d4aa7-2e63-49f6-a751-6323c5919325
3
+ title: 'Bài 9: Security & Cost Optimization'
4
+ slug: bai-9-security-cost
5
+ description: >-
6
+ IAM roles và policies cho SageMaker. VPC configuration, PrivateLink.
7
+ Encryption at rest (KMS) và in transit. Spot Training Instances.
8
+ S3 lifecycle policies cho ML data. Right-sizing instances.
9
+ duration_minutes: 45
10
+ is_free: true
11
+ video_url: null
12
+ sort_order: 9
13
+ section_title: "Phần 3: ML Implementation & Operations (20%)"
14
+ course:
15
+ id: 019c9619-lt02-7002-c002-lt0200000002
16
+ title: 'Luyện thi AWS Certified Machine Learning - Specialty'
17
+ slug: luyen-thi-aws-ml-specialty
18
+ ---
19
+
20
+ <div style="text-align: center; margin: 2rem 0;">
21
+ <img src="/storage/uploads/2026/04/aws-mls-bai9-security-architecture.png" alt="AWS ML Security Architecture" style="max-width: 800px; width: 100%; border-radius: 12px;" />
22
+ <p><em>Security trong AWS ML: IAM Roles, VPC isolation, KMS encryption, và tối ưu chi phí với Spot Instances</em></p>
23
+ </div>
24
+
25
+ <h2 id="iam-sagemaker"><strong>1. IAM for SageMaker</strong></h2>
26
+
27
+ <p>SageMaker sử dụng <strong>IAM Roles</strong> (không phải users) để thực hiện actions trên AWS resources. Đây là pattern bảo mật quan trọng trong đề thi.</p>
28
+
29
+ <table>
30
+ <thead><tr><th>Role Type</th><th>Used By</th><th>Needs Access To</th></tr></thead>
31
+ <tbody>
32
+ <tr><td><strong>Execution Role</strong></td><td>SageMaker Notebooks, Training Jobs, Endpoints</td><td>S3, ECR, CloudWatch, KMS</td></tr>
33
+ <tr><td><strong>SageMaker Studio Role</strong></td><td>Studio IDE users</td><td>Data, experiments, pipelines</td></tr>
34
+ <tr><td><strong>Training Job Role</strong></td><td>The training container itself</td><td>Input/output S3 buckets</td></tr>
35
+ </tbody>
36
+ </table>
37
+
38
+ <blockquote>
39
+ <p><strong>Exam tip:</strong> SageMaker training/inference containers KHÔNG có EC2 instance credentials — họ chạy với IAM Role cross-account. Luôn cần grant S3 và ECR permissions cho execution role.</p>
40
+ </blockquote>
41
+
42
+ <h2 id="vpc-security"><strong>2. VPC Configuration for SageMaker</strong></h2>
43
+
44
+ <p>Chạy SageMaker workloads trong <strong>VPC</strong> để đảm bảo traffic không đi qua public internet.</p>
45
+
46
+ <pre><code class="language-text">SageMaker Network Security:
47
+
48
+ Internet ──✗────────────────────────────────────────
49
+
50
+ ┌─── Private VPC ──────────────────────┐ │
51
+ │ │ │
52
+ │ SageMaker Training Instance │ │
53
+ │ ↓ (VPC Endpoint) │ │
54
+ │ ┌──── S3 Gateway Endpoint ────────┐ │ │
55
+ │ │ ECR VPC Endpoint │ │ │
56
+ │ │ SageMaker API VPC Endpoint │ │ │
57
+ │ └─────────────────────────────────┘ │ │
58
+ └───────────────────────────────────────┘ │
59
+ </code></pre>
60
+
61
+ <table>
62
+ <thead><tr><th>Feature</th><th>Description</th></tr></thead>
63
+ <tbody>
64
+ <tr><td><strong>VPC Endpoints (PrivateLink)</strong></td><td>Access S3, ECR, SageMaker API without internet</td></tr>
65
+ <tr><td><strong>Security Groups</strong></td><td>Control inbound/outbound traffic cho training instances</td></tr>
66
+ <tr><td><strong>Network Isolation</strong></td><td>Training job không có internet access (isolated mode)</td></tr>
67
+ <tr><td><strong>Inter-Container Encryption</strong></td><td>Encrypt distributed training traffic</td></tr>
68
+ </tbody>
69
+ </table>
70
+
71
+ <h2 id="encryption"><strong>3. Encryption</strong></h2>
72
+
73
+ <table>
74
+ <thead><tr><th>What</th><th>How</th><th>Service</th></tr></thead>
75
+ <tbody>
76
+ <tr><td><strong>S3 data at rest</strong></td><td>SSE-S3, SSE-KMS, SSE-C</td><td>S3 + KMS</td></tr>
77
+ <tr><td><strong>Model artifacts at rest</strong></td><td>KMS key cho output S3 bucket</td><td>KMS</td></tr>
78
+ <tr><td><strong>EBS volumes (training)</strong></td><td>KMS encryption for instance storage</td><td>KMS</td></tr>
79
+ <tr><td><strong>Data in transit</strong></td><td>TLS 1.2/1.3 for all API calls</td><td>Default</td></tr>
80
+ <tr><td><strong>Distributed training traffic</strong></td><td>Enable inter-container encryption</td><td>SageMaker config</td></tr>
81
+ </tbody>
82
+ </table>
83
+
84
+ <h2 id="cost-optimization"><strong>4. Cost Optimization Strategies</strong></h2>
85
+
86
+ <table>
87
+ <thead><tr><th>Strategy</th><th>Savings</th><th>How</th></tr></thead>
88
+ <tbody>
89
+ <tr><td><strong>Spot Instances</strong></td><td>Up to 90%</td><td>Training Jobs + checkpointing</td></tr>
90
+ <tr><td><strong>Right-sizing</strong></td><td>20-40%</td><td>Match instance type to actual GPU/CPU usage</td></tr>
91
+ <tr><td><strong>Serverless Inference</strong></td><td>Variable</td><td>Pay per invocation, no idle cost</td></tr>
92
+ <tr><td><strong>SageMaker Savings Plans</strong></td><td>Up to 64%</td><td>Commit to consistent usage</td></tr>
93
+ <tr><td><strong>S3 Intelligent-Tiering</strong></td><td>Variable</td><td>Auto-tier old training data</td></tr>
94
+ <tr><td><strong>Lifecycle Configurations</strong></td><td>Variable</td><td>Auto-stop idle notebooks</td></tr>
95
+ </tbody>
96
+ </table>
97
+
98
+ <h3 id="s3-lifecycle"><strong>4.1. S3 Lifecycle Policies cho ML Data</strong></h3>
99
+
100
+ <pre><code class="language-text">Data Lifecycle for ML:
101
+
102
+ Active Training Data (S3 Standard)
103
+ ↓ after 30 days unused
104
+ S3 Intelligent-Tiering
105
+ ↓ after 90 days
106
+ S3 Standard-IA (Infrequent Access)
107
+ ↓ after 180 days
108
+ S3 Glacier Instant Retrieval
109
+ ↓ after 1 year
110
+ S3 Glacier Deep Archive (compliance)
111
+ </code></pre>
112
+
113
+ <h2 id="compliance"><strong>5. Compliance Frameworks</strong></h2>
114
+
115
+ <table>
116
+ <thead><tr><th>Framework</th><th>Relevance for ML</th></tr></thead>
117
+ <tbody>
118
+ <tr><td><strong>HIPAA</strong></td><td>Healthcare ML — PHI data encryption, audit logging, BAA required</td></tr>
119
+ <tr><td><strong>GDPR</strong></td><td>EU data — right to erasure, data minimization, consent</td></tr>
120
+ <tr><td><strong>SOC 2</strong></td><td>Security controls audit for SaaS ML products</td></tr>
121
+ <tr><td><strong>PCI DSS</strong></td><td>Payment card data in ML models</td></tr>
122
+ </tbody>
123
+ </table>
124
+
125
+ <h2 id="cheat-sheet"><strong>6. Cheat Sheet — Security & Cost</strong></h2>
126
+
127
+ <table>
128
+ <thead><tr><th>Scenario</th><th>Solution</th></tr></thead>
129
+ <tbody>
130
+ <tr><td>SageMaker training with no internet</td><td>VPC + Network Isolation + VPC Endpoints</td></tr>
131
+ <tr><td>Encrypt training data on S3</td><td>SSE-KMS with customer-managed key</td></tr>
132
+ <tr><td>Reduce training cost by 70%+</td><td>Spot Instances + checkpointing</td></tr>
133
+ <tr><td>Auto-archive old training datasets</td><td>S3 Lifecycle Policies</td></tr>
134
+ <tr><td>Prevent notebook idle cost</td><td>Studio Lifecycle Config → auto-shutdown</td></tr>
135
+ <tr><td>Healthcare data (HIPAA)</td><td>KMS + VPC + CloudTrail + BAA with AWS</td></tr>
136
+ </tbody>
137
+ </table>
138
+
139
+ <h2 id="practice"><strong>7. Practice Questions</strong></h2>
140
+
141
+ <p><strong>Q1:</strong> A company needs SageMaker training jobs to access data in S3 without traversing the public internet for security compliance. What should they configure?</p>
142
+ <ul>
143
+ <li>A) VPC Flow Logs</li>
144
+ <li>B) SageMaker Training with VPC + S3 VPC Gateway Endpoint ✓</li>
145
+ <li>C) IAM policy with IP restriction</li>
146
+ <li>D) AWS Shield</li>
147
+ </ul>
148
+ <p><em>Explanation: Configuring SageMaker Training Jobs to run in a VPC, combined with an S3 VPC Gateway Endpoint, ensures all S3 traffic stays within the AWS network without going through the public internet.</em></p>
149
+
150
+ <p><strong>Q2:</strong> A machine learning team wants to reduce costs for long-running training jobs that can be interrupted. The jobs should resume from where they stopped. Which approach is MOST cost-effective?</p>
151
+ <ul>
152
+ <li>A) Use larger instances to finish faster</li>
153
+ <li>B) Use Reserved Instances</li>
154
+ <li>C) Use Spot Instances with checkpointing to S3 ✓</li>
155
+ <li>D) Run training locally</li>
156
+ </ul>
157
+ <p><em>Explanation: Spot Instances provide up to 90% cost savings. With checkpointing enabled (saving model state to S3 periodically), jobs can resume from the last checkpoint if interrupted, making Spot Instances practical for long training runs.</em></p>
158
+
159
+ <p><strong>Q3:</strong> Which AWS service provides centralized key management for encrypting SageMaker training data, model artifacts, and EBS volumes?</p>
160
+ <ul>
161
+ <li>A) AWS Secrets Manager</li>
162
+ <li>B) AWS IAM</li>
163
+ <li>C) AWS KMS (Key Management Service) ✓</li>
164
+ <li>D) AWS Certificate Manager</li>
165
+ </ul>
166
+ <p><em>Explanation: AWS KMS provides encryption key management for at-rest encryption of S3 data (SSE-KMS), EBS volumes used by training instances, and model artifacts. SageMaker integrates natively with KMS throughout the training and deployment workflow.</em></p>