无法通过 public ip 地址在同一安全组中的两个 EC2 实例之间进行通信?

Can't communicate between two EC2 instances in the same security group via public ip address?

我无法使用 public ip 连接到同一安全组中的另一个 EC2 实例。

如果我尝试使用 public DNS 名称和私有 ip 进行连接,工作正常

到目前为止我做了什么:

当您使用 public IP 时,流量离开您的 VPC 并返回,此时它不再被识别为来自该安全组。那时它看起来就像随机的互联网流量。为了安全和速度,坚持使用私有 IP。

来自docs

When you specify a security group as the source for a rule, traffic is allowed from the network interfaces that are associated with the source security group for the specified protocol and port. Incoming traffic is allowed based on the private IP addresses of the network interfaces that are associated with the source security group (and not the public IP or Elastic IP addresses).