I don’t know of any easy solution but there is a nice alternative. You could convert the notebook to a python file and then use
screen to open a new terminal session. Then you could run the python file using ipython and exit aws.
When you reconnect to aws you can resume the relevant screen and you can see the ipython session running.
To be more specific on the usage of
screen. To start a new
screen session use
screen -S some_screen_name
Activate the conda environment. Start ipython. Do
Press ctrl-a d to detach the screen.
Now you can easily disconnect from the aws server. Once you reconnect do
screen -r some_screen_name
And voila you have the ipython session still running.
The same thing could be applied to jupyter notebook as well for the jupyter token etc. However for reconnecting the kernel, I am not aware of any easy solution.