

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# AWS.Networking.SecurityGroupEgressRule
<a name="node-networking-security-group-egress-rule"></a>

AWS TNB 支援安全群組輸出規則，以自動佈建可連接到 AWS.Networking.SecurityGroup 的 Amazon EC2 安全群組輸出規則。請注意，您必須提供 cidr\$1ip/destination\$1security\$1group/destination\$1prefix\$1list 作為輸出流量的目的地。

## 語法
<a name="node-networking-security-group-egress-rule-syntax"></a>

```
AWS.Networking.SecurityGroupEgressRule
  properties:
    ip\$1protocol: String
    from\$1port: Integer
    to\$1port: Integer
    description: String
    destination\$1prefix\$1list: String
    cidr\$1ip: String
    cidr\$1ipv6: String
  requirements:
    security\$1group: String
    destination\$1security\$1group: String
```

## 屬性
<a name="node-networking-security-group-egress-rule-properties"></a>

 `cidr_ip`    
CIDR 格式的 IPv4 地址範圍。您必須指定允許輸出流量的 CIDR 範圍。  
必要：否  
類型：字串

 `cidr_ipv6`    
CIDR 格式的 IPv6 地址範圍，用於輸出流量。您必須指定目標安全群組 (`destination_security_group` 或 `destination_prefix_list`) 或 CIDR 範圍 (`cidr_ip` 或 `cidr_ipv6`)。  
必要：否  
類型：字串

 `description`    
輸出 (傳出) 安全群組規則的描述。您最多可以使用 255 個字元來描述規則。  
必要：否  
類型：字串

 `destination_prefix_list`    
現有 Amazon VPC 受管字首清單的字首清單 ID。這是來自與安全群組相關聯之節點群組執行個體的目的地。如需受管字首清單的詳細資訊，請參閱《*Amazon VPC 使用者指南*》中的[受管字首清單](https://docs.aws.amazon.com/vpc/latest/userguide/managed-prefix-lists.html)。  
必要：否  
類型：字串

 `from_port`    
如果通訊協定是 TCP 或 UDP，這是連接埠範圍的開頭。如果通訊協定是 ICMP 或 ICMPv6，這是類型編號。值 -1 表示所有 ICMP/ICMPv6 類型。若您指定所有 ICMP/ICMPv6 類型，您必須指定所有 ICMP/ICMPv6 代碼。  
必要：否  
類型：整數

 `ip_protocol`    
IP 通訊協定名稱 (tcp、udp、icmp、icmpv6) 或通訊協定編號。使用 -1 指定所有通訊協定。授權安全群組規則時，指定 tcp、udp、icmp 或 icmpv6 以外的 -1 或通訊協定號碼，允許所有連接埠上的流量，無論您指定的任何連接埠範圍為何。對於 tcp、udp 和 icmp，您必須指定連接埠範圍。對於 icmpv6，連接埠範圍是選用的；如果您省略連接埠範圍，則允許所有類型和代碼的流量。  
必要：是  
類型：字串

 `to_port`    
如果通訊協定是 TCP 或 UDP，這是連接埠範圍的結尾。如果通訊協定是 ICMP 或 ICMPv6，這是代碼。值 -1 表示所有 ICMP/ICMPv6 代碼。若您指定所有 ICMP/ICMPv6 類型，您必須指定所有 ICMP/ICMPv6 代碼。  
必要：否  
類型：整數

## 要求
<a name="node-networking-security-group-egress-rule-requirements"></a>

 `security_group`    
要新增此規則的安全群組 ID。  
必要：是  
類型：字串

 `destination_security_group`    
允許輸出流量目的地安全群組的 ID 或 TOSCA 參考。  
必要：否  
類型：字串

## 範例
<a name="node-networking-security-group-egress-rule-example"></a>

```
SampleSecurityGroupEgressRule:
      type: tosca.nodes.AWS.Networking.SecurityGroupEgressRule
      properties:
        ip_protocol: "tcp"
        from_port: 8000
        to_port: 9000
        description: "Egress Rule for sample security group"
        cidr_ipv6: "2600:1f14:3758:ca00::/64"    
      requirements:
        security_group: SampleSecurityGroup001
        destination_security_group: SampleSecurityGroup002
```