Based on the MLA-C01 exam guideReport an error
If every code change means a person reruns the pipeline in a notebook, clicks the approval button, and updates the endpoint by hand, it is still manual operation. Traditional software CI/CD is code push → build → test → deploy, but in ML there is an added axis of data and models.
| Category | Traditional software CI/CD | ML CI/CD |
|---|---|---|
| Input | Code | Code + data |
| Build artifact | Binary or image | Trained model artifact |
| Testing | Unit and integration tests | Tests + model evaluation metric gate |
| Approval target | Release candidate | Model version (Registry) |
| What triggers a rerun | Code change | Code change + data change, drift, schedule |
💡 Related theory: The core idea of ML CI/CD is "make model deployment version-managed, automated, and rollback-capable like software deployment." Code, data, and models are all tracked, changes lead to automatic triggers, and when a problem occurs you must be able to go back to a previous version. In the exam, a flow of "Git commit → automatic retraining and deployment" points to the combination of SageMaker Projects + Code* services.
SageMaker Projects provisions the CI/CD infrastructure that MLOps needs as a preconfigured template (Service Catalog based). When you create a project, the following are created all at once.
| Resource created | Role |
|---|---|
| Source code repository (CodeCommit or Git) | Preprocessing, training, and deployment code |
| Build pipeline (CodePipeline + CodeBuild) | On a code change, runs the SageMaker Pipeline → registers the model |
| Deploy pipeline (CodePipeline) | On model approval, deploys to the staging/production endpoints |
| Model Registry group | Catalog of trained model versions |
| EventBridge rules | Triggers that detect code push and model approval events |
┌──────────── CI (code axis) ────────────┐
Developer git push
│
▼
CodeCommit / Git repository
│ (push event)
▼
CodePipeline(Build) ──▶ CodeBuild (buildspec.yml)
│
▼
SageMaker Pipeline run
preprocessing → training → evaluation → ConditionStep
│ passed
▼
RegisterModel → Model Registry
(PendingManualApproval)
─────────────────────────────────────────────────
┌──────────── CD (model axis) ────────────┐
Reviewer changes it to Approved
│
▼
EventBridge "Model Package State Change"
│
▼
CodePipeline(Deploy)
│
┌─────────────┴─────────────┐
▼ │
CloudFormation → staging endpoint │
▼ │
automated tests pass │
▼ │
ManualApproval action (human check) ──┘
▼
CloudFormation → production endpointThe key point is that the triggers above and below the dividing line are different. The one above is a code push, and the one below is model approval.
| Comparison axis | Build pipeline | Deploy pipeline |
|---|---|---|
| What it centers on | Code | Model version |
| Trigger | Code push to the repository | Registry approval (Approved) event |
| What it does | Runs the SageMaker Pipeline → training, evaluation, registration | Creates/updates the endpoint |
| Main execution tool | CodeBuild (buildspec.yml) | CloudFormation stack deployment |
| Output | A new model version in the Registry | Staging and production endpoints |
| Human involvement | Usually none | Manual approval gate just before production |
| CI/CD category | CI | CD |
1) Build (model build) pipeline — code-centric
PendingManualApproval2) Deploy (model deploy) pipeline — model-centric
ApprovedClearly separating what each service is responsible for is an exam point.
| Service | Role | Easily confused point |
|---|---|---|
| CodeCommit | Git source repository (code version control) | It only stores. It does not execute |
| CodeBuild | Build and test execution environment (commands defined in buildspec.yml) | The only compute that actually runs commands |
| CodePipeline | Orchestrator that links the stages (source → build → deploy flow) | It does not build directly. It manages the order |
| CloudFormation | Deploys infrastructure such as endpoints as code | The executor of deployment. Also the unit of rollback |
| EventBridge | Triggers based on events (code push, model approval) | Not a workflow but a start signal |
CodeBuild's work is defined in buildspec.yml. For example, the build phase that runs a SageMaker Pipeline looks like this.
# buildspec.yml — defines the commands CodeBuild will run
version: 0.2
phases:
install:
runtime-versions:
python: 3.11
commands:
- pip install -r requirements.txt
build:
commands:
# On a code change, create/update the SageMaker Pipeline and run it
- python pipelines/run_pipeline.py --upsert
- python pipelines/run_pipeline.py --startThe heart of CD is the model approval event you learned yesterday. When the approval status changes in the Model Registry, EventBridge catches it and starts the Deploy pipeline.
import boto3
events = boto3.client("events")
# A rule that triggers the Deploy pipeline when the model approval status changes to Approved
events.put_rule(
Name="trigger-deploy-on-approval",
EventPattern="""{
"source": ["aws.sagemaker"],
"detail-type": ["SageMaker Model Package State Change"],
"detail": {
"ModelApprovalStatus": ["Approved"]
}
}""",
)If you set this rule's target to the Deploy CodePipeline, deployment rolls automatically the moment a person approves the model. After staging validation and before production deployment, adding one more manual approval action is the safe pattern.
# CodePipeline stage example (conceptual): staging → manual approval → production
# 1. DeployStaging (create the staging endpoint with CloudFormation)
# 2. ApprovalGate (a person checks the staging results and approves)
# 3. DeployProd (deploy the production endpoint)The staged deployment of staging → manual approval → production in CI/CD follows the principle of "minimizing the blast radius." If you validate a new model in staging rather than putting it straight into production, and then pass it through a gate, defects are filtered out before they reach users. In the exam, a sentence like "to deploy automatically but safely while keeping control just before production" points to CodePipeline's manual approval action.
⚠️ Trap: "Automatic deployment on model approval" and "human confirmation just before production" are not contradictory. Approval happens twice — the first is the Registry's
Approved(the decision to put the model into the deployment flow), and the second is CodePipeline's ManualApproval action (the decision to send it to production after seeing the staging validation results). Answer choices that lump these two into one are often wrong.
You can produce the same result by wiring CodePipeline, CodeBuild, and EventBridge together yourself without SageMaker Projects.
| Comparison axis | SageMaker Projects | Direct setup |
|---|---|---|
| Speed of adoption | Immediate through template provisioning | You must wire services one by one |
| Standardization | Reuse and governance across the organization through Service Catalog | Tends to become different for every team |
| Flexibility | Customizable within the scope of the template | No constraints |
| Integration with existing CI/CD | A new skeleton is laid down | Easy to attach to an existing pipeline |
| Exam keyword | "Quickly standardize MLOps, template" | "Integrate with existing CI/CD, non-standard requirements" |
Either way, what triggers retraining has to be designed separately. A code push alone cannot catch situations where the data changes.
| Retraining trigger | Implementation | Suitable situation |
|---|---|---|
| Code change | Repository push → Build pipeline | When you changed the algorithm or feature logic |
| Regular schedule | EventBridge cron rule | Services where data accumulates steadily |
| New data arrival | S3 event → EventBridge | When batches arrive irregularly |
| Quality degradation detected | Monitoring alarm → pipeline run | When performance dropped because of drift |
| Symptom | Common cause | Action |
|---|---|---|
| You pushed code but nothing happens | Source stage branch mismatch, trigger disabled | Check the pipeline's source branch and detection settings |
| You approved but the Deploy pipeline does not run | EventBridge pattern typo, target not connected, rule disabled | Inspect the event pattern, target, and rule state |
| CodeBuild fails as soon as it starts | buildspec.yml location or syntax error, runtime version mismatch | Check the buildspec path at the repository root and the phase syntax |
| The build is denied when creating a SageMaker job | The CodeBuild role lacks SageMaker permissions or iam:PassRole | Grant the build role PassRole on the target execution role |
| Staging works but production does not go out | Waiting at the manual approval action | Set the approvers and notification targets, then approve |
| The deployment stack fails midway and rolls back | Endpoint configuration error, insufficient capacity, name collision | Check the failed resource in the CloudFormation event log |
| A wrong model went to production | The status was set straight to Approved at registration | Register as PendingManualApproval + restore the review gate |
| Rollback takes a long time | The previous version's information is not managed separately | Redeploy using the Registry's previous approved version ARN |
CI/CD failures are mostly one of three: trigger, permission, or definition. If nothing happens, it is the trigger; if it starts but is denied midway, it is permissions; if it runs to the end but the result is wrong, it is a definition (buildspec, template) problem. Narrowing down in this order means you do not have to dig through all the logs.
Tomorrow we compare IaC, which manages the very infrastructure that supports this deployment as code, with orchestrators that reach beyond SageMaker.
Click a choice to reveal the answer and explanation.
Question 1
An ML team wants to provision the source repositories, build/deploy pipelines, and Model Registry needed for MLOps all at once from a preconfigured template. What is most suitable?
Question 2
In the standard SageMaker Projects structure, which pipeline does a "code push" trigger and which does a "model approval" trigger?
Question 3
Which file defines the commands CodeBuild actually runs (dependency installation, pipeline execution, etc.)?
Question 4
You want to automatically start a deployment pipeline when a model changes to Approved in the Registry. Which combination of services handles event detection and triggering?
Question 5
You want to automatically deploy a new model to production, but have a person take control once, after staging validation and right before it goes to production. What is the most appropriate method?