I have seen answers to this question and the answer is always that these files are located in
/home/ec2-user/Sagemaker/
however when I’m in Terminal in Sagemaker Studio I don’t see this. It seems that Sagemaker Studio has a different directory than whichever Sagemaker service other askers are using. This is what my command line looks like when I do pwd
in the directory:
sagemaker-user@studio$ pwd
/home/sagemaker-user/sagepipeline_nonomethod/source_dir
sagemaker-user@studio$
When I do
os.chdir('/home/sagemaker-user/sagepipeline_nonomethod/source_dir')
inside my jupyter notebook however I get an error that says there is no such directory. So there must be some prefix to the directory that I am missing…
2
Answers
This occurs because your files and notebooks in SageMaker Studio exist separately to the machine running the kernel to execute your code.
SageMaker Studio is, in essence, just a theme for Jupyter with a few added features. In the below diagram, you can see that your Studio interface and files are hosted by the "JupyterServer App", while the instances that execute your code are separate machines running containers.
The Amazon SageMaker Studio Notebooks documentation provides a helpful overview of this architecture. See the diagram below.
Your question appears to be specific to an issue you’re having, however. If you create a cell in your notebook and execute
!pwd
and!ls
, you should find that the files available match those in the SageMaker Studio sidebar.In short, you should be able to access the directory at
/root/sagepipeline_nonomethod/source_dir
within your notebook. Explaination follows:If you open a terminal in the Launcher under Utilities and files, you will arrive at a system terminal. It’s the compute environment living in SageMaker Studio, instead of the container where your notebook (kernel) lives.
The
/home/sagemaker-user
directory is a mountpoint of an EFS, where your Jupyter file browser points to.To access the terminal of the container environment, go to Launcher > Notebooks and compute resources > Open image terminal
The same EFS is mounted on
/root