linuxwindowsbashamazon-web-servicesamazon-sagemaker

How do you write lifecycle configurations for SageMaker on windows?


I'm trying to set up a startup lifecycle configuration for a SageMaker sketchbook (which just ends up being a .sh file), and it seems like, regardless of what I do, my notebooks timeout on startup. I simplified everything as much as possible, to the point of commenting out all but #!/bin/bash, and I still get a timeout. Checking cloudwatch this shows up in the log:

/bin/bash: /tmp/OnStart_2020-08-11-07-01jgfhhkwa: /bin/bash^M: bad interpreter: No such file or directory

through testing, I also found that if I add a carriage return before #!/bin/bash I get this in the log:

/tmp/OnStart_2020-08-11-06-444y3fobzp: line 1: $'\r': command not found

based on this on the \r error, and this on the ^M error, this seems to be an incompatibility between windows and unix formatted text. However, I'm editing the lifecycle configuration through aws on my windows machine:

screenshot of editing the lifecycle config

is there some way that I can edit this field on my windows machine through AWS, but it be properly written in unix on the other end?


Solution

  • This is, indeed, to do with special character representation in different os' based on this you can use notepad++ to easily convert the dos representation a unix representation, then just "paste as plain text", and it works fine

    Doing this fixed the problem