简体   繁体   English

访问AWS VPC中的第二个EC2实例

[英]Access a second EC2 instance in AWS VPC

I've been looking around, but haven't been able to find much. 我一直在环顾四周,但找不到很多东西。 It all seems to assume that I'm trying to access a single EC2 instance under a VPC. 所有这些似乎都假设我正在尝试访问VPC下的单个EC2实例。

The scenario: We have one EC2 medium under a VPC which is hosting several websites (running Windows), and we need to launch a Linux EC2 under that same VPC to run a forum for one of the sites. 场景:我们在一个VPC下有一个EC2介质,该介质托管着多个网站(运行Windows),并且我们需要在同一VPC下启动Linux EC2,以便为其中一个站点运行一个论坛。 It's going to run at domain.com/forum where domain.com is hosted on the Windows server. 它要在domain.com/forum上运行,其中domain.com托管在Windows服务器上。 I'm going to try using a reverse proxy in IIS to get the forum, but we need to access it first. 我将尝试在IIS中使用反向代理来获取论坛,但是我们需要首先访问它。 Would a NAT instance be what I'm looking for? 我要寻找的是NAT实例吗?

Any ideas? 有任何想法吗?

You don't need a NAT. 您不需要NAT。 You would need a NAT only if you had only one server in the public subnet, and the other servers behind the private subnet. 仅当您在公共子网中只有一台服务器,而在私有子网之后又有其他服务器时,才需要NAT。 As you have already one server serving websites, I can assume you have a VPC with either public subnet or public subnet + private subnet. 因为您已经有一个服务器为网站服务,所以我可以假设您有一个带有公共子网或公共子网+私有子网的VPC。

For more info, see http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_NAT_Instance.html 有关更多信息,请参阅http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_NAT_Instance.html

Anyway, just launch your linux instance and make sure to configure your HTTPD (Apache VirtualHost or Nginx location) to respond to requests addressed to your domain subfolder correctly. 无论如何,只要启动您的Linux实例,并确保配置HTTPD(Apache VirtualHost或Nginx位置)以正确响应发送到您的域子文件夹的请求。

Start your linux instance in the same subnet as the windows instance. 在与Windows实例相同的子网中启动linux实例。 These two instances will be able to communicate using their local ips. 这两个实例将能够使用其本地ip进行通信。 The linux instance will get an IP and default gateway the same way your windows instance does(I'm assuming you are using an Internet Gateway in the VPC). linux实例将获得与Windows实例相同的IP和默认网关(我假设您在VPC中使用Internet网关)。 A reverse proxy can be set up in IIS and configured to use the private address of the linux instance. 可以在IIS中设置反向代理,并将其配置为使用Linux实例的专用地址。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM