閱讀984 返回首頁    go 阿裏雲 go 技術社區[雲棲]


ALIYUN::ECS::VSwitch__資源列表_資源編排-阿裏雲

ALIYUN::ECS::VSwitch 類型可用於新建交換機。

語法

{
   "Type" : "ALIYUN::ECS::EIP",
   "Properties" : {
         "ZoneId" : String,
      "CidrBlock" : String,
      "VpcId" : String,
      "VSwitchName" : String,
      "Description" : String
   }
}

屬性

ZoneId

可用區 Id

CidrBlock

指定VSwitch的網段

VpcId

指定VSwitch所在的 VPC

VSwitchName

VSwitch名稱,不填則為空,默認值為空,[2, 128] 英文或中文字符,必須以大小字母或中文開頭,可包含數字,”_”或”-”,這個值會展示在控製台。不能以 https:// 和 https:// 開頭。

Description

VSwitch 描述,不填則為空,默認值為空,[2, 256] 英文或中文字符,不能以 https:// 和 https:// 開頭。

返回值

Fn::GetAtt

  • VSwitchId 係統分配的 VSwitchID

示例

{
  "ROSTemplateFormatVersion" : "2015-09-01",
  "Parameters" : {
    "VpcName" : {
      "Type" : "String"
    },
    "VSwitch1CidrBlock" : {
      "Type" : "String",
      "Default" : "172.16.100.0/24"
    },
    "VSwitch2CidrBlock": {
        "Type" : "String",
        "Default" : "172.16.80.0/24"
    }
  },
  "Resources" : {
    "EcsVpc": {
      "Type": "ALIYUN::ECS::VPC",
      "Properties": {
        "CidrBlock": "172.16.0.0/12",
        "VpcName": {"Ref" : "VpcName"},
      },
    },
    "VSwitch1": {
      "Type": "ALIYUN::ECS::VSwitch",
      "Properties": {
        "ZoneId": "cn-beijing-a",
        "CidrBlock": {"Ref" : "VSwitch1CidrBlock"},
        "VpcId": { "Fn::GetAtt" : [ "EcsVpc", "VpcId" ] },
        "VSwitchName": "create_vpc_vswitch_sg1"
      }
    },
    "VSwitch2": {
      "Type": "ALIYUN::ECS::VSwitch",
      "Properties": {
        "ZoneId": "cn-beijing-a",
        "CidrBlock": {"Ref" : "VSwitch2CidrBlock"},
        "VpcId": { "Fn::GetAtt" : [ "EcsVpc", "VpcId" ] },
        "VSwitchName": "create_vpc_vswitch_sg2"
      }
    },
    "SG_VSwitch1": {
      "Type": "ALIYUN::ECS::SecurityGroup",
      "Properties": {
        "SecurityGroupName": "app_mall",
        "Description": "this is created by heat",
        "VpcId": { "Fn::GetAtt" : [ "EcsVpc", "VpcId" ] }
      },
      "Outputs": {
        "SecurityGroupId": {
             "Value" : {"get_attr": ["SG_VSwitch1","SecurityGroupId"]}
        }
      }
    },
    "SG_VSwitch1_InRule": {
      "Type": "ALIYUN::ECS::SecurityGroupIngress",
      "Properties": {
        "SecurityGroupId": { "Fn::GetAtt" : [ "SG_VSwitch1", "SecurityGroupId" ] },
        "IpProtocol": "tcp",
        "PortRange": "1/65535",
        "SourceCidrIp": {"Ref" : "VSwitch2CidrBlock"}
      }
    },
    "SG_VSwitch1_OutRule": {
      "Type": "ALIYUN::ECS::SecurityGroupEgress",
      "Properties": {
        "SecurityGroupId": { "Fn::GetAtt" : [ "SG_VSwitch1", "SecurityGroupId" ] },
        "IpProtocol": "tcp",
        "PortRange": "1/65535",
        "DestCidrIp": {"Ref" : "VSwitch2CidrBlock"}
      }
    },
    "SG_VSwitch2": {
      "Type": "ALIYUN::ECS::SecurityGroup",
      "Properties": {
        "SecurityGroupName": "app_mall",
        "Description": "this is created by heat",
        "VpcId": { "Fn::GetAtt" : [ "EcsVpc", "VpcId" ] }
      },
    },
    "SG_VSwitch2_InRule": {
      "Type": "ALIYUN::ECS::SecurityGroupIngress",
      "Properties": {
        "SecurityGroupId": { "Fn::GetAtt" : [ "SG_VSwitch2", "SecurityGroupId" ] },
        "IpProtocol": "tcp",
        "PortRange": "1/65535",
        "SourceCidrIp": {"Ref" : "VSwitch1CidrBlock"}
      }
    },
    "SG_VSwitch2_OutRule": {
      "Type": "ALIYUN::ECS::SecurityGroupEgress",
      "Properties": {
        "SecurityGroupId": { "Fn::GetAtt" : [ "SG_VSwitch2", "SecurityGroupId" ] },
        "IpProtocol": "tcp",
        "PortRange": "1/65535",
        "DestCidrIp": {"Ref" : "VSwitch1CidrBlock"}
      }
    }
  }
}

最後更新:2016-11-23 16:04:02

  上一篇:go ALIYUN::ECS::VPC__資源列表_資源編排-阿裏雲
  下一篇:go ALIYUN::CS::App__資源列表_資源編排-阿裏雲