出站规则本身是哪个目的地?

Outbond rule which destination is itself?

我发现了以下出站规则,目的地本身在一个安全组中

sg-012345 - rule x

Outbound rules
Type         Protocol Port range  Destination
..... other rules
All traffice All      All         sg-012345 (rule x)
..... other rules

这条规则的目的是什么?

那叫self-referencing rule

通过创建self-referencing rule,您可以将源限制在同一个安全组中,而不是对所有网络开放。您的 VPC 的默认安全组可能已经具有针对所有流量的自引用入站规则

Inbound Self Referencing:

这意味着如果资源(例如 EC2)具有此安全组(sg-012345)可以接受来自任何其他具有此安全性的资源(例如 EC2)的流量。

Rules to connect to instances from an instance with the same security group

Outbound Self Referencing:

这意味着如果资源(例如 EC2)具有此安全组(sg-012345)可以将流量发送到也具有此安全性的任何其他资源(例如 EC2)。

例如,您可能希望允许访问 Internet 进行软件更新,但限制所有其他类型的流量。您必须先删除允许所有出站流量的默认出站规则。

还有一件更重要的事情叫做connection tracking

Security groups are stateful—if you send a request from your instance, the response traffic for that request is allowed to flow in regardless of inbound security group rules. For VPC security groups, this also means that responses to allowed inbound traffic are allowed to flow out, regardless of outbound rules. For more information, see Connection tracking.

例如,在这种情况下 Setting Up a VPC to Connect to JDBC Data Stores 您可以看到这两个规则如何发挥作用。