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

Resource Orchestration Service:ALIYUN::ECS::SecurityGroupIngress

最終更新日:Feb 06, 2026

ALIYUN::ECS::SecurityGroupIngress リソースタイプは、セキュリティグループのインバウンドルールを作成します。

構文

{
  "Type": "ALIYUN::ECS::SecurityGroupIngress",
  "Properties": {
    "SourceGroupOwnerId": String,
    "Description": String,
    "PortRange": String,
    "SecurityGroupId": String,
    "NicType": String,
    "Ipv6SourceCidrIp": String,
    "Priority": Integer,
    "SourceGroupId": String,
    "Policy": String,
    "IpProtocol": String,
    "SourcePortRange": String,
    "SourceCidrIp": String,
    "SourcePrefixListId": String
  }
}

プロパティ

プロパティ名

必須

更新可能

説明

制約

IpProtocol

String

はい

いいえ

IP プロトコル。

有効値:

  • tcp

  • udp

  • icmp

  • gre

  • all:TCP、UDP、ICMP、GRE をサポートします。

PortRange

String

はい

いいえ

宛先セキュリティグループで開放するトランスポート層ポートの範囲です。

有効値:

  • TCP/UDP:1 ~ 65535。開始ポートと終了ポートをスラッシュ (/) で区切ります(例:1/200)。無効な例:200/1。

  • ICMP:-1/-1。

  • GRE:-1/-1。

  • all:-1/-1。

SourcePrefixListId

String

いいえ

いいえ

インバウンドアクセス権限を設定する宛先プレフィックスリストの ID です。

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

クラシックネットワークのセキュリティグループでは、プレフィックスリストはサポートされていません。

SourceCidrIp、Ipv6SourceCidrIp、または SourceGroupId を指定した場合、このパラメーターは無視されます。

SourceGroupId

String

いいえ

いいえ

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

SourceGroupId または SourceCidrIp のいずれかを指定する必要があります。

SourceGroupId を指定し、SourceCidrIp を指定しない場合、NicType は intranet に設定されます。

SourceGroupId と SourceCidrIp の両方を指定した場合、SourceCidrIp の設定が優先されます。

SecurityGroupId

String

いいえ

いいえ

インバウンドルールを作成するセキュリティグループの ID です。

なし

NicType

String

いいえ

いいえ

ネットワークタイプ。

有効値:

  • internet(デフォルト):パブリックネットワークインターフェイスコントローラー (NIC)。

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

セキュリティグループ間の相互アクセス(たとえば、DestGroupId を指定し、DestCidrIp を指定しない場合)を設定する際には、このパラメーターの値は intranet になります。

Priority

Integer

いいえ

いいえ

セキュリティグループルールの優先度。

値の範囲は 1 ~ 100 です。

デフォルト値:1。

SourceCidrIp

String

いいえ

いいえ

ソース IPv4 CIDR ブロック。

IPv4 CIDR ブロックのみがサポートされています。

Policy

String

いいえ

いいえ

アクセス権限

有効値:

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

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

SourceGroupOwnerId

String

いいえ

いいえ

送信元セキュリティグループを所有する Alibaba Cloud アカウントの ID です。アカウント間でセキュリティグループルールを設定する場合に使用します。

SourceGroupOwnerId を設定しない場合、デフォルトでご利用の他のセキュリティグループに対してアクセス権限が設定されます。

SourceCidrIp を指定した場合、このパラメーターは無視されます。

Description

String

いいえ

はい

セキュリティグループルールの説明。

説明は 1~512 文字である必要があります。

SourcePortRange

String

いいえ

いいえ

送信元セキュリティグループで開放するトランスポート層ポートの範囲です。

有効値:

  • TCP/UDP:1 ~ 65535。開始ポートと終了ポートをスラッシュ (/) で区切ります(例:1/200)。無効な例:200/1。

  • ICMP:-1/-1。

  • GRE:-1/-1。

  • all:-1/-1。

Ipv6SourceCidrIp

String

いいえ

いいえ

ソース IPv6 CIDR ブロック。

CIDR ブロックおよび IPv6 アドレスをサポートします。VPC 内の IP アドレスのみがサポートされます。

戻り値

Fn::GetAtt

なし。

シナリオ 1:既存のセキュリティグループを選択し、インバウンドポート 3306 を開放します。

クイック作成

ROSTemplateFormatVersion: '2015-09-01'
Description: 既存のセキュリティグループを選択し、インバウンドポート 3306 を開放します。
Parameters:
  SecurityGroupId:
    Type: String
    Label: ビジネス用セキュリティグループ ID
    AssociationProperty: ALIYUN::ECS::SecurityGroup::SecurityGroupId
Resources:
  SecurityGroupIngress_3306:
    Type: ALIYUN::ECS::SecurityGroupIngress
    Properties:
      SecurityGroupId:
        Ref: SecurityGroupId
      SourceCidrIp: 0.0.0.0/0
      IpProtocol: tcp
      NicType: intranet
      PortRange: 3306/3306
Outputs: {}
Metadata: {}
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Description": "既存のセキュリティグループを選択し、インバウンドポート 3306 を開放します。",
  "Parameters": {
    "SecurityGroupId": {
      "Type": "String",
      "Label": "ビジネス用セキュリティグループ ID",
      "AssociationProperty": "ALIYUN::ECS::SecurityGroup::SecurityGroupId"
    }
  },
  "Resources": {
    "SecurityGroupIngress_3306": {
      "Type": "ALIYUN::ECS::SecurityGroupIngress",
      "Properties": {
        "SecurityGroupId": {
          "Ref": "SecurityGroupId"
        },
        "SourceCidrIp": "0.0.0.0/0",
        "IpProtocol": "tcp",
        "NicType": "intranet",
        "PortRange": "3306/3306"
      }
    }
  },
  "Outputs": {
  },
  "Metadata": {
  }
}

シナリオ 2:セキュリティグループを作成し、インバウンドポート 80 を開放します。

クイック作成

ROSTemplateFormatVersion: '2015-09-01'
Description: ECS セキュリティグループを作成し、インバウンドポート 80 を開放します。
Parameters:
  ZoneId:
    Type: String
    Label: 可用性ゾーン
    AssociationProperty: ALIYUN::ECS::Instance:ZoneId
Resources:
  Vpc:
    Type: ALIYUN::ECS::VPC
    Properties:
      CidrBlock: 192.168.0.0/16
  VSwitch:
    Type: ALIYUN::ECS::VSwitch
    Properties:
      ZoneId:
        Ref: ZoneId
      VpcId:
        Ref: Vpc
      CidrBlock: 192.168.0.0/24
  SecurityGroup:
    Type: ALIYUN::ECS::SecurityGroup
    Properties:
      VpcId:
        Ref: Vpc
  SecurityGroupIngress_80:
    Type: ALIYUN::ECS::SecurityGroupIngress
    Properties:
      SecurityGroupId:
        Ref: SecurityGroup
      SourceCidrIp: 0.0.0.0/0
      IpProtocol: tcp
      NicType: intranet
      PortRange: 80/80
Outputs: {}
Metadata: {}
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Description": "ECS セキュリティグループを作成し、インバウンドポート 80 を開放します。",
  "Parameters": {
    "ZoneId": {
      "Type": "String",
      "Label": "可用性ゾーン",
      "AssociationProperty": "ALIYUN::ECS::Instance:ZoneId"
    }
  },
  "Resources": {
    "Vpc": {
      "Type": "ALIYUN::ECS::VPC",
      "Properties": {
        "CidrBlock": "192.168.0.0/16"
      }
    },
    "VSwitch": {
      "Type": "ALIYUN::ECS::VSwitch",
      "Properties": {
        "ZoneId": {
          "Ref": "ZoneId"
        },
        "VpcId": {
          "Ref": "Vpc"
        },
        "CidrBlock": "192.168.0.0/24"
      }
    },
    "SecurityGroup": {
      "Type": "ALIYUN::ECS::SecurityGroup",
      "Properties": {
        "VpcId": {
          "Ref": "Vpc"
        }
      }
    },
    "SecurityGroupIngress_80": {
      "Type": "ALIYUN::ECS::SecurityGroupIngress",
      "Properties": {
        "SecurityGroupId": {
          "Ref": "SecurityGroup"
        },
        "SourceCidrIp": "0.0.0.0/0",
        "IpProtocol": "tcp",
        "NicType": "intranet",
        "PortRange": "80/80"
      }
    }
  },
  "Outputs": {
  },
  "Metadata": {
  }
}

シナリオ 3:ECS インスタンスを作成し、Flowise アプリケーションのサービスポートとしてインバウンドポート 3000 を開放します。

クイック作成

ROSTemplateFormatVersion: '2015-09-01'
Description: Ubuntu 22.04 の ECS インスタンスを作成し、セキュリティグループおよびネットワーキングを構成し、Node.js および Flowise AI エージェントサービスの自動インストールを実行し、外部アクセス用 URL を提供します。
Parameters:
  SystemDiskCategory:
    Default: cloud_essd
    AssociationProperty: ALIYUN::ECS::Disk::SystemDiskCategory
    AssociationPropertyMetadata:
      LocaleKey: DiskCategory
      AutoChangeType: false
      InstanceType: ${InstanceType}
      AutoSelectFirst: true
      ZoneId: ${ZoneId}
    Type: String
    Label: システムディスクの種類
  InstanceType:
    AssociationProperty: ALIYUN::ECS::Instance::InstanceType
    AssociationPropertyMetadata:
      DefaultValueStrategy: recent
      ZoneId: ${ZoneId}
    Type: String
    Label: インスタンスタイプ
  InstancePassword:
    AssociationPropertyMetadata:
      Visible:
        Condition:
          Fn::Equals:
            - ${SelectInstance}
            - false
    Description: サーバーへのログインパスワードです。パスワードは 8 ~ 30 文字で、大文字、小文字、数字、特殊文字 `()~!@#$%^&*_-+=|{}[]:;'<>,.?/` のうち少なくとも 3 種類を含む必要があります。
    Default: Null
    Type: String
    Label: インスタンスパスワード
    NoEcho: true
    AssociationProperty: ALIYUN::ECS::Instance::Password
    ConstraintDescription: サーバーへのログインパスワードです。パスワードは 8 ~ 30 文字で、大文字、小文字、数字、特殊文字 `()~!@#$%^&*_-+=|{}[]:;'<>,.?/` のうち少なくとも 3 種類を含む必要があります。
  ZoneId:
    AssociationProperty: ALIYUN::ECS::Instance:ZoneId
    Type: String
    Description: <font color='blue'>このテンプレートでは Git を使用して GitHub から FlowiseAI/Flowise リポジトリをクローンします。中国国内のリージョンでこのテンプレートを使用すると、ネットワーク接続の問題が発生する可能性があります。中国以外のリージョンに切り替えることを推奨します。</font>
    Label: 可用性ゾーン
Outputs:
  FlowiseUrl:
    Description: Flowise のデフォルトアドレスです。
    Value:
      Fn::Sub:
        - http://${IP}:3000
        - IP:
            Fn::Jq:
              - First
              - if .[0].PublicIpAddress != [] then .[0].PublicIpAddress[0] else .[0].EipAddress.IpAddress end
              - Fn::GetAtt:
                  - DS_Instances
                  - Instances
Resources:
  SecurityGroupIngress_3000:
    Type: ALIYUN::ECS::SecurityGroupIngress
    Properties:
      IpProtocol: tcp
      SecurityGroupId:
        Ref: SecurityGroup
      NicType: intranet
      SourceCidrIp: 0.0.0.0/0
      PortRange: 3000/3000
  InstanceGroup:
    Type: ALIYUN::ECS::InstanceGroup
    Properties:
      SystemDiskCategory:
        Ref: SystemDiskCategory
      VpcId:
        Ref: Vpc
      SecurityGroupId:
        Ref: SecurityGroup
      ImageId: ubuntu_22_04
      IoOptimized: optimized
      VSwitchId:
        Ref: VSwitch
      Password:
        Ref: InstancePassword
      InstanceName: Flowise
      InstanceType:
        Ref: InstanceType
      MaxAmount: 1
  SecurityGroup:
    Type: ALIYUN::ECS::SecurityGroup
    Properties:
      VpcId:
        Ref: Vpc
  DS_Instances:
    Type: DATASOURCE::ECS::Instances
    Properties:
      InstanceIds:
        Fn::GetAtt:
          - InstanceGroup
          - InstanceIds
  Vpc:
    Type: ALIYUN::ECS::VPC
    Properties:
      CidrBlock: 192.168.0.0/16
  InstallFlowise:
    Type: ALIYUN::ECS::RunCommand
    Properties:
      CommandContent: |
        #!/bin/bash
        echo "#########################"
        echo "# NodeJS のインストール"
        echo "#########################"
        git clone https://github.com/nvm-sh/nvm.git /opt/nvm && cd /opt/nvm
        ret_code=$?
        if [ $ret_code -ne 0 ]; then
          echo "Git clone https://github.com/nvm-sh/nvm.git に失敗しました。終了します。"
          exit $ret_code
        fi
        ./install.sh
        export NVM_DIR="$HOME/.nvm"
        [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
        [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
        nvm install 22
        npm config set registry https://registry.npmmirror.com
        npm i -g pnpm

        echo "#########################"
        echo "# Flowise のインストール"
        echo "#########################"
        git clone --depth 1 https://github.com/FlowiseAI/Flowise.git /opt/Flowise && cd /opt/Flowise
        ret_code=$?
        if [ $ret_code -ne 0 ]; then
          echo "Git clone https://github.com/FlowiseAI/Flowise.git に失敗しました。終了します。"
          exit $ret_code
        fi
        pnpm install
        pnpm build
        nohup pnpm start > flowise.log 2>&1 &
      Type: RunShellScript
      Sync: true
      InstanceIds:
        Fn::GetAtt:
          - InstanceGroup
          - InstanceIds
      Timeout: 1800
  VSwitch:
    Type: ALIYUN::ECS::VSwitch
    Properties:
      VpcId:
        Ref: Vpc
      CidrBlock: 192.168.0.0/24
      ZoneId:
        Ref: ZoneId
Metadata: {}
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Description": "Ubuntu 22.04 の ECS インスタンスを作成し、セキュリティグループおよびネットワーキングを構成し、Node.js および Flowise AI エージェントサービスの自動インストールを実行し、外部アクセス用 URL を提供します。",
  "Parameters": {
    "SystemDiskCategory": {
      "Default": "cloud_essd",
      "AssociationProperty": "ALIYUN::ECS::Disk::SystemDiskCategory",
      "AssociationPropertyMetadata": {
        "LocaleKey": "DiskCategory",
        "AutoChangeType": false,
        "InstanceType": "${InstanceType}",
        "AutoSelectFirst": true,
        "ZoneId": "${ZoneId}"
      },
      "Type": "String",
      "Label": "システムディスクの種類"
    },
    "InstanceType": {
      "AssociationProperty": "ALIYUN::ECS::Instance::InstanceType",
      "AssociationPropertyMetadata": {
        "DefaultValueStrategy": "recent",
        "ZoneId": "${ZoneId}"
      },
      "Type": "String",
      "Label": "インスタンスタイプ"
    },
    "InstancePassword": {
      "AssociationPropertyMetadata": {
        "Visible": {
          "Condition": {
            "Fn::Equals": [
              "${SelectInstance}",
              false
            ]
          }
        }
      },
      "Description": "サーバーへのログインパスワードです。パスワードは 8 ~ 30 文字で、大文字、小文字、数字、特殊文字 `()~!@#$%^&*_-+=|{}[]:;'<>,.?/` のうち少なくとも 3 種類を含む必要があります。",
      "Default": null,
      "Type": "String",
      "Label": "インスタンスパスワード",
      "NoEcho": true,
      "AssociationProperty": "ALIYUN::ECS::Instance::Password",
      "ConstraintDescription": "サーバーへのログインパスワードです。パスワードは 8 ~ 30 文字で、大文字、小文字、数字、特殊文字 `()~!@#$%^&*_-+=|{}[]:;'<>,.?/` のうち少なくとも 3 種類を含む必要があります。"
    },
    "ZoneId": {
      "AssociationProperty": "ALIYUN::ECS::Instance:ZoneId",
      "Type": "String",
      "Description": "<font color='blue'>このテンプレートでは Git を使用して GitHub から FlowiseAI/Flowise リポジトリをクローンします。中国国内のリージョンでこのテンプレートを使用すると、ネットワーク接続の問題が発生する可能性があります。中国以外のリージョンに切り替えることを推奨します。</font>",
      "Label": "可用性ゾーン"
    }
  },
  "Outputs": {
    "FlowiseUrl": {
      "Description": "Flowise のデフォルトアドレスです。",
      "Value": {
        "Fn::Sub": [
          "http://${IP}:3000",
          {
            "IP": {
              "Fn::Jq": [
                "First",
                "if .[0].PublicIpAddress != [] then .[0].PublicIpAddress[0] else .[0].EipAddress.IpAddress end",
                {
                  "Fn::GetAtt": [
                    "DS_Instances",
                    "Instances"
                  ]
                }
              ]
            }
          }
        ]
      }
    }
  },
  "Resources": {
    "SecurityGroupIngress_3000": {
      "Type": "ALIYUN::ECS::SecurityGroupIngress",
      "Properties": {
        "IpProtocol": "tcp",
        "SecurityGroupId": {
          "Ref": "SecurityGroup"
        },
        "NicType": "intranet",
        "SourceCidrIp": "0.0.0.0/0",
        "PortRange": "3000/3000"
      }
    },
    "InstanceGroup": {
      "Type": "ALIYUN::ECS::InstanceGroup",
      "Properties": {
        "SystemDiskCategory": {
          "Ref": "SystemDiskCategory"
        },
        "VpcId": {
          "Ref": "Vpc"
        },
        "SecurityGroupId": {
          "Ref": "SecurityGroup"
        },
        "ImageId": "ubuntu_22_04",
        "IoOptimized": "optimized",
        "VSwitchId": {
          "Ref": "VSwitch"
        },
        "Password": {
          "Ref": "InstancePassword"
        },
        "InstanceName": "Flowise",
        "InstanceType": {
          "Ref": "InstanceType"
        },
        "MaxAmount": 1
      }
    },
    "SecurityGroup": {
      "Type": "ALIYUN::ECS::SecurityGroup",
      "Properties": {
        "VpcId": {
          "Ref": "Vpc"
        }
      }
    },
    "DS_Instances": {
      "Type": "DATASOURCE::ECS::Instances",
      "Properties": {
        "InstanceIds": {
          "Fn::GetAtt": [
            "InstanceGroup",
            "InstanceIds"
          ]
        }
      }
    },
    "Vpc": {
      "Type": "ALIYUN::ECS::VPC",
      "Properties": {
        "CidrBlock": "192.168.0.0/16"
      }
    },
    "InstallFlowise": {
      "Type": "ALIYUN::ECS::RunCommand",
      "Properties": {
        "CommandContent": "#!/bin/bash\necho \"#########################\"\necho \"# NodeJS のインストール\"\necho \"#########################\"\ngit clone https://github.com/nvm-sh/nvm.git /opt/nvm && cd /opt/nvm\nret_code=$?\nif [ $ret_code -ne 0 ]; then\n  echo \"Git clone https://github.com/nvm-sh/nvm.git に失敗しました。終了します。\"\n  exit $ret_code\nfi\n./install.sh\nexport NVM_DIR=\"$HOME/.nvm\"\n[ -s \"$NVM_DIR/nvm.sh\" ] && \\. \"$NVM_DIR/nvm.sh\"\n[ -s \"$NVM_DIR/bash_completion\" ] && \\. \"$NVM_DIR/bash_completion\"\nnvm install 22\nnpm config set registry https://registry.npmmirror.com\nnpm i -g pnpm\n\necho \"#########################\"\necho \"# Flowise のインストール\"\necho \"#########################\"\ngit clone --depth 1 https://github.com/FlowiseAI/Flowise.git /opt/Flowise && cd /opt/Flowise\nret_code=$?\nif [ $ret_code -ne 0 ]; then\n  echo \"Git clone https://github.com/FlowiseAI/Flowise.git に失敗しました。終了します。\"\n  exit $ret_code\nfi\npnpm install\npnpm build\nnohup pnpm start > flowise.log 2>&1 &\n",
        "Type": "RunShellScript",
        "Sync": true,
        "InstanceIds": {
          "Fn::GetAtt": [
            "InstanceGroup",
            "InstanceIds"
          ]
        },
        "Timeout": 1800
      }
    },
    "VSwitch": {
      "Type": "ALIYUN::ECS::VSwitch",
      "Properties": {
        "VpcId": {
          "Ref": "Vpc"
        },
        "CidrBlock": "192.168.0.0/24",
        "ZoneId": {
          "Ref": "ZoneId"
        }
      }
    }
  },
  "Metadata": {
  }
}

詳細については、「このリソースを含むパブリックテンプレート」をご参照ください。