Automate Retraining: Convert Notebook to Script in SageMaker Pipeline
A company wants to automate the retraining of a model weekly using new data. The training script is in a SageMaker notebook. Which implementation is most maintainable?
Quick Answer
The correct answer is to convert the notebook to a Python script, package it in a Docker container, and use SageMaker Pipelines with a schedule. This approach is most maintainable because it decouples the training logic from the interactive notebook environment, turning it into a reusable, version-controlled script that runs consistently inside a containerized environment. SageMaker Pipelines then orchestrates the entire workflow, and a schedule triggers retraining weekly without manual intervention. On the AWS Certified Machine Learning Specialty MLS-C01 exam, this question tests your understanding of moving from ad-hoc experimentation to production-grade automation. A common trap is choosing a Lifecycle Config to run the notebook directly, which is brittle and fails to isolate dependencies. Remember the memory tip: “Script it, containerize it, pipeline it, schedule it” — each step moves you further from notebook fragility toward a managed, repeatable retraining loop.
⚠ Common exam trap
Many candidates confuse Lifecycle Configurations (which are for one-time setup actions on notebook instances) with a scheduling mechanism, or assume that CloudFormation alone can handle recurring job scheduling without additional services.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Convert the notebook to a Python script, create a Docker container, and use SageMaker Pipelines with a schedule
It transforms the notebook into a production-grade, containerized training pipeline that can be scheduled natively via SageMaker Pipelines. This approach decouples the training logic from the notebook environment, ensures reproducibility through Docker, and leverages SageMaker's managed infrastructure for automated retraining without manual intervention.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Set up a cron job on an EC2 instance to run the training script
Why it's wrong here
Requires managing EC2 instances, less maintainable than serverless options.
- ✗
Schedule the notebook to run via a SageMaker Lifecycle Configuration script
Why it's wrong here
Lifecycle Config is for notebook instance initialization, not scheduling regular jobs.
- ✓
Convert the notebook to a Python script, create a Docker container, and use SageMaker Pipelines with a schedule
Why this is correct
Pipelines provide a robust, scheduled workflow for training.
- ✗
Use AWS CloudFormation to provision a training job on a schedule
Why it's wrong here
CloudFormation is for infrastructure, not scheduling recurring jobs.
Go deeper
Related to this question
About these practice questions
This MLS-C01 question is part of Courseiva's 1,672-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →
Same concept, more angles
2 more ways this is tested on MLS-C01
These questions test the same concept from different angles. Work through them to make sure you can recognise it however the exam phrases it.
Variation 1. A team wants to automate the retraining of a model weekly using new data that arrives in S3. Which combination of services should they use?
hard- A.AWS Lambda and S3 events
- B.Amazon SageMaker Processing jobs
- C.AWS Step Functions and AWS Glue
- ✓ D.Amazon SageMaker Pipelines and S3 events
Why D: Amazon SageMaker Pipelines natively supports automated retraining workflows triggered by S3 events. When new data arrives in S3, an event notification can invoke a Lambda function that starts a pipeline execution, which includes steps for data processing, training, evaluation, and model registration. This provides a fully managed, repeatable, and auditable MLOps pipeline without custom orchestration code.
Variation 2. A team needs to automatically retrain a model every week using new data. Which SageMaker feature is designed to schedule and automate this workflow?
easy- ✓ A.SageMaker Pipelines
- B.SageMaker Automatic Model Tuning
- C.SageMaker Model Monitor
- D.SageMaker Data Wrangler
Why A: SageMaker Pipelines enables building, automating, and scheduling end-to-end ML workflows, making it suitable for weekly retraining. Option A is correct. Option B, SageMaker Automatic Model Tuning, is for hyperparameter optimization, not scheduling. Option C, SageMaker Model Monitor, is for monitoring model quality and drift, not scheduling. Option D, SageMaker Data Wrangler, is for data preparation and feature engineering, not scheduling.
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This MLS-C01 practice question is part of Courseiva's free Amazon Web Services certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the MLS-C01 exam.