hands-on lab

Using SageMaker Notebooks to Train and Deploy Machine Learning Models

Up to 1h
Get guided in a real environmentPractice with a step-by-step scenario in a real, provisioned environment.
Learn and validateUse validations to check your solutions every step of the way.
See resultsTrack your knowledge and monitor your progress.


Amazon SageMaker notebooks provide a fully-managed environment for machine learning and data science development. You will use a SageMaker notebook instance to train and deploy a machine learning model using Python. You will go through the process of preparing raw data for use with machine learning algorithms. Then you will use a built-in SageMaker algorithm to train a model using the prepared data. Lastly, you will use SageMaker to host the trained model and learn how you can make real-time predictions using the model.

Lab Objectives

Upon completion of this Lab you will be able to:

  • Use SageMaker notebook instances to run Jupyter Notebooks
  • Write code using the Python Data Analysis Library (pandas) and the SageMaker Python SDK to:
    • train models using built-in SageMaker algorithms
    • Create SageMaker models
    • Deploy SageMaker endpoints to get real-time inferences from your models

Intended Audience

This lab is intended for:

  • Anyone interested in using SageMaker to build and deploy machine learning models in code


You should be familiar with:

  • Some knowledge of machine learning concepts is beneficial, but not required
  • Basic programming using Python 3
  • Completion of the Forecast Flight Delays with Amazon SageMaker lab is recommended for a deeper understanding of the data used in this lab 
  • Basic S3 concepts


September 7th, 2023 - Resolved an issue installing package dependencies in the lab notebook

June 17th, 2023 - Resolved training job issue

January 10th, 2022 - Updated notebook to ensure dependencies are up to date

December 2nd, 2020 - Updated code to be compliant with the SageMaker v2 library; Modified code to prevent training job name collisions

Environment before

Environment after

About the author

Logan Rakai, opens in a new tab
Lead Content Developer - Labs
Learning paths

Logan has been involved in software development and research since 2007 and has been in the cloud since 2012. He is an AWS Certified DevOps Engineer - Professional, AWS Certified Solutions Architect - Professional, Microsoft Certified Azure Solutions Architect Expert, MCSE: Cloud Platform and Infrastructure, Google Cloud Certified Associate Cloud Engineer, Certified Kubernetes Security Specialist (CKS), Certified Kubernetes Administrator (CKA), Certified Kubernetes Application Developer (CKAD), and Certified OpenStack Administrator (COA). He earned his Ph.D. studying design automation and enjoys all things tech.

LinkedIn, Twitter, GitHub

Covered topics

Lab steps

Logging In to the Amazon Web Services Console
Opening JupyterLab on Your SageMaker Notebook
Working Through the Lab's JupyterLab Notebook