'How to copy notebooks between different Sagemaker instances?
My search didn't yield anything useful so I was wondering if there is any easy way to copy notebooks from one instance to another instance on Sagemaker? Of course other than manually downloading the notebooks on one instance and uploading to the other one!
Solution 1:[1]
Thank you for using Amazon SageMaker.
Unfortunately the way suggested is only way of sharing notebooks between Notebook Instances.
Let us know if there is any other way we can be of assistance.
Solution 2:[2]
I might be late to the show, but I had recently to deal with copying the contents of a Sagemaker notebook to a different notebook. This problem may become urgent for users of Sagemaker notebooks on amazon Linux 1 (al1) platform. Such notebooks have 'notebook-al1-v1' platform identifier. Amazon announced that "Amazon SageMaker Notebook Instance is ending its standard support on Amazon Linux AMI (AL1)" on April 22, 2022.
Now, what are the steps needed to copy of file from one Sagemaker instances to a different one. Or, put it differently, how to synchronize EBS volume attached to one instance (let's call it A) to instance B.
Amazon published a step-by-step explanation how to do it. The idea is first to synchronize EBS volume of notebook A to a specially created AWS s3 bucket, and second to synchronize contents of that s3 bucket to notebook B. I followed instructions in the post, and it didn't work for me )). I later discovered that the script 'on_start.sh' in 'migrate-ebs-data-backup' provided in Amazon solution has some issues with s3 bucket creation.
Personally I found that rather than do what the Amazon post recommends it's much easier to create the ad hoc basket (let's call it 'ebs-data-backup') manually via console and then:
launch Terminal of notebook A and enter the following code, which will synchronize contents of notebook A to bucket 'ebs-data-backup'
$ cd /home/ec2-user/SageMaker
$ BUCKET_NAME=ebs-data-backup
$ TIMESTAMP=date +%F-%H-%M-%S
$ SNAPSHOT=${NOTEBOOK_NAME}_${TIMESTAMP}
$ aws s3 sync --exclude "/lost+found/" /home/ec2-user/SageMaker/ s3://${BUCKET_NAME}/${SNAPSHOT}/Start notebook B, launch Terminal in notebook B and enter the following code:
$ cd /home/ec2-user/SageMaker
$ aws s3 sync s3://${BUCKET_NAME}/${SNAPSHOT}/ /home/ec2-user/SageMaker/`
in notebook B use the same values for BUCKET_NAME and SNAPSHOT as in notebook B
echo "THAT SHOULD BE IT. HOPE IT HELPS"
Solution 3:[3]
an easy way to transfer can be to tar (zip like) the file on one instance and download. Upload in the new instance and then untar.
tar --help
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Pranav Chiplunkar |
| Solution 2 | |
| Solution 3 | EdL |
