edit-icon download-icon

ALIYUN::ECS::VSwitch

Last Updated: Mar 22, 2018

The ALIYUN::ECS::VSwitch type is used to create a VSwitch.

Syntax

  1. {
  2. "Type" : "ALIYUN::ECS::VSwitch",
  3. "Properties" : {
  4. "ZoneId" : String,
  5. "CidrBlock" : String,
  6. "VpcId" : String,
  7. "VSwitchName" : String,
  8. "Description" : String
  9. }
  10. }

Attributes

Attribute name Type Required? Update allowed? Description Constraint
VpcId string Yes No ID of the VPC where a VSwitch is to be created N/A
ZoneId string Yes No Zone ID N/A
VSwitchName string No No VSwitch name The VSwitch name is a string of 2 to 128 characters. It must start with an uppercase/lowercase letter or a Chinese character and can contain English letters, Chinese characters, numbers, underscores(_), and hyphens(-). It cannot start with http:// or https://.
CidrBlock string No No CIDR Block of the VSwitch The CIDR Block of the VSwitch must be a subnet of the VPC to which the VSwitch belongs and not used by other switches.
Description string No No VSwitch description The description is a string of 2 to 256 characters. It cannot start with http:// or https://.

Return values

Fn::GetAtt

VSwitchId: VSwitch ID allocated by the system.

Example

  1. {
  2. "ROSTemplateFormatVersion" : "2015-09-01",
  3. "Parameters" : {
  4. "VpcName" : {
  5. "Type" : "String"
  6. },
  7. "VSwitch1CidrBlock" : {
  8. "Type" : "String",
  9. "Default" : "172.16.100.0/24"
  10. },
  11. "VSwitch2CidrBlock": {
  12. "Type" : "String",
  13. "Default" : "172.16.80.0/24"
  14. }
  15. },
  16. "Resources" : {
  17. "EcsVpc": {
  18. "Type": "ALIYUN::ECS::VPC",
  19. "Properties": {
  20. "CidrBlock": "172.16.0.0/12",
  21. "VpcName": {"Ref" : "VpcName"},
  22. },
  23. },
  24. "VSwitch1": {
  25. "Type": "ALIYUN::ECS::VSwitch",
  26. "Properties": {
  27. "ZoneId": "cn-beijing-a",
  28. "CidrBlock": {"Ref" : "VSwitch1CidrBlock"},
  29. "VpcId": { "Fn::GetAtt" : [ "EcsVpc", "VpcId" ] },
  30. "VSwitchName": "create_vpc_vswitch_sg1"
  31. }
  32. },
  33. "VSwitch2": {
  34. "Type": "ALIYUN::ECS::VSwitch",
  35. "Properties": {
  36. "ZoneId": "cn-beijing-a",
  37. "CidrBlock": {"Ref" : "VSwitch2CidrBlock"},
  38. "VpcId": { "Fn::GetAtt" : [ "EcsVpc", "VpcId" ] },
  39. "VSwitchName": "create_vpc_vswitch_sg2"
  40. }
  41. },
  42. "SG_VSwitch1": {
  43. "Type": "ALIYUN::ECS::SecurityGroup",
  44. "Properties": {
  45. "SecurityGroupName": "app_mall",
  46. "Description": "this is created by heat",
  47. "VpcId": { "Fn::GetAtt" : [ "EcsVpc", "VpcId" ] }
  48. },
  49. "Outputs": {
  50. "SecurityGroupId": {
  51. "Value" : {"get_attr": ["SG_VSwitch1","SecurityGroupId"]}
  52. }
  53. }
  54. },
  55. "SG_VSwitch1_InRule": {
  56. "Type": "ALIYUN::ECS::SecurityGroupIngress",
  57. "Properties": {
  58. "SecurityGroupId": { "Fn::GetAtt" : [ "SG_VSwitch1", "SecurityGroupId" ] },
  59. "IpProtocol": "tcp",
  60. "PortRange": "1/65535",
  61. "SourceCidrIp": {"Ref" : "VSwitch2CidrBlock"}
  62. }
  63. },
  64. "SG_VSwitch1_OutRule": {
  65. "Type": "ALIYUN::ECS::SecurityGroupEgress",
  66. "Properties": {
  67. "SecurityGroupId": { "Fn::GetAtt" : [ "SG_VSwitch1", "SecurityGroupId" ] },
  68. "IpProtocol": "tcp",
  69. "PortRange": "1/65535",
  70. "DestCidrIp": {"Ref" : "VSwitch2CidrBlock"}
  71. }
  72. },
  73. "SG_VSwitch2": {
  74. "Type": "ALIYUN::ECS::SecurityGroup",
  75. "Properties": {
  76. "SecurityGroupName": "app_mall",
  77. "Description": "this is created by heat",
  78. "VpcId": { "Fn::GetAtt" : [ "EcsVpc", "VpcId" ] }
  79. },
  80. },
  81. "SG_VSwitch2_InRule": {
  82. "Type": "ALIYUN::ECS::SecurityGroupIngress",
  83. "Properties": {
  84. "SecurityGroupId": { "Fn::GetAtt" : [ "SG_VSwitch2", "SecurityGroupId" ] },
  85. "IpProtocol": "tcp",
  86. "PortRange": "1/65535",
  87. "SourceCidrIp": {"Ref" : "VSwitch1CidrBlock"}
  88. }
  89. },
  90. "SG_VSwitch2_OutRule": {
  91. "Type": "ALIYUN::ECS::SecurityGroupEgress",
  92. "Properties": {
  93. "SecurityGroupId": { "Fn::GetAtt" : [ "SG_VSwitch2", "SecurityGroupId" ] },
  94. "IpProtocol": "tcp",
  95. "PortRange": "1/65535",
  96. "DestCidrIp": {"Ref" : "VSwitch1CidrBlock"}
  97. }
  98. }
  99. }
  100. }
Thank you! We've received your feedback.