p_mcp
p_mcp

Reputation: 2801

How do I download files within a Sagemaker notebook instance programatically?

We have a notebook instance within Sagemaker which contains many Jupyter Python scripts. I'd like to write a program which downloads these various scripts each day (i.e. so that I could back them up). Unfortunately I don't see any reference to this in the AWS CLI API.

Is this achievable?

Upvotes: 3

Views: 14883

Answers (3)

Himangshu
Himangshu

Reputation: 11

I know this is very late to the party, but wanted to add another quick option for doing this. In the git dropdown from the repositories tab in the notebook, there is an option to open git in the console, which essentially gives you access to the terminal of the instance where the notebook is running. The terminal very conveniently comes with AWS CLI pre-installed. From there you can just use the AWS CLIs to upload everything to an S3 bucket. Once you have it in S3, your options are endless. Hope this helps.

Upvotes: 1

Sheykhmousa
Sheykhmousa

Reputation: 199

Semi automatic way:

conda install -y -c conda-forge zip
!zip -r -X folder.zip folder-to-zip

Then download that zipfile.

Upvotes: 4

El Ruso
El Ruso

Reputation: 15901

It's not exactly that you want, but looks like VCS can fit your needs. You can use Github(if you already use it) or CodeCommit(free privat repos) Details and additional ways like sync target dir with S3 bucket - https://aws.amazon.com/blogs/machine-learning/how-to-use-common-workflows-on-amazon-sagemaker-notebook-instances/

Upvotes: 2

Related Questions