Can we run a python script in AWS Sagemaker using boto3 from a local machine?
Hi Folks
Here's what I am trying to do:
In my application that resides outside aws, I take some user inputs, and trigger scripts that are inside a Sagemaker notebook instance.
I am able to start or create a new instance using boto3, and also use lifecycle configuration to run some starter script while the instance turns on. But I want to run multiple scripts in short intervals based on user inputs, so I don't want to restart my instance each time with a new lifecycle configuration script. I am trying to find if there is a way to execute shell commands in sagemaker using boto3 (or any other way).
You may wonder why I am doing this. We are building a light weight auto ml type solution where the training scripts utilize sagemaker specific functionalities, so I thought it's simpler to keep them inside sagemaker. But I am facing a tough time dealing with talking to these scripts from outside aws eco-system.
Posted Mar 9, 2022, 10:43 AM UTC
Notebooks can be parameterized and run, check out papermill or ploomber.
The solution I can think of is make a docker image of your stuff and trigger a sagemaker processing job passing the parameters to the script via environment variables.