tim_xyz
tim_xyz

Reputation: 13481

Create a txt file with Sagemaker Lifecycle Configuration script

I'm unable to get Sagemaker Lifecycle Configuration to create a plain .txt file in the directory with my jupyter notebooks when the sagemaker notebook starts.

In the future I'll add text to this file, but creating the file is the first step.

Start notebook script:

#!/bin/bash

set -e

touch filename.txt

Note: I have edited my notebook to add this lifecycle configuration.

But when the notebook starts and I open it, the file does not exist. Is this possible?

Upvotes: 1

Views: 803

Answers (2)

Jaipreet
Jaipreet

Reputation: 312

The working directory of the Lifecycle Configuration script is "/" and Jupyter starts up from the "/home/ec2-user/SageMaker" directory. So, if you create a file outside "/home/ec2-user/SageMaker", it will not be visible inside the Jupyter file browser.

To address this, you can modify your script to

touch /home/ec2-user/SageMaker/filename.txt

Thanks for using Amazon SageMaker!

Upvotes: 1

Binil Jacob
Binil Jacob

Reputation: 501

enter image description here

You are creating the file in the root directory.

Use the terminal option of your notebook to explore enter image description here

Upvotes: 1

Related Questions