大网数据广告活动
服务器运维问答

Securely Access Web Interfaces on Amazon EC2 Launched in a Private Subnet

· 52CE 我爱测

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…

问题原文

原帖链接 · 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.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2016-11-30)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。