After connecting succesfully to AWS on the latest iMac through Bash Script 1:
chmod 400 ~/PEM.pem ssh -i "~/PEM.pem" firstname.lastname@example.org jupyter notebook --no-browser --port=8888
Then opening a new bash script and entering in Bash Script 2:
ssh -i "~/PEM.pem" -L 8000:localhost:8888 email@example.com
Both the Ec2 commands and Python script (on localhost:8000 opened in Chrome) all work fine for about 30 minutes, then all of a sudden I get the error on the second bash script:
channel 3: open failed: connect failed: Connection refused
This message then repeats when I try to reconnect to localhost:8000 in Chrome, which I am not able to do. I've tried replacing localhost with 127.0.0.1, but have not been succesful.
Would anyone understand what the problem is, and how to possibly fix this? The objective is to use Python through EC2, which I have done successfully many times on other computers, but am now having problems.