问题原文
原帖链接 · and_apo · CC BY-SA 3.0
I have seen How to SSH to ec2 instance in VPC private subnet via NAT server and was able to SSH in an EC2 in a private subnet through a NAT instance with a public IP.
Assuming I want to install an application with a web interface like Zeppelin or Jupyter in the EC2 instance in the private subnet how would I configure secure access and connect to the web service through my browser in my laptop? I am fairly new to this area, so what would be the correct approach to enable this?
已采纳解答
原帖链接 · Fredi · CC BY-SA 3.0
You can use ssh with port forwarding.
let's say your EC2 instance's prvate IP is 10.1.1.1 and the web interface listens in port 80, your NAT host has a public IP 198.51.100.13, you can chain two successive forwards:
from your laptop:
ssh -L 8080:127.0.0.1:8080 [email omitted]
from the newly opened shell in your NAT host:
ssh -L 8080:10.1.1.1:80 [email omitted]
Now you can open a browser in your laptop and point it to:
http://127.0.0.1:8080
Actually you can configure your ssh client such as to automatically use a middle box. On your laptop, open ~/.ssh/config and tell ssh to pass through the NAT box when going to 10.1.1.1:
Host 10.1.1.1
ProxyCommand ssh -W %h:%p YOUR_NAT_HOSTS_IP
Now you can ssh directly from your laptop, and ssh will transparently open first a connection to the NAT box and then pass you to the EC2 instance.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
