すべてのプロダクト
Search
ドキュメントセンター

Resource Orchestration Service:ALIYUN::ECS::SecurityGroupIngresses

最終更新日:Mar 17, 2025

ALIYUN::ECS::SecurityGroupIngresses は、一度に複数のインバウンドルールをセキュリティグループに関連付けるために使用されます。

構文

{
  "Type": "ALIYUN::ECS::SecurityGroupIngresses",
  "Properties": {
    "SecurityGroupId": String,
    "Permissions": List
  }
}

プロパティ

プロパティ

タイプ

必須

編集可能

説明

制約

Permissions

List

はい

はい

セキュリティグループに関連付けるインバウンドルールの構成。

最大 100 個のインバウンドルールを関連付けることができます。詳細については、「Permissions プロパティ」をご参照ください。

SecurityGroupId

String

はい

いいえ

ソースセキュリティグループの ID。

なし。

Permissions 構文

"Permissions": [
  {
    "Policy": String,
    "SourceGroupId": String,
    "Description": String,
    "SourcePortRange": String,
    "Priority": Integer,
    "SourceGroupOwnerId": String,
    "Ipv6SourceCidrIp": String,
    "NicType": String,
    "PortRange": String,
    "SourceCidrIp": String,
    "IpProtocol": String,
    "DestCidrIp": String,
    "SourceGroupOwnerAccount": String,
    "Ipv6DestCidrIp": String,
    "SourcePrefixListId": String
  }
]

Permissions プロパティ

プロパティ

タイプ

必須

編集可能

説明

制約

IpProtocol

String

はい

いいえ

ルールがサポートする IP プロトコル。

有効な値:

  • tcp: 伝送制御プロトコル ( TCP ) をサポートします。

  • udp: ユーザーデータグラムプロトコル ( UDP ) をサポートします。

  • icmp: インターネット制御メッセージプロトコル ( ICMP ) をサポートします。

  • gre: Generic Routing Encapsulation ( GRE ) をサポートします。

  • all: 上記のすべてのプロトコルをサポートします。

PortRange

String

はい

いいえ

宛先セキュリティグループのトランスポート層プロトコルに対応するポート番号の範囲。

  • IpProtocol が tcp または udp に設定されている場合の値の形式: X/Y。X は開始ポート番号を指定し、Y は終了ポート番号を指定します。X と Y の範囲は 1 ~ 65535 です。X と Y はスラッシュ (/) で区切ります。たとえば、1/200 は有効な値ですが、200/1 は無効な値です。

  • IpProtocol が icmp に設定されている場合の有効な値: -1/-1。

  • IpProtocol が gre に設定されている場合の有効な値: -1/-1。

  • IpProtocol が all に設定されている場合の有効な値: -1/-1。

Description

String

いいえ

いいえ

ルールの説明。

説明は 1 ~ 512 文字でなければなりません。

DestCidrIp

String

いいえ

いいえ

宛先 IP アドレス範囲。

IPv4 アドレス範囲がサポートされています。

Ipv6DestCidrIp

String

いいえ

いいえ

宛先 IPv6 CIDR ブロック。

IPv6 アドレスもサポートされています。IP アドレスは VPC タイプである必要があります。

Ipv6SourceCidrIp

String

いいえ

いいえ

ソース IPv6 CIDR ブロック。

IPv6 アドレスもサポートされています。IP アドレスは VPC タイプである必要があります。

NicType

String

いいえ

いいえ

ネットワークインターフェースコントローラー ( NIC ) のタイプ。

有効な値:

  • internet ( デフォルト ): パブリック NIC

  • intranet: 内部 NIC

DestGroupId を指定し、DestCidrIp を空のままにしてセキュリティグループ間の相互アクセスを設定する場合は、NicType を intranet に設定する必要があります。

Policy

String

いいえ

いいえ

アクセスを許可するかどうかを決定するルールアクション。

有効な値:

  • accept ( デフォルト ): アクセスを許可します。

  • drop: アクセスを拒否します。

Priority

Integer

いいえ

いいえ

ルールの優先度。

有効な値: 1 ~ 100。

デフォルト値: 1。

SourceCidrIp

String

いいえ

いいえ

アクセスを制御するソース IPv4 アドレス範囲。

IPv4 アドレス範囲のみがサポートされています。

SourceGroupId

String

いいえ

いいえ

ルールで参照されるソースセキュリティグループの ID。

SourceGroupId と SourceCidrIp の少なくとも 1 つを指定する必要があります。

SourceGroupId を指定し、SourceCidrIp を空のままにする場合は、NicType を intranet に設定する必要があります。

SourceGroupId と SourceCidrIp の両方を指定した場合、デフォルトでは SourceCidrIp の値が優先されます。

SourceGroupOwnerAccount

String

いいえ

いいえ

ソースセキュリティグループが属する Alibaba Cloud アカウントのメールアドレス。

例: T***@example.com。

SourceGroupOwnerId

String

いいえ

いいえ

アカウント間でルールを構成する場合、ソースセキュリティグループが属する Alibaba Cloud アカウントの ID。

SourceGroupOwnerId を空のままにした場合、デフォルトでは、Alibaba Cloud アカウント内の別のセキュリティグループへのアクセスを制御するルールが作成されます。

SourceCidrIp を指定した場合、SourceGroupOwnerId の値は無視されます。

SourcePortRange

String

いいえ

いいえ

ソースセキュリティグループのトランスポート層プロトコルに対応するポート番号の範囲。

  • IpProtocol が tcp または udp に設定されている場合の値の形式: X/Y。X は開始ポート番号を指定し、Y は終了ポート番号を指定します。X と Y の範囲は 1 ~ 65535 です。X と Y はスラッシュ (/) で区切ります。たとえば、1/200 は有効な値ですが、200/1 は無効な値です。

  • IpProtocol が icmp に設定されている場合の有効な値: -1/-1。

  • IpProtocol が gre に設定されている場合の有効な値: -1/-1。

  • IpProtocol が all に設定されている場合の有効な値: -1/-1。

SourcePrefixListId

String

いいえ

いいえ

ルールで参照されるソースプレフィックスリストの ID。

DescribePrefixLists 操作を呼び出して、使用可能なプレフィックスリストの ID をクエリできます。

セキュリティグループがクラシックネットワークにある場合、セキュリティグループルール内のプレフィックスリストを参照することはできません。詳細については、「セキュリティグループ」をご参照ください。

SourceCidrIp、Ipv6SourceCidrIp、SourceGroupId のいずれかを指定した場合、SourcePrefixListId の値は無視されます。

戻り値

Fn::GetAtt

なし。

YAML 形式

ROSTemplateFormatVersion: '2015-09-01'
Parameters:
  SecurityGroupId:
    AssociationPropertyMetadata:
      VpcId: ${VpcId}
    AssociationProperty: ALIYUN::ECS::SecurityGroup::SecurityGroupId
    Type: String
    Description:
      en: Id of the security group.
    Required: true
  Permissions:
    AssociationPropertyMetadata:
      Parameters:
        Policy:
          Type: String
          Description:
            en: 'Authorization policies, parameter values can be: accept (accepted access), drop (denied access). Default value is accept.'
          AllowedValues:
            - accept
            - drop
          Required: false
        SourceGroupId:
          Type: String
          Description:
            en: Source Group Id
          Required: false
        Description:
          AssociationProperty: TextArea
          Type: String
          Description:
            en: Description of the security group rule, [1, 512] characters. The default is empty.
          Required: false
          MinLength: 1
          MaxLength: 512
        SourcePortRange:
          Type: String
          Description:
            en: 'The range of the ports enabled by the source security group for the transport layer protocol. Valid values: TCP/UDP: Value range: 1 to 65535. The start port and the end port are separated by a slash (/). Correct example: 1/200. Incorrect example: 200/1.ICMP: -1/-1.GRE: -1/-1.ALL: -1/-1.'
          Required: false
        Priority:
          Type: Number
          Description:
            en: Authorization policies priority range[1, 100]
          Required: false
          MinValue: 1
          MaxValue: 100
          Default: 1
        SourceGroupOwnerId:
          Type: String
          Description:
            en: Source Group Owner Account ID
          Required: false
        Ipv6SourceCidrIp:
          Type: String
          Description:
            en: |-
              Source IPv6 CIDR address segment. Supports IP address ranges in CIDR format and IPv6 format.
              Note Only VPC type IP addresses are supported.
          Required: false
        NicType:
          Type: String
          Description:
            en: Network type, could be 'internet' or 'intranet'. Default value is internet.
          AllowedValues:
            - internet
            - intranet
          Required: false
        PortRange:
          Type: String
          Description:
            en: Ip protocol relative port range. For tcp and udp, the port rang is [1,65535], using format '1/200'For icmp|gre|all protocel, the port range should be '-1/-1'
          Required: true
        SourceCidrIp:
          Type: String
          Description:
            en: The source IPv4 CIDR block to which you want to control access. CIDR blocks and IPv4 addresses are supported.
          Required: false
        IpProtocol:
          Type: String
          Description:
            en: Ip protocol for in rule.
          AllowedValues:
            - tcp
            - udp
            - icmp
            - gre
            - all
            - icmpv6
          Required: true
        DestCidrIp:
          Type: String
          Description:
            en: The destination IPv4 CIDR block to which you want to control access. CIDR blocks and IPv4 addresses are supported.
          Required: false
        SourceGroupOwnerAccount:
          Type: String
          Description:
            en: Source Group Owner Account
          Required: false
        Ipv6DestCidrIp:
          Type: String
          Description:
            en: Destination IPv6 CIDR address block for which access rights need to be set. CIDR format and IPv6 format IP address range are supported.
          Required: false
        SourcePrefixListId:
          Type: String
          Description:
            en: |-
              The ID of the source prefix list to which you want to control access. You can call the DescribePrefixLists operation to query the IDs of available prefix lists. Take note of the following items:
              - If a security group is in the classic network, you cannot configure prefix lists in the security group rules.
              - If you specify the SourceCidrIp, Ipv6SourceCidrIp, or SourceGroupId parameter, this parameter is ignored.
          Required: false
    AssociationProperty: List[Parameters]
    Type: Json
    Description:
      en: A list of security group rules. A hundred at most.
    Required: true
    MaxLength: 100
Resources:
  SecurityGroupIngresses:
    Type: ALIYUN::ECS::SecurityGroupIngresses
    Properties:
      SecurityGroupId:
        Ref: SecurityGroupId
      Permissions:
        Ref: Permissions

JSON 形式

{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
    "SecurityGroupId": {
      "AssociationPropertyMetadata": {
        "VpcId": "${VpcId}"
      },
      "AssociationProperty": "ALIYUN::ECS::SecurityGroup::SecurityGroupId",
      "Type": "String",
      "Description": {
        "en": "Id of the security group."
      },
      "Required": true
    },
    "Permissions": {
      "AssociationPropertyMetadata": {
        "Parameters": {
          "Policy": {
            "Type": "String",
            "Description": {
              "en": "Authorization policies, parameter values can be: accept (accepted access), drop (denied access). Default value is accept."
            },
            "AllowedValues": [
              "accept",
              "drop"
            ],
            "Required": false
          },
          "SourceGroupId": {
            "Type": "String",
            "Description": {
              "en": "Source Group Id"
            },
            "Required": false
          },
          "Description": {
            "AssociationProperty": "TextArea",
            "Type": "String",
            "Description": {
              "en": "Description of the security group rule, [1, 512] characters. The default is empty."
            },
            "Required": false,
            "MinLength": 1,
            "MaxLength": 512
          },
          "SourcePortRange": {
            "Type": "String",
            "Description": {
              "en": "The range of the ports enabled by the source security group for the transport layer protocol. Valid values: TCP/UDP: Value range: 1 to 65535. The start port and the end port are separated by a slash (/). Correct example: 1/200. Incorrect example: 200/1.ICMP: -1/-1.GRE: -1/-1.ALL: -1/-1."
            },
            "Required": false
          },
          "Priority": {
            "Type": "Number",
            "Description": {
              "en": "Authorization policies priority range[1, 100]"
            },
            "Required": false,
            "MinValue": 1,
            "MaxValue": 100,
            "Default": 1
          },
          "SourceGroupOwnerId": {
            "Type": "String",
            "Description": {
              "en": "Source Group Owner Account ID"
            },
            "Required": false
          },
          "Ipv6SourceCidrIp": {
            "Type": "String",
            "Description": {
              "en": "Source IPv6 CIDR address segment. Supports IP address ranges in CIDR format and IPv6 format.\nNote Only VPC type IP addresses are supported."
            },
            "Required": false
          },
          "NicType": {
            "Type": "String",
            "Description": {
              "en": "Network type, could be 'internet' or 'intranet'. Default value is internet."
            },
            "AllowedValues": [
              "internet",
              "intranet"
            ],
            "Required": false
          },
          "PortRange": {
            "Type": "String",
            "Description": {
              "en": "Ip protocol relative port range. For tcp and udp, the port rang is [1,65535], using format '1/200'For icmp|gre|all protocel, the port range should be '-1/-1'"
            },
            "Required": true
          },
          "SourceCidrIp": {
            "Type": "String",
            "Description": {
              "en": "The source IPv4 CIDR block to which you want to control access. CIDR blocks and IPv4 addresses are supported."
            },
            "Required": false
          },
          "IpProtocol": {
            "Type": "String",
            "Description": {
              "en": "Ip protocol for in rule."
            },
            "AllowedValues": [
              "tcp",
              "udp",
              "icmp",
              "gre",
              "all",
              "icmpv6"
            ],
            "Required": true
          },
          "DestCidrIp": {
            "Type": "String",
            "Description": {
              "en": "The destination IPv4 CIDR block to which you want to control access. CIDR blocks and IPv4 addresses are supported."
            },
            "Required": false
          },
          "SourceGroupOwnerAccount": {
            "Type": "String",
            "Description": {
              "en": "Source Group Owner Account"
            },
            "Required": false
          },
          "Ipv6DestCidrIp": {
            "Type": "String",
            "Description": {
              "en": "Destination IPv6 CIDR address block for which access rights need to be set. CIDR format and IPv6 format IP address range are supported."
            },
            "Required": false
          },
          "SourcePrefixListId": {
            "Type": "String",
            "Description": {
              "en": "The ID of the source prefix list to which you want to control access. You cancall the DescribePrefixLists operation to query the IDs of available prefix lists. Take note of the following items:\n- If a security group is in the classic network, you cannot configure prefix lists in the security group rules.\n- If you specify the SourceCidrIp, Ipv6SourceCidrIp, or SourceGroupId parameter, this parameter is ignored."
            },
            "Required": false
          }
        }
      },
      "AssociationProperty": "List[Parameters]",
      "Type": "Json",
      "Description": {
        "en": "A list of security group rules. A hundred at most."
      },
      "Required": true,
      "MaxLength": 100
    }
  },
  "Resources": {
    "SecurityGroupIngresses": {
      "Type": "ALIYUN::ECS::SecurityGroupIngresses",
      "Properties": {
        "SecurityGroupId": {
          "Ref": "SecurityGroupId"
        },
        "Permissions": {
          "Ref": "Permissions"
        }
      }
    }
  }
}