- Before starting, see my previous post from here
- SSH tunnels allow you to connect to ports on a remote server through the encrypted SSH channel.
- This allows you to securely connect to ports on the remote server that you otherwise wouldn't be able to because of system firewall, or security group rules.
- In this post, you will establish an SSH connection with a tunnel from port 8000 to port 8888 on the remote server.
- This tunnel will allow you to connect from instance public IP to the Jupyter notebook server.
Connect to your EC2 Instance:
Enter the following command and press Enter:
ssh -i key.pem ubuntu@localhost -fN -L 0.0.0.0:8000:127.0.0.1:8888
The -fN creates the tunnel in the background and the 0.0.0.0 tells it to listen on all interfaces instead of only 127.0.0.1/localhost so you can connect from the public IP
Enter yes to establish the connection:
Now, you connected to the remote server and established an SSH tunnel to forward a port on the remote server.