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

CloudOps Orchestration Service:セキュリティグループの一括承認

最終更新日:Jan 17, 2025

テンプレート名

ACS-ECS-BulkyAuthorizeSecurityGroup

今すぐ実行

テンプレートの説明

複数のセキュリティグループに一度にセキュリティグループルールを作成します。

テンプレートタイプ

自動化

所有者

Alibaba Cloud

入力パラメーター

パラメーター

説明

タイプ

必須

デフォルト値

制限

securityGroupIds

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

リスト

はい

ipProtocol

トランスポート層プロトコル。

文字列

はい

portRange

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

文字列

はい

sourceCidrIp

送信元 IPv4 CIDR ブロック。例: 10.0.0.0/8。

文字列

はい

regionId

リージョン ID。

文字列

いいえ

{{ ACS::RegionId }}

nicType

ネットワークインターフェースカード (NIC) のタイプ。

文字列

いいえ

intranet

policy

アクセス制御ポリシー。有効値: accept および drop。

文字列

いいえ

accept

priority

セキュリティグループルールの優先度。有効値: 1 ~ 100

数値

いいえ

1

rateControl

レート制御設定。

JSON

いいえ

{'Mode': 'Concurrency', 'MaxErrors': 0, 'Concurrency': 10}

OOSAssumeRole

CloudOps Orchestration Service (OOS) がアシュームする Resource Access Management (RAM) ロール。

文字列

いいえ

""

出力パラメーター

なし

テンプレートを実行するために必要な権限ポリシー

{
    "Version": "1",
    "Statement": [
        {
            "Action": [
                "ecs:AuthorizeSecurityGroup"
            ],
            "Resource": "*",
            "Effect": "Allow"
        }
    ]
}

参照

詳細については、GitHub の ACS-ECS-BulkyAuthorizeSecurityGroup.yml をご参照ください。

テンプレートコンテンツ

FormatVersion: OOS-2019-06-01
Description:
  en: Add a security group policy to multiple security groups
  zh-cn: the description in Chinese
  name-en: ACS-ECS-BulkyAuthorizeSecurityGroup
  name-zh-cn: the description in Chinese
  categories:
    - instance_manage
    - computenest
Parameters:
  regionId:
    Type: String
    Label:
      en: RegionId
      zh-cn: the description in Chinese
    AssociationProperty: RegionId
    Default: '{{ ACS::RegionId }}'
  securityGroupIds:
    Label:
      en: SecurityGroupIds
      zh-cn: the description in Chinese
    Type: List
    AssociationProperty: ALIYUN::ECS::SecurityGroup::SecurityGroupId
  ipProtocol:
    Label:
      en: IpProtocol
      zh-cn: the description in Chinese
    Type: String
    AllowedValues:
      - tcp
      - udp
      - icmp
      - gre
      - all
  portRange:
    Label:
      en: PortRange
      zh-cn: the description in Chinese
    Description:
      en:  correct style:1/200, error style:200/1. ranges:(TCP/UDP:1~65535, ICMP:-1/-1, GRE:-1/-1, IpProtocol value is all:-1/-1)
      zh-cn: the description in Chinese  
    Type: String
  nicType:
    Label:
      en: NicType
      zh-cn: the description in Chinese
    Description:
      en:  (internet:public network card, intrant:inner network card)
      zh-cn: the description in Chinese
    Type: String
    AllowedValues:
      - internet
      - intranet
    Default: intranet
  policy:
    Label:
      en: Policy
      zh-cn: the description in Chinese
    Type: String
    AllowedValues:
      - accept
      - drop
    Default: accept
  priority:
    Label:
      en: Priority
      zh-cn: the description in Chinese  
    Type: Number
    MinValue: 1
    MaxValue: 100
    Default: 1
  sourceCidrIp:
    Label:
      en: SourceCidrIp
      zh-cn: the description in Chinese
    Type: String
  rateControl:
    Label:
      en: RateControl
      zh-cn: the description in Chinese
    Type: Json
    AssociationProperty: RateControl
    Default:
      Mode: Concurrency
      MaxErrors: 0
      Concurrency: 10
  OOSAssumeRole:
    Label:
      en: OOSAssumeRole
      zh-cn: the description in Chinese
    Type: String
    Default: ''
RamRole: '{{ OOSAssumeRole }}'
Tasks:
  - Name: AuthorizeSecurityGroup
    Action: 'ACS::ExecuteAPI'
    Description:
      en: Authorize Security Group Policy to multiple Security Group
      zh-cn: the description in Chinese
    Properties:
      Service: ECS
      API: AuthorizeSecurityGroup
      Parameters:
        RegionId: '{{ regionId }}'
        IpProtocol: '{{ ipProtocol }}'
        PortRange: '{{ portRange }}'
        NicType: '{{ nicType }}'
        Policy: '{{ policy }}'
        Priority: '{{ priority }}'
        SourceCidrIp: '{{ sourceCidrIp }}'
        SecurityGroupId: '{{ ACS::TaskLoopItem }}'
    Loop:
      RateControl: '{{ rateControl }}'
      Items: '{{ securityGroupIds }}'
Metadata:
  ALIYUN::OOS::Interface:
    ParameterGroups:
      - Parameters:
          - regionId
          - securityGroupIds
          - ipProtocol
          - portRange
          - nicType
          - policy
          - priority
          - sourceCidrIp
        Label:
          default:
            zh-cn: the description in Chinese
            en: Configure Parameters
      - Parameters:
          - rateControl
          - OOSAssumeRole
        Label:
          default:
            zh-cn: the description in Chinese
            en: Control Options