So I've got an ec2 instance that I can only access through a bastion.
The ec2 instance serves my jupyter server on 127.0.0.1:8888/?token=$token
The goal in mind that I have is to run an ssh tunnel command that will listen for connections on 127.0.0.1:8888
, and forward them through the bastion to my ec2 instance to 127.0.0.1:8888
I've tried the following with no luck.
from local:
(I can ssh into both the bastion and the ec2 machine through the bastion without issue)
ssh -f -N -L 127.0.0.1:8888:127.0.0.1:8888 -i ~/.ssh/id_rsa $user@$bastion_dns
ssh -f -N -L 8888:127.0.0.1:8888 -i ~/.ssh/id_rsa $user@$bastion_dns
ssh -f -N -L 8888:$ec2_private_ip:8888 -i ~/.ssh/id_rsa $user@$bastion_dns
from bastion:
(I opened 8888 ingress on bastion security group and added bastion ssh key to ec2-machine so that I can ssh to ec2 regularly from the bastion)
ssh -f -N -L 8888:127.0.0.1:8888 $user@$ec2_private_ip