title: Using the same preprocessing code for both training and inference in sagemaker
body: <p>I am working on building a machine learning pipeline for time series data where the goal is to retrain and update the model frequently to make predictions.</p>
  
  <ul>
  <li>I have written a preprocessing code that handles the time series variables and transforms them.</li>
  </ul>
  
  <p>I am confused about how to use the same preprocessing code for both training and inference? Should I write a lambda function to preprocess my data or is there any other way</p>
  
  <p><strong>Sources looked into:</strong></p>
  
  <p>The two examples given by the aws sagemaker team use AWS Glue to do the ETL tranform.</p>
  
  <p><a href="https://github.com/awslabs/amazon-sagemaker-examples/tree/master/advanced_functionality/inference_pipeline_sparkml_xgboost_abalone" rel="noreferrer">inference_pipeline_sparkml_xgboost_abalone</a></p>
  
  <p><a href="https://github.com/awslabs/amazon-sagemaker-examples/tree/master/advanced_functionality/inference_pipeline_sparkml_blazingtext_dbpedia" rel="noreferrer">inference_pipeline_sparkml_blazingtext_dbpedia</a></p>
  
  <p>I am new to aws sagemaker trying to learn, understand and build the flow. Any help is appreciated!</p>