Use ALIYUN::ECS::VPC to create a virtual private cloud (VPC).
Syntax
{
"Type": "ALIYUN::ECS::VPC",
"Properties": {
"Description": String,
"Tags": List,
"Ipv6CidrBlock": String,
"EnableIpv6": Boolean,
"ResourceGroupId": String,
"VpcName": String,
"CidrBlock": String,
"Ipv6Isp": String,
"UserCidr": String,
"SecondaryCidrBlocks": List
}
}Properties
Property Name | Type | Required | Update allowed | Description | Constraints |
ResourceGroupId | String | No | Yes | The ID of the resource group. | None |
VpcName | String | No | Yes | The name of the VPC. | The value must be 2 to 128 characters in length. It must start with a letter or a Chinese character, but not with |
CidrBlock | String | No | Yes | The IPv4 CIDR block of the VPC. | Valid values:
|
Description | String | No | Yes | The description of the VPC. | The description must be 2 to 256 characters in length. It cannot start with |
Ipv6CidrBlock | String | No | No | The IPv6 CIDR block of the VPC. | None |
EnableIpv6 | Boolean | No | Yes | Specifies whether to enable IPv6 for the VPC. | Valid values:
|
Tags | List | No | Yes | Tag | You can add up to 20 tags. For more information, see Tags properties. |
Ipv6Isp | String | No | No | The type of IPv6 address segment for the Virtual Private Cloud (VPC). | Valid values:
|
UserCidr | String | No | No | The user CIDR block. | To specify multiple CIDR blocks, separate them with commas (,). You can specify a maximum of three CIDR blocks. Note For more information about user CIDR blocks, see CIDR block FAQ. |
SecondaryCidrBlocks | List | No | No | SecondaryCidrBlocks | None |
Tags syntax
"Tags": [
{
"Value": String,
"Key": String
}
] Tags properties
Property Name | Type | Required | Update allowed | Description | Constraints |
Key | String | Yes | No | The key of the tag. | The key must be 1 to 128 characters in length. It cannot start with |
Value | String | No | No | The value of the tag. | The value must be 0 to 128 characters in length. It cannot start with |
Return values
Fn::GetAtt
VpcId: The ID of the VPC.
VRouterId: The ID of the vRouter.
RouteTableId: The ID of the route table.
VpcName: The name of the VPC.
Examples
Scenario 1: Create a VPC
ROSTemplateFormatVersion: '2015-09-01'
Parameters:
VpcCidrBlock:
Type: String
Label: VPC IPv4 CIDR block
Description: 'The IP address range of the VPC in CIDR block format.<br>You can use the following IP address ranges and their subnets:<br><font color=''green''>[10.0.0.0/8]</font><br><font color=''green''>[172.16.0.0/12]</font><br><font color=''green''>[192.168.0.0/16]</font>'
Default: 192.168.0.0/16
AssociationProperty: ALIYUN::VPC::VPC::CidrBlock
VpcName:
Type: String
Label: VPC Name
Description: The name of the VPC. It must be 2 to 128 characters in length, start with an uppercase or lowercase letter or a Chinese character, and can contain numbers, underscores (_), and hyphens (-).
ConstraintDescription: 'The name must be 2 to 128 characters in length.'
Default: MyVpc
MinLength: 2
MaxLength: 128
Resources:
Vpc:
Type: ALIYUN::ECS::VPC
Properties:
CidrBlock:
Ref: VpcCidrBlock
VpcName:
Ref: VpcName
Outputs:
VRouterId:
Description: Router ID of the created VPC.
Value:
Fn::GetAtt:
- Vpc
- VRouterId
RouteTableId:
Description: The route table ID of the created VPC.
Value:
Fn::GetAtt:
- Vpc
- RouteTableId
VpcId:
Description: ID of the created VPC.
Value:
Fn::GetAtt:
- Vpc
- VpcId
{
"ROSTemplateFormatVersion": "2015-09-01",
"Parameters": {
"VpcCidrBlock": {
"Type": "String",
"Label": {
"en": "VPC CIDR IPv4 Block"
},
"Description": {
"en": "The ip address range of the VPC in the CidrBlock form; <br>You can use the following ip address ranges and their subnets: <br><font color='green'>[10.0.0.0/8]</font><br><font color='green'>[172.16.0.0/12]</font><br><font color='green'>[192.168.0.0/16]</font>"
},
"Default": "192.168.0.0/16",
"AssociationProperty": "ALIYUN::VPC::VPC::CidrBlock"
},
"VpcName": {
"Type": "String",
"Label": {
"en": "VPC Name"
},
"Description": {
"en": "VPC name, 2 to 128 characters in length, beginning with size letters or Chinese characters, including Numbers, '_' or '-'.",
},
"ConstraintDescription": {
"en": "[2, 128] English or Chinese characters"
},
"Default": "MyVpc",
"MinLength": 2,
"MaxLength": 128
}
},
"Resources": {
"Vpc": {
"Type": "ALIYUN::ECS::VPC",
"Properties": {
"CidrBlock": {
"Ref": "VpcCidrBlock"
},
"VpcName": {
"Ref": "VpcName"
}
}
}
},
"Outputs": {
"VRouterId": {
"Description": "Router id of created VPC.",
"Value": {
"Fn::GetAtt": [
"Vpc",
"VRouterId"
]
}
},
"RouteTableId": {
"Description": "The router table id of created VPC.",
"Value": {
"Fn::GetAtt": [
"Vpc",
"RouteTableId"
]
}
},
"VpcId": {
"Description": "Id of created VPC.",
"Value": {
"Fn::GetAtt": [
"Vpc",
"VpcId"
]
}
}
}
}Scenario 2: Create a dual-stack (IPv4 and IPv6) ECS instance and configure an IPv6 gateway and bandwidth
ROSTemplateFormatVersion: '2015-09-01'
Description:
en: Create a dual-stack cloud server (ECS) and automatically configure IPv6 public IP, including VPC, security group, IPv6 gateway and bandwidth settings.
Parameters:
InstanceImageId:
AssociationPropertyMetadata:
InstanceType: ${InstanceType}
SupportedImageOwnerAlias:
- system
- self
- others
Description:
en: 'The image ID.
For Linux, select: <font color=''red''><b>centos_7</font>
For Windows, select: <font color=''red''><b>win2008r2, win2012r2, or win2016</font>'
Default: centos_7_04_64_20G_alibase_201701015.vhd
Label:
en: Image
AssociationProperty: ALIYUN::ECS::Image::ImageId
Type: String
SystemDiskCategory:
AssociationProperty: ALIYUN::ECS::Disk::SystemDiskCategory
AssociationPropertyMetadata:
LocaleKey: DiskCategory
InstanceType: ${InstanceType}
Type: String
Description:
en: '<font color=''blue''>Valid values:</font>
[cloud_efficiency: <font color=''green''>ultra disk</font>]<br>[cloud_ssd: <font color=''green''>standard SSD</font>]<br>[cloud_essd: <font color=''green''>enterprise SSD</font>]<br>[cloud: <font color=''green''>basic disk</font>]<br>[ephemeral_ssd: <font color=''green''>local SSD</font>]'
Label:
en: System Disk Type
SystemDiskSize:
Default: 40
Type: Number
Description:
en: 'The size of the system disk. Unit: GB. Valid values: 20 to 500.'
Label:
en: System Disk Space
VpcCidrBlock:
Default: 192.168.0.0/16
Label:
en: VPC IPv4 CIDR Block
Type: String
Description:
en: 'The IPv4 CIDR block of the VPC. We recommend that you use one of the following CIDR blocks:<br><font color=''green''>[10.0.0.0/8]</font><br><font color=''green''>[172.16.0.0/12]</font><br><font color=''green''>[192.168.0.0/16]</font>'
AllowedValues:
- 192.168.0.0/16
- 172.16.0.0/12
- 10.0.0.0/8
InstanceType:
AssociationProperty: ALIYUN::ECS::Instance::InstanceType
AssociationPropertyMetadata:
ZoneId: VSwitchZoneId
Type: String
Description:
en: 'The instance type. Make sure that the instance type is available in the selected zone.<br>A common instance type is <font color=''red''><b>ecs.c5.large</font>.
Note: Some zones may not support all instance types.<br>For more information, see <a href=''https://www.alibabacloud.com/help/en/doc-detail/25378.html'' target=''_blank''><b><font color=''blue''>Instance families</font></a>.'
Label:
en: Instance Type
InstancePassword:
Description:
en: 'The logon password of the ECS instance. The password must be 8 to 30 characters in length and contain at least three of the following character types: uppercase letters, lowercase letters, digits, and special characters ()`~!@#$%^&*_-+=|{}[]:;''<>,.?/.'
Type: String
Label:
en: Instance Password
NoEcho: true
AssociationProperty: ALIYUN::ECS::Instance::Password
ConstraintDescription:
en: 'The password must be 8 to 30 characters in length and contain at least three of the following character types: uppercase letters, lowercase letters, digits, and special characters ()`~!@#$%^&*_-+=|{}[]:;''<>,.?/.'
VSwitchCidrBlock:
Default: 192.168.0.0/24
Type: String
Description:
en: The IPv4 CIDR block of the vSwitch. The CIDR block must be a subnet of the VPC.
Label:
en: vSwitch IPv4 CIDR Block
InternetChargeType:
Default: PayByBandwidth
AssociationPropertyMetadata:
LocaleKey: InternetChargeType
Label:
en: IPv6 Internet Bandwidth Billing Method
Type: String
AllowedValues:
- PayByTraffic
- PayByBandwidth
IPV6Bandwidth:
Default: 10
Type: Number
Description:
en: 'The public bandwidth of the IPv6 gateway. Unit: Mbit/s. Valid values: 1 to 5000. If you set the billing method to pay-by-traffic, the value range is 1 to 2000. If you set the billing method to pay-by-bandwidth, the value range is 1 to 5000.'
Label:
en: IPv6 Gateway Public Bandwidth
VSwitchZoneId:
AssociationProperty: ALIYUN::ECS::Instance:ZoneId
Type: String
Description:
en: 'The ID of the zone.
<b>Note: <font color=''blue''>Before you select a zone, make sure that the zone supports the ECS resources that you want to create. We recommend that you select a zone that is different from the zones of other vSwitches.</font>'
Label:
en: vSwitch Zone
InstancePublicIP:
Default: false
Type: Boolean
Description:
en: Specifies whether to assign a public IPv4 address.
Label:
en: Allocate Public IPv4 Address
IPV6GateWaySpec:
AssociationPropertyMetadata:
LocaleKey: NatGatewaySpec
Description:
en: 'The edition of the IPv6 gateway. Valid values: Small (Free Edition), Medium (Enterprise Edition), and Large (Enterprise Enhanced Edition).'
Default: Small
Label:
en: IPv6 Gateway Specification
AllowedValues:
- Small
- Medium
- Large
Type: String
Outputs:
EcsInstanceId:
Description: EcsInstance InstanceId
Value:
Fn::GetAtt:
- EcsInstance
- InstanceId
EcsInstancePrivateIp:
Description: EcsInstance PrivateIp
Value:
Fn::GetAtt:
- EcsInstance
- PrivateIp
EcsInstanceIpv6Address:
Description: EcsInstance Ipv6Address
Value:
Fn::Select:
- '0'
- Fn::GetAtt:
- EcsAssignIpv6Addresses
- Ipv6Addresses
Conditions: {}
Resources:
EcsSecurityGroup:
Type: ALIYUN::ECS::SecurityGroup
Properties:
SecurityGroupIngress:
- Priority: 1
IpProtocol: tcp
NicType: intranet
SourceCidrIp: 0.0.0.0/0
PortRange: 3389/3389
- Priority: 1
IpProtocol: all
NicType: intranet
Ipv6SourceCidrIp: '::/0'
PortRange: '-1/-1'
VpcId:
Ref: EcsVpc
SecurityGroupEgress:
- Priority: 1
IpProtocol: tcp
DestCidrIp: 0.0.0.0/0
NicType: intranet
PortRange: 3389/3389
- Ipv6DestCidrIp: '::/0'
IpProtocol: all
Priority: 1
NicType: intranet
PortRange: '-1/-1'
WaitConditionHandle:
Type: ALIYUN::ROS::WaitConditionHandle
Properties: {}
VpcIpv6InternetBandwidth:
Type: ALIYUN::VPC::Ipv6InternetBandwidth
Properties:
InternetChargeType:
Ref: InternetChargeType
Bandwidth:
Ref: IPV6Bandwidth
Ipv6AddressId:
Fn::Select:
- 0
- Fn::GetAtt:
- EcsAssignIpv6Addresses
- Ipv6AddressIds
Ipv6GatewayId:
Ref: VpcIpv6Gateway
DependsOn:
- EcsAssignIpv6Addresses
- VpcIpv6Gateway
VpcIpv6Gateway:
Type: ALIYUN::VPC::Ipv6Gateway
Properties:
VpcId:
Ref: EcsVpc
Name: MyIpv6Gateway
Spec:
Ref: IPV6GateWaySpec
EcsAssignIpv6Addresses:
Type: ALIYUN::ECS::AssignIpv6Addresses
Properties:
NetworkInterfaceId:
Fn::GetAtt:
- EcsInstance
- PrimaryNetworkInterfaceId
Ipv6AddressCount: 1
DependsOn:
- EcsInstance
EcsVSwitch:
Type: ALIYUN::ECS::VSwitch
Properties:
Ipv6CidrBlock: 0
VpcId:
Ref: EcsVpc
CidrBlock:
Ref: VSwitchCidrBlock
ZoneId:
Ref: VSwitchZoneId
WaitCondition:
Type: ALIYUN::ROS::WaitCondition
Properties:
Count: 1
Handle:
Ref: WaitConditionHandle
Timeout: 900
EcsInstance:
Type: ALIYUN::ECS::Instance
Properties:
UserData:
Fn::Replace:
- ros-notify:
Fn::GetAtt:
- WaitConditionHandle
- CurlCli
- Fn::Join:
- ''
- - '#!/bin/sh'
- |2
- |
cd /opt
- |
wget http://ecs-image-utils.oss-cn-hangzhou.aliyuncs.com/ipv6/rhel/ecs-utils-ipv6
- |
chmod +x ./ecs-utils-ipv6
- |
./ecs-utils-ipv6
- |
ros-notify -d "{\"Data\" : \"SUCCESS\", \"Status\" : \"SUCCESS\"}"
SystemDiskCategory:
Ref: SystemDiskCategory
VpcId:
Ref: EcsVpc
SecurityGroupId:
Ref: EcsSecurityGroup
SystemDiskSize:
Ref: SystemDiskSize
ImageId:
Ref: InstanceImageId
AllocatePublicIP:
Ref: InstancePublicIP
VSwitchId:
Ref: EcsVSwitch
IoOptimized: optimized
Password:
Ref: InstancePassword
InstanceType:
Ref: InstanceType
DependsOn:
- EcsSecurityGroup
- EcsVSwitch
- EcsVpc
EcsVpc:
Type: ALIYUN::ECS::VPC
Properties:
CidrBlock:
Ref: VpcCidrBlock
VpcName:
Fn::Join:
- '-'
- - StackId
- Ref: ALIYUN::StackId
EnableIpv6: true
Metadata:
ALIYUN::ROS::Interface:
ParameterGroups:
- Parameters:
- VpcCidrBlock
- VSwitchCidrBlock
- VSwitchZoneId
- InstanceType
- InstanceImageId
- SystemDiskSize
- InstancePublicIP
- InternetChargeType
- IPV6Bandwidth
- IPV6GateWaySpec
- SystemDiskCategory
- InstancePassword
Label:
default: ECS
{
"ROSTemplateFormatVersion": "2015-09-01",
"Description": {
"en": "Create a dual-stack cloud server (ECS) and automatically configure IPv6 public IP, including VPC, security group, IPv6 gateway and bandwidth settings."
},
"Parameters": {
"InstanceImageId": {
"AssociationPropertyMetadata": {
"InstanceType": "${InstanceType}",
"SupportedImageOwnerAlias": [
"system",
"self",
"others"
]
},
"Description": {
"en": "The image ID.
For Linux, select: <font color='red'><b>centos_7</font>
For Windows, select: <font color='red'><b>win2008r2, win2012r2, or win2016</font>"
},
"Default": "centos_7_04_64_20G_alibase_201701015.vhd",
"Label": {
"en": "Image"
},
"AssociationProperty": "ALIYUN::ECS::Image::ImageId",
"Type": "String"
},
"SystemDiskCategory": {
"AssociationProperty": "ALIYUN::ECS::Disk::SystemDiskCategory",
"AssociationPropertyMetadata": {
"LocaleKey": "DiskCategory",
"InstanceType": "${InstanceType}"
},
"Type": "String",
"Description": {
"en": "<font color='blue'>Valid values:</font>
[cloud_efficiency: <font color='green'>ultra disk</font>]<br>[cloud_ssd: <font color='green'>standard SSD</font>]<br>[cloud_essd: <font color='green'>enterprise SSD</font>]<br>[cloud: <font color='green'>basic disk</font>]<br>[ephemeral_ssd: <font color='green'>local SSD</font>]"
},
"Label": {
"en": "System Disk Type"
}
},
"SystemDiskSize": {
"Default": 40,
"Type": "Number",
"Description": {
"en": "The size of the system disk. Unit: GB. Valid values: 20 to 500."
},
"Label": {
"en": "System Disk Space"
}
},
"VpcCidrBlock": {
"Default": "192.168.0.0/16",
"Label": {
"en": "VPC IPv4 CIDR Block"
},
"Type": "String",
"Description": {
"en": "The IPv4 CIDR block of the VPC. We recommend that you use one of the following CIDR blocks:<br><font color='green'>[10.0.0.0/8]</font><br><font color='green'>[172.16.0.0/12]</font><br><font color='green'>[192.168.0.0/16]</font>"
},
"AllowedValues": [
"192.168.0.0/16",
"172.16.0.0/12",
"10.0.0.0/8"
]
},
"InstanceType": {
"AssociationProperty": "ALIYUN::ECS::Instance::InstanceType",
"AssociationPropertyMetadata": {
"ZoneId": "VSwitchZoneId"
},
"Type": "String",
"Description": {
"en": "The instance type. Make sure that the instance type is available in the selected zone.<br>A common instance type is <font color='red'><b>ecs.c5.large</font>.
Note: Some zones may not support all instance types.<br>For more information, see <a href='https://www.alibabacloud.com/help/en/doc-detail/25378.html' target='_blank'><b><font color='blue'>Instance families</font></a>."
},
"Label": {
"en": "Instance Type"
}
},
"InstancePassword": {
"Description": {
"en": "The logon password of the ECS instance. The password must be 8 to 30 characters in length and contain at least three of the following character types: uppercase letters, lowercase letters, digits, and special characters ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/."
},
"Type": "String",
"Label": {
"en": "Instance Password"
},
"NoEcho": true,
"AssociationProperty": "ALIYUN::ECS::Instance::Password",
"ConstraintDescription": {
"en": "The password must be 8 to 30 characters in length and contain at least three of the following character types: uppercase letters, lowercase letters, digits, and special characters ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/."
}
},
"VSwitchCidrBlock": {
"Default": "192.168.0.0/24",
"Type": "String",
"Description": {
"en": "The IPv4 CIDR block of the vSwitch. The CIDR block must be a subnet of the VPC."
},
"Label": {
"en": "vSwitch IPv4 CIDR Block"
}
},
"InternetChargeType": {
"Default": "PayByBandwidth",
"AssociationPropertyMetadata": {
"LocaleKey": "InternetChargeType"
},
"Label": {
"en": "IPv6 Internet Bandwidth Billing Method"
},
"Type": "String",
"AllowedValues": [
"PayByTraffic",
"PayByBandwidth"
]
},
"IPV6Bandwidth": {
"Default": 10,
"Type": "Number",
"Description": {
"en": "The public bandwidth of the IPv6 gateway. Unit: Mbit/s. Valid values: 1 to 5000. If you set the billing method to pay-by-traffic, the value range is 1 to 2000. If you set the billing method to pay-by-bandwidth, the value range is 1 to 5000."
},
"Label": {
"en": "IPv6 Gateway Public Bandwidth"
}
},
"VSwitchZoneId": {
"AssociationProperty": "ALIYUN::ECS::Instance:ZoneId",
"Type": "String",
"Description": {
"en": "The ID of the zone.
<b>Note: <font color='blue'>Before you select a zone, make sure that the zone supports the ECS resources that you want to create. We recommend that you select a zone that is different from the zones of other vSwitches.</font>"
},
"Label": {
"en": "vSwitch Zone"
}
},
"InstancePublicIP": {
"Default": false,
"Type": "Boolean",
"Description": {
"en": "Specifies whether to assign a public IPv4 address."
},
"Label": {
"en": "Allocate Public IPv4 Address"
}
},
"IPV6GateWaySpec": {
"AssociationPropertyMetadata": {
"LocaleKey": "NatGatewaySpec"
},
"Description": {
"en": "The edition of the IPv6 gateway. Valid values: Small (Free Edition), Medium (Enterprise Edition), and Large (Enterprise Enhanced Edition)."
},
"Default": "Small",
"Label": {
"en": "IPv6 Gateway Specification"
},
"AllowedValues": [
"Small",
"Medium",
"Large"
],
"Type": "String"
}
},
"Outputs": {
"EcsInstanceId": {
"Description": "EcsInstance InstanceId",
"Value": {
"Fn::GetAtt": [
"EcsInstance",
"InstanceId"
]
}
},
"EcsInstancePrivateIp": {
"Description": "EcsInstance PrivateIp",
"Value": {
"Fn::GetAtt": [
"EcsInstance",
"PrivateIp"
]
}
},
"EcsInstanceIpv6Address": {
"Description": "EcsInstance Ipv6Address",
"Value": {
"Fn::Select": [
"0",
{
"Fn::GetAtt": [
"EcsAssignIpv6Addresses",
"Ipv6Addresses"
]
}
]
}
}
},
"Conditions": {},
"Resources": {
"EcsSecurityGroup": {
"Type": "ALIYUN::ECS::SecurityGroup",
"Properties": {
"SecurityGroupIngress": [
{
"Priority": 1,
"IpProtocol": "tcp",
"NicType": "intranet",
"SourceCidrIp": "0.0.0.0/0",
"PortRange": "3389/3389"
},
{
"Priority": 1,
"IpProtocol": "all",
"NicType": "intranet",
"Ipv6SourceCidrIp": "::/0",
"PortRange": "-1/-1"
}
],
"VpcId": {
"Ref": "EcsVpc"
},
"SecurityGroupEgress": [
{
"Priority": 1,
"IpProtocol": "tcp",
"DestCidrIp": "0.0.0.0/0",
"NicType": "intranet",
"PortRange": "3389/3389"
},
{
"Ipv6DestCidrIp": "::/0",
"IpProtocol": "all",
"Priority": 1,
"NicType": "intranet",
"PortRange": "-1/-1"
}
]
}
},
"WaitConditionHandle": {
"Type": "ALIYUN::ROS::WaitConditionHandle",
"Properties": {}
},
"VpcIpv6InternetBandwidth": {
"Type": "ALIYUN::VPC::Ipv6InternetBandwidth",
"Properties": {
"InternetChargeType": {
"Ref": "InternetChargeType"
},
"Bandwidth": {
"Ref": "IPV6Bandwidth"
},
"Ipv6AddressId": {
"Fn::Select": [
0,
{
"Fn::GetAtt": [
"EcsAssignIpv6Addresses",
"Ipv6AddressIds"
]
}
]
},
"Ipv6GatewayId": {
"Ref": "VpcIpv6Gateway"
}
},
"DependsOn": [
"EcsAssignIpv6Addresses",
"VpcIpv6Gateway"
]
},
"VpcIpv6Gateway": {
"Type": "ALIYUN::VPC::Ipv6Gateway",
"Properties": {
"VpcId": {
"Ref": "EcsVpc"
},
"Name": "MyIpv6Gateway",
"Spec": {
"Ref": "IPV6GateWaySpec"
}
}
},
"EcsAssignIpv6Addresses": {
"Type": "ALIYUN::ECS::AssignIpv6Addresses",
"Properties": {
"NetworkInterfaceId": {
"Fn::GetAtt": [
"EcsInstance",
"PrimaryNetworkInterfaceId"
]
},
"Ipv6AddressCount": 1
},
"DependsOn": [
"EcsInstance"
]
},
"EcsVSwitch": {
"Type": "ALIYUN::ECS::VSwitch",
"Properties": {
"Ipv6CidrBlock": 0,
"VpcId": {
"Ref": "EcsVpc"
},
"CidrBlock": {
"Ref": "VSwitchCidrBlock"
},
"ZoneId": {
"Ref": "VSwitchZoneId"
}
}
},
"WaitCondition": {
"Type": "ALIYUN::ROS::WaitCondition",
"Properties": {
"Count": 1,
"Handle": {
"Ref": "WaitConditionHandle"
},
"Timeout": 900
}
},
"EcsInstance": {
"Type": "ALIYUN::ECS::Instance",
"Properties": {
"UserData": {
"Fn::Replace": [
{
"ros-notify": {
"Fn::GetAtt": [
"WaitConditionHandle",
"CurlCli"
]
}
},
{
"Fn::Join": [
"",
[
"#!/bin/sh",
" \n",
"cd /opt \n",
"wget http://ecs-image-utils.oss-cn-hangzhou.aliyuncs.com/ipv6/rhel/ecs-utils-ipv6 \n",
"chmod +x ./ecs-utils-ipv6 \n",
"./ecs-utils-ipv6 \n",
"ros-notify -d \"{\\\"Data\\\" : \\\"SUCCESS\\\", \\\"Status\\\" : \\\"SUCCESS\\\"}\" \n"
]
]
}
]
},
"SystemDiskCategory": {
"Ref": "SystemDiskCategory"
},
"VpcId": {
"Ref": "EcsVpc"
},
"SecurityGroupId": {
"Ref": "EcsSecurityGroup"
},
"SystemDiskSize": {
"Ref": "SystemDiskSize"
},
"ImageId": {
"Ref": "InstanceImageId"
},
"AllocatePublicIP": {
"Ref": "InstancePublicIP"
},
"VSwitchId": {
"Ref": "EcsVSwitch"
},
"IoOptimized": "optimized",
"Password": {
"Ref": "InstancePassword"
},
"InstanceType": {
"Ref": "InstanceType"
}
},
"DependsOn": [
"EcsSecurityGroup",
"EcsVSwitch",
"EcsVpc"
]
},
"EcsVpc": {
"Type": "ALIYUN::ECS::VPC",
"Properties": {
"CidrBlock": {
"Ref": "VpcCidrBlock"
},
"VpcName": {
"Fn::Join": [
"-",
[
"StackId",
{
"Ref": "ALIYUN::StackId"
}
]
]
},
"EnableIpv6": true
}
}
},
"Metadata": {
"ALIYUN::ROS::Interface": {
"ParameterGroups": [
{
"Parameters": [
"VpcCidrBlock",
"VSwitchCidrBlock",
"VSwitchZoneId",
"InstanceType",
"InstanceImageId",
"SystemDiskSize",
"InstancePublicIP",
"InternetChargeType",
"IPV6Bandwidth",
"IPV6GateWaySpec",
"SystemDiskCategory",
"InstancePassword"
],
"Label": {
"default": "ECS"
}
}
]
}
}
}Scenario 3: Create a VPC-type Classic Load Balancer (CLB) instance
ROSTemplateFormatVersion: '2015-09-01'
Description:
en: Creates a VPC and a vSwitch, and configures an internal-facing Server Load Balancer (SLB) instance. You can specify the instance type and address type.
Parameters:
VpcCidrBlock:
Type: String
Label:
en: VPC CIDR Block
Description:
en: 'The IPv4 CIDR block of the VPC. You can use the following CIDR blocks or their subnets: 10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0/16.'
Default: 192.168.0.0/16
AllowedValues:
- 192.168.0.0/16
- 172.16.0.0/12
- 10.0.0.0/8
VSwitchZoneId:
Type: String
Label:
en: Zone ID
Default: Null
Description:
en: The ID of the zone. Make sure that the zone supports SLB.
AssociationProperty: ALIYUN::ECS::Instance::ZoneId
VSwitchCidrBlock:
Type: String
Label:
en: vSwitch CIDR Block
Description:
en: The CIDR block of the vSwitch. It must be a subnet of the VPC and cannot be in use by another vSwitch.
Default: 192.168.0.0/24
LoadBalancerSpec:
Type: String
Label:
en: Specification
Description:
en: 'The specification of the SLB instance. For more information, see <a href=''https://www.alibabacloud.com/help/document_detail/85939.html'' target=''_blank''><font color=''blue''>SLB instance specifications</font>.</a>'
Default: slb.s1.small
Conditions: {}
Resources:
EcsVpc:
Type: ALIYUN::ECS::VPC
Properties:
CidrBlock:
Ref: VpcCidrBlock
VpcName:
Fn::Join:
- '-'
- - StackId
- Ref: ALIYUN::StackId
EcsVSwitch:
Type: ALIYUN::ECS::VSwitch
Properties:
ZoneId:
Ref: VSwitchZoneId
VpcId:
Ref: EcsVpc
CidrBlock:
Ref: VSwitchCidrBlock
VSwitchName:
Fn::Join:
- '-'
- - StackId
- Ref: ALIYUN::StackId
SlbLoadBalancer:
Type: ALIYUN::SLB::LoadBalancer
Properties:
VpcId:
Ref: EcsVpc
VSwitchId:
Ref: EcsVSwitch
AddressType: intranet
LoadBalancerName:
Fn::Join:
- '-'
- - StackId
- Ref: ALIYUN::StackId
LoadBalancerSpec:
Ref: LoadBalancerSpec
PayType: PayOnDemand
DependsOn: EcsVSwitch
Outputs:
SlbLoadBalancerId:
Description:
en: The ID of the SLB instance.
Value:
Fn::GetAtt:
- SlbLoadBalancer
- LoadBalancerId
Metadata:
ALIYUN::ROS::Interface:
ParameterGroups:
- Parameters:
- VpcCidrBlock
- VSwitchZoneId
- VSwitchCidrBlock
Label:
default:
en: VPC
- Parameters:
- LoadBalancerSpec
Label:
default:
en: SLB
{
"ROSTemplateFormatVersion": "2015-09-01",
"Description": {
"en": "Creates a VPC and a vSwitch, and configures an internal-facing Server Load Balancer (SLB) instance. You can specify the instance type and address type."
},
"Parameters": {
"VpcCidrBlock": {
"Type": "String",
"Label": {
"en": "VPC CIDR Block"
},
"Description": {
"en": "The IPv4 CIDR block of the VPC. You can use the following CIDR blocks or their subnets: 10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0/16."
},
"Default": "192.168.0.0/16",
"AllowedValues": [
"192.168.0.0/16",
"172.16.0.0/12",
"10.0.0.0/8"
]
},
"VSwitchZoneId": {
"Type": "String",
"Label": {
"en": "Zone ID"
},
"Default": null,
"Description": {
"en": "The ID of the zone. Make sure that the zone supports SLB."
},
"AssociationProperty": "ALIYUN::ECS::Instance::ZoneId"
},
"VSwitchCidrBlock": {
"Type": "String",
"Label": {
"en": "vSwitch CIDR Block"
},
"Description": {
"en": "The CIDR block of the vSwitch. It must be a subnet of the VPC and cannot be in use by another vSwitch."
},
"Default": "192.168.0.0/24"
},
"LoadBalancerSpec": {
"Type": "String",
"Label": {
"en": "Specification"
},
"Description": {
"en": "The specification of the SLB instance. For more information, see <a href='https://www.alibabacloud.com/help/document_detail/85939.html' target='_blank'><font color='blue'>SLB instance specifications</font>.</a>"
},
"Default": "slb.s1.small"
}
},
"Conditions": {},
"Resources": {
"EcsVpc": {
"Type": "ALIYUN::ECS::VPC",
"Properties": {
"CidrBlock": {
"Ref": "VpcCidrBlock"
},
"VpcName": {
"Fn::Join": [
"-",
[
"StackId",
{
"Ref": "ALIYUN::StackId"
}
]
]
}
}
},
"EcsVSwitch": {
"Type": "ALIYUN::ECS::VSwitch",
"Properties": {
"ZoneId": {
"Ref": "VSwitchZoneId"
},
"VpcId": {
"Ref": "EcsVpc"
},
"CidrBlock": {
"Ref": "VSwitchCidrBlock"
},
"VSwitchName": {
"Fn::Join": [
"-",
[
"StackId",
{
"Ref": "ALIYUN::StackId"
}
]
]
}
}
},
"SlbLoadBalancer": {
"Type": "ALIYUN::SLB::LoadBalancer",
"Properties": {
"VpcId": {
"Ref": "EcsVpc"
},
"VSwitchId": {
"Ref": "EcsVSwitch"
},
"AddressType": "intranet",
"LoadBalancerName": {
"Fn::Join": [
"-",
[
"StackId",
{
"Ref": "ALIYUN::StackId"
}
]
]
},
"LoadBalancerSpec": {
"Ref": "LoadBalancerSpec"
},
"PayType": "PayOnDemand"
},
"DependsOn": "EcsVSwitch"
}
},
"Outputs": {
"SlbLoadBalancerId": {
"Description": {
"en": "The ID of the SLB instance."
},
"Value": {
"Fn::GetAtt": [
"SlbLoadBalancer",
"LoadBalancerId"
]
}
}
},
"Metadata": {
"ALIYUN::ROS::Interface": {
"ParameterGroups": [
{
"Parameters": [
"VpcCidrBlock",
"VSwitchZoneId",
"VSwitchCidrBlock"
],
"Label": {
"default": {
"en": "VPC"
}
}
},
{
"Parameters": [
"LoadBalancerSpec"
],
"Label": {
"default": {
"en": "SLB"
}
}
}
]
}
}
}For more examples, see public templates that contain this resource.