全部產品
Search
文件中心

Resource Orchestration Service:ALIYUN::ECS::SecurityGroupClone

更新時間:Apr 10, 2025

ALIYUN::ECS::SecurityGroupClone類型用於複製安全性群組。

文法

{
  "Type": "ALIYUN::ECS::SecurityGroupClone",
  "Properties": {
    "DestinationRegionId": String,
    "VpcId": String,
    "Description": String,
    "SecurityGroupName": String,
    "SourceSecurityGroupId": String,
    "ResourceGroupId": String,
    "NetworkType": String,
    "SecurityGroupType": String
  }
}

屬性

屬性名稱類型必須允許更新描述約束
ResourceGroupIdString執行個體所在的資源群組ID。無。
SourceSecurityGroupId String用於複製的原始安全性群組ID。根據新安全性群組的網路類型,複製合適的安全性群組規則。
NetworkType String複製的新安全性群組網路類型為傳統網路。 取值:Classic。
VpcId String複製的新安全性群組所屬的VPC ID。 當同時指定VpcId和NetworkType時,NetworkType的設定無效。
Description String 安全性群組描述資訊。 長度為2~256個字元。不能以http://或https://開頭。
SecurityGroupName String安全性群組名稱。 預設值為空白。長度為2~128字元。必須以大小字母或中文開頭,可包含字母、漢字、數字、點號(.)、底線(_)和連字號(-),但不能以http://或https://開頭。
DestinationRegionIdString將安全性群組複製到指定地區。預設值:CURRENT。
SecurityGroupType String 安全性群組類型。 取值:
  • normal:基本安全性群組。
  • enterprise:進階安全性群組。

傳回值

Fn::GetAtt

SecurityGroupId:安全性群組ID。

樣本

  • YAML格式

    ROSTemplateFormatVersion: '2015-09-01'
    Description: Test ECS SecurityGroupClone
    Parameters:
      SourceSecurityGroupId:
        Type: String
        AssociationProperty: ALIYUN::ECS::SecurityGroup::SecurityGroupId
        Label:
          zh-cn: 安全性群組ID
          en: Security Group ID
        AssociationPropertyMetadata:
          VpcId: ${VpcId}
      VpcId:
        AssociationProperty: ALIYUN::ECS::VPC::VPCId
        Type: String
        Label:
          zh-cn: 現有VPC的執行個體ID
          en: Existing VPC Instance ID
      SecurityGroupName:
        Type: String
    Resources:
      SecurityGroupClone:
        Type: ALIYUN::ECS::SecurityGroupClone
        Properties:
          VpcId:
            Ref: VpcId
          SecurityGroupName:
            Ref: SecurityGroupName
          SourceSecurityGroupId:
            Ref: SourceSecurityGroupId
    Outputs:
      SecurityGroupId:
        Value:
          Fn::GetAtt:
            - SecurityGroupClone
            - SecurityGroupId
                        
  • JSON格式

    {
      "ROSTemplateFormatVersion": "2015-09-01",
      "Description": "Test ECS SecurityGroupClone",
      "Parameters": {
        "SourceSecurityGroupId": {
          "Type": "String",
          "AssociationProperty": "ALIYUN::ECS::SecurityGroup::SecurityGroupId",
          "Label": {
            "zh-cn": "安全性群組ID",
            "en": "Security Group ID"
          },
          "AssociationPropertyMetadata": {
            "VpcId": "${VpcId}"
          }
        },
        "VpcId": {
          "AssociationProperty": "ALIYUN::ECS::VPC::VPCId",
          "Type": "String",
          "Label": {
            "zh-cn": "現有VPC的執行個體ID",
            "en": "Existing VPC Instance ID"
          }
        },
        "SecurityGroupName": {
          "Type": "String"
        }
      },
      "Resources": {
        "SecurityGroupClone": {
          "Type": "ALIYUN::ECS::SecurityGroupClone",
          "Properties": {
            "VpcId": {
              "Ref": "VpcId"
            },
            "SecurityGroupName": {
              "Ref": "SecurityGroupName"
            },
            "SourceSecurityGroupId": {
              "Ref": "SourceSecurityGroupId"
            }
          }
        }
      },
      "Outputs": {
        "SecurityGroupId": {
          "Value": {
            "Fn::GetAtt": [
              "SecurityGroupClone",
              "SecurityGroupId"
            ]
          }
        }
      }
    }