阅读984 返回首页    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__资源列表_资源编排-阿里云