AWS 安全组包括另一个安全组

AWS Security group include another Security Group

来自文档:http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-network-security.html#security-group-rules

Source or destination: The source (inbound rules) or destination (outbound rules) for the traffic. Specify one of these options:

(...)

Another security group. This allows instances associated with the specified security group to access instances associated with this security group. This does not add rules from the source security group to this security group. You can specify one of the following security groups:

The current security group.

有人试过吗?

我创建了 2 个盒子 BoxA,BoxB。我创建了一个安全组 GroupA,在端口“所有端口”上从源 GroupA 入站。如果我尝试从 BoxA 到端口 9000 上的 telnet BoxB,而 BoxB 在端口 9000 上有一个 simpleHttpServer,我什么也得不到。

我哪里做错了?

我找到了答案:

需要使用私有 IP 或将 public 个 IP 列入白名单。我希望它在文档中有所描述。

我对在添加新规则时在源(入站规则)和目标(出站规则)中添加另一个安全组到底意味着什么感到困惑。我发现下面给出的解释(来源:https://docs.aws.amazon.com/vpc/latest/userguide/VPC_SecurityGroups.html#SecurityGroupRules)非常有用。

"当您将安全组指定为规则的源时,允许来自与指定协议和端口的源安全组关联的网络接口的流量。允许传入流量基于与源安全组关联的网络接口的私有 IP 地址(而不是 public IP 或弹性 IP 地址)。将安全组添加为源不会添加来自源安全组的规则."

我也 运行 解决了这个问题,发现将 public IP 添加到另一个安全组然后选择该安全组作为源无效。

我找到了解决方法,您可以允许多个安全组访问一个 EC2,这对我很有效。