1

目前我有一个运行 Apache / MySQL 服务器的 EC2 实例。我想要做的是将它们分开,为每台服务器留下一台机器。我考虑将我当前的公共 EC2 实例(仅限 Apache)连接到一个 VPC 实例,其中的 MySQL 服务器只能从我的 EC2 私有 IP 地址访问。但我似乎无法连接。

这可能吗?或者我运行 Apache 的机器也必须是 VPC 实例?

谢谢你的帮助。

4

2 回答 2

1

This isn't directly possible, because the private address space used by EC2-Classic instances is completely unrelated to -- and isolated from -- the private address space used within any given VPC.

The only way to accomplish this is by exposing the VPC instance running MySQL to the Internet so that your "external" (from the VPC perspective) EC2 instance can connect to it, with an elastic IP or by some other mechanism like proxying through another VPC-based instance that is Internet-accessible... this would amount to a potential security issue, and more things to go wrong with your assessment.

Splitting your web server and database is highly advisable, since neither Apache and MySQL are designed with hard caps on resource consumption, and they don't always play well together on the same server, when resources (like memory) get tight.

But I would suggest that even though it's indirectly possible by way of some proxying and port translating gyrations, moving both machines inside VPC would be the way to go.

于 2014-01-14T00:41:07.313 回答
1

我认为您应该将两个 EC2 实例放在同一个 VPC 中,并且只为运行 Apache 的那个分配一个弹性 IP。

于 2014-01-13T20:39:10.260 回答