全部產品
Search
文件中心

Resource Orchestration Service:ALIYUN::ECS::SecurityGroupEgress

更新時間:Apr 10, 2025

ALIYUN::ECS::SecurityGroupEgress類型用於建立安全性群組出方向的訪問規則。

文法

{
  "Type": "ALIYUN::ECS::SecurityGroupEgress",
  "Properties": {
    "SecurityGroupId": String,
    "IpProtocol": String,
    "PortRange": String,
    "DestGroupId": String,
    "DestCidrIp": String,
    "Policy": String,
    "Priority": String,
    "NicType": String,
    "DestPrefixListId": String,
    "Description": String,    
    "DestGroupOwnerId": String,
    "Ipv6DestCidrIp": String
  }
}

屬性

屬性名稱類型必須允許更新描述約束
IpProtocol String傳輸層協議。取值:
  • tcp
  • udp
  • icmp
  • gre
  • all:同時支援四種協議。
PortRange String目的端安全性群組開放的傳輸層協議相關的連接埠範圍。取值:
  • TCP/UDP協議:1~65535。使用正斜線(/)隔開開始端點口和終止連接埠。正確樣本:1/200;錯誤樣本:200/1。
  • ICMP協議:-1/-1。
  • GRE協議:-1/-1。
  • all:-1/-1。

瞭解連接埠的應用情境,請參見常用連接埠

SecurityGroupId String源端安全性群組ID。
DestPrefixListIdString需要設定出方向存取權限的目的端首碼列表ID。您可以調用DescribePrefixLists查詢可用的首碼列表ID。

當安全性群組的網路類型為傳統網路時,不支援設定首碼列表。更多資訊,請參見安全性群組使用限制

當您指定了DestCidrIp、Ipv6DestCidrIp或DestGroupId參數中的任意一個時,將忽略該參數。

NicType String網卡類型。取值:
  • internet(預設值):公網網卡。
  • intranet:內網網卡。
當設定安全性群組之間互相訪問時,即指定DestGroupId,但未指定DestCidrIp時,該參數取值為intranet。
Priority Integer安全性群組規則優先順序。 取值範圍:1~100。

預設值:1。

DestGroupId String需要設定存取權限的目的端安全性群組ID。至少設定DestGroupId或者DestCidrIp其中一項。

如果指定DestGroupId,但未指定DestCidrIp,則NicType取值為intranet。

如果同時指定DestGroupId和DestCidrIp,則以DestCidrIp的設定為準。

DestCidrIp String 目的端IP位址範圍。支援IPv4格式的IP位址範圍。
Policy String 設定存取權限。 取值:
  • accept(預設值):接受訪問。
  • drop:拒絕訪問。
DescriptionString安全性群組規則的描述資訊。長度為1~512個字元。
DestGroupOwnerIdString跨賬戶設定安全性群組規則時,目的端安全性群組所屬的阿里雲帳號ID。如果DestGroupOwnerId未設定,則認為是設定您其他安全性群組的存取權限。如果您已經設定DestCidrIp,則DestGroupOwnerId的設定無效。
Ipv6DestCidrIpString目的端IPv6 CIDR位址區段。支援CIDR格式和IPv6格式的IP位址範圍,且僅支援VPC類型的IP地址。

傳回值

Fn::GetAtt

無。

樣本

  • YAML格式

    ROSTemplateFormatVersion: '2015-09-01'
    Description: Test ECS SecurityGroupEgress
    Parameters:
      SecurityGroupId:
        Type: String
        AssociationProperty: ALIYUN::ECS::SecurityGroup::SecurityGroupId
        Label:
          zh-cn: 安全性群組ID
          en: Security Group ID
    Resources:
      SgEgress:
        Type: ALIYUN::ECS::SecurityGroupEgress
        Properties:
          IpProtocol: all
          PortRange: '-1/-1'
          NicType: intranet
          SecurityGroupId:
            Ref: SecurityGroupId
  • JSON格式

    {
      "ROSTemplateFormatVersion": "2015-09-01",
      "Description": "Test ECS SecurityGroupEgress",
      "Parameters": {
        "SecurityGroupId": {
          "Type": "String",
          "AssociationProperty": "ALIYUN::ECS::SecurityGroup::SecurityGroupId",
          "Label": {
            "zh-cn": "安全性群組ID",
            "en": "Security Group ID"
          }
        }
      },
      "Resources": {
        "SgEgress": {
          "Type": "ALIYUN::ECS::SecurityGroupEgress",
          "Properties": {
            "IpProtocol": "all",
            "PortRange": "-1/-1",
            "NicType": "intranet",
            "SecurityGroupId": {
              "Ref": "SecurityGroupId"
            }
          }
        }
      }
    }