The ALIYUN::ECS::Instance resource type creates an Elastic Compute Service (ECS) instance.
This resource is no longer updated. Use the ALIYUN::ECS::InstanceGroup resource instead.
Syntax
{
"Type": "ALIYUN::ECS::Instance",
"Properties": {
"DedicatedHostId": String,
"Period": Number,
"AutoRenew": String,
"RamRoleName": String,
"IoOptimized": String,
"InternetChargeType": String,
"PrivateIpAddress": String,
"KeyPairName": String,
"SystemDiskDiskName": String,
"PeriodUnit": String,
"Description": String,
"Tags": List,
"HostName": String,
"AutoRenewPeriod": Number,
"ImageId": String,
"ResourceGroupId": String,
"InstanceChargeType": String,
"VSwitchId": String,
"Password": String,
"PasswordInherit": Boolean,
"InstanceType": String,
"SystemDiskCategory": String,
"SubscriptionDeletionForce": Boolean,
"UserData": String,
"SystemDiskSize": Number,
"ZoneId": String,
"InternetMaxBandwidthOut": Integer,
"VpcId": String,
"SpotStrategy": String,
"InstanceName": String,
"DeletionProtection": Boolean,
"DeploymentSetId": String,
"SecurityGroupIds": List,
"SecurityGroupId": String,
"SecurityEnhancementStrategy": String,
"SpotPriceLimit": String,
"HpcClusterId": String,
"AllocatePublicIP": Boolean,
"SystemDiskDescription": String,
"SystemDiskPerformanceLevel": String,
"DiskMappings": List,
"SpotInterruptionBehavior": String,
"ZoneIds": List,
"SpotDuration": Integer,
"CreditSpecification": String,
"PrivatePoolOptions": Map,
"StorageSetId": String,
"HttpTokens": String,
"HttpEndpoint": String,
"Tenancy": String,
"StorageSetPartitionNumber": Integer,
"DeploymentSetGroupNo": Integer,
"Affinity": String,
"UseAdditionalService": Boolean,
"ImageFamily": String
}
}Properties
Property name | Type | Required | Update allowed | Description | Constraint |
ResourceGroupId | String | No | Yes | The ID of the resource group. | None |
SpotInterruptionBehavior | String | No | No | The interruption mode for a spot instance. | Only Terminate is supported. This value releases the instance immediately. Terminate is the default value. |
ZoneIds | List | No | No | A list of zones. | This property takes effect only when you select parameters in the console. |
SpotDuration | Integer | No | No | The retention period for a spot instance. | Valid values: 0 to 6. Unit: hours.
|
SecurityGroupIds | List | No | No | A list of security group IDs. | You can specify either SecurityGroupId or SecurityGroupIds, but not both. |
ImageId | String | No | Yes | The image ID. Valid values include public images, custom images, and Alibaba Cloud Marketplace images. | To specify a public image, you can enter a partial image ID instead of the complete image ID. Public images support fuzzy search. For example:
|
InstanceType | String | Yes | Yes | The ECS instance type. | For more information about ECS instance types, see Instance families. |
SecurityGroupId | String | No | No | The security group ID. | You can specify either SecurityGroupId or SecurityGroupIds, but not both. |
SecurityEnhancementStrategy | String | No | No | Specifies whether to enable security hardening. | Valid values are:
|
Description | String | No | Yes | The description. | Length: 2 to 256 characters. |
InstanceName | String | No | Yes | The instance name. | The name must be 2 to 128 characters long. It must start with an English letter or a Chinese character and cannot start with If you leave this property empty, the instance ID is used by default. |
Password | String | No | Yes | The logon password for the ECS instance. | Length: 8 to 30 characters. The password must contain at least three of the following character types: uppercase letters, lowercase letters, digits, and special characters. Valid special characters: |
PasswordInherit | Boolean | No | No | Specifies whether to use the password preset in the image. | Valid values are:
Note Set Password to empty when you use this property. Also, make sure the runtime image that you use has a password configured. |
HostName | String | No | Yes | The hostname of the ECS instance. | The hostname must be at least two characters in length. It cannot start or end with a period (.) or hyphen (-), or contain consecutive periods (.) or hyphens (-).
|
AllocatePublicIP | Boolean | No | No | Specifies whether to assign a public IP address. | Value:
Note If InternetMaxBandwidthOut is greater than 0, a public IP address is assigned. |
PrivateIpAddress | String | No | No | The private IP address in a virtual private cloud (VPC). | The IP address cannot duplicate another instance's IP address in the VPC. |
InternetChargeType | String | No | Yes | The billing method for public network access. | Valid values:
|
InternetMaxBandwidthOut | Integer | No | Yes | The maximum outbound public bandwidth. | Valid values: 0 to 100. Default value: 0. Unit: Mbit/s. |
IoOptimized | String | No | No | Specifies whether to create an I/O optimized instance. | Valid values:
|
DiskMappings | List | No | Yes | The data disks to attach. | You can specify up to 16 data disks. For more information, see DiskMappings syntax and DiskMappings properties. |
SystemDiskCategory | String | No | Yes | The system disk category. | Valid values are:
For non-I/O optimized instances of a retired instance type, the default value is cloud. For instances of other types, the default value is cloud_efficiency. |
SystemDiskDescription | String | No | No | The system disk description. | None |
SystemDiskDiskName | String | No | No | The system disk name. | Length: 2 to 128 characters. The name must start with a letter or a Chinese character. It cannot start with |
SystemDiskSize | Number | No | Yes | The system disk size. | Valid values: 20 to 500. Unit: GB. If you use a custom image to create a system disk, you must ensure that the system disk is larger than the custom image size. |
Tags | List | No | Yes | The custom tags. | You can specify up to 20 tags. Format: For more information, see Tags syntax and Tags properties. |
UserData | String | No | Yes | The user data passed when creating the ECS instance. | The content must be less than 16 KiB. Do not Base64-encode the content. Escape special characters with backslashes (\). |
ZoneId | String | No | No | The zone ID. | None |
HpcClusterId | String | No | No | The ID of the HPC cluster to which the instance belongs. | None |
VpcId | String | No | No | The virtual private cloud (VPC) ID. | None |
VSwitchId | String | No | No | The vSwitch ID. | None |
InstanceChargeType | String | No | No | The billing method for the ECS instance. | Valid values are:
|
Period | Number | No | No | The billing period. | If InstanceChargeType is PrePaid, Period is required. If InstanceChargeType is PostPaid, Period is optional. |
KeyPairName | String | No | Yes | The name of the key pair bound to the ECS instance. | If the instance type is Windows, ignore this property. If the instance type is Linux, password-based logon is disabled during initialization. To improve security, use key pair-based logon. |
RamRoleName | String | No | No | The name of the instance RAM role. | For more information, see CreateRole and ListRoles. |
SpotPriceLimit | String | No | No | The maximum hourly price for the instance. | Up to three decimal places are supported. This property takes effect only when SpotStrategy is SpotWithPriceLimit. |
SpotStrategy | String | No | No | The bidding strategy for a pay-as-you-go instance. | You must specify this property when InstanceChargeType is set to PostPaid. Values:
|
DedicatedHostId | String | No | No | The Dedicated Host on which to create the ECS instance. | You can query the list of Dedicated Host IDs by calling the DescribeDedicatedHosts API. You cannot create spot instances on Dedicated Hosts. If you specify `DedicatedHostId`, the system automatically ignores the `SpotStrategy` and `SpotPriceLimit` settings in the request. |
PeriodUnit | String | No | No | The duration of the purchase. | Valid values are:
|
AutoRenewPeriod | Number | No | No | The duration of each auto-renewal. | AutoRenewPeriod is a required property when AutoRenew is set to True. Values:
|
AutoRenew | String | No | No | Specifies whether to enable auto-renewal. | Valid values:
This property is required when you set the InstanceChargeType property to PrePaid. |
DeletionProtection | Boolean | No | Yes | The instance release protection setting. Specifies whether to allow releasing the instance through the console or the DeleteInstance operation. | Values:
Note This property applies only to pay-as-you-go instances. It restricts only manual release operations. It does not affect system-initiated release operations. |
DeploymentSetId | String | No | No | The deployment set ID. | None |
SystemDiskPerformanceLevel | String | No | Yes | You can set the performance level when you create an enterprise SSD as a system disk. | Valid values:
For more information about how to select an ESSD performance level, see Enterprise SSDs. |
CreditSpecification
| String | No | Yes | The running mode for a burstable instance. | Valid values:
|
PrivatePoolOptions | Map | No | No | The private pool capacity options for instance startup. | For more information, see PrivatePoolOptions properties. |
StorageSetId | String | No | No | The storage set ID. | None |
HttpTokens | String | No | Yes | Specifies whether to enforce the hardened mode (IMDSv2) when accessing instance metadata. | Valid values are:
Note For information about patterns for accessing instance metadata, see Instance metadata. |
SubscriptionDeletionForce | Boolean | No | No | This property applies only to subscription instances. If this property is true, the instance converts to a pay-as-you-go instance before deletion. If this property is false, forced deletion does not occur. This action incurs additional fees. Use caution. | None |
HttpEndpoint | String | No | Yes | Specifies whether to enable the instance metadata endpoint. | Valid values include the following:
Note For more information about instance metadata, see Instance Metadata. |
Tenancy | String | No | No | Specifies whether to create the instance on a Dedicated Host. | Valid values are:
|
StorageSetPartitionNumber | Integer | No | No | The maximum number of partitions in the storage set. | Valid values: integers greater than or equal to 2. |
DeploymentSetGroupNo | Integer | No | No | If the deployment set uses the AvailabilityGroup policy, use this parameter to specify the group number of the instance in the deployment set. | Valid values: 1 to 7. |
Affinity | String | No | No | Specifies whether the Dedicated Host instance is associated with the Dedicated Host. | Valid values:
|
UseAdditionalService | Boolean | No | No | Specifies whether to use Alibaba Cloud-provided VM system configurations (Windows: NTP and KMS; Linux: NTP and YUM). | Valid values are:
|
ImageFamily | String | No | No | The image family name. | You can specify this parameter to query the latest available image that belongs to the current image family and use the image to create an instance.
Note For information about the image families associated with Alibaba Cloud Images, see public image. |
DiskMappings syntax
"DiskMappings": [
{
"Category": String,
"DiskName": String,
"Description": String,
"Device": String,
"SnapshotId": String,
"PerformanceLevel": String,
"Size": String
}
]DiskMappings properties
Property name | Type | Required | Update allowed | Description | Constraint |
Size | String | Yes | No | The data disk size. | Valid range: 20 to 500. Unit: GB. |
Category | String | No | No | The data disk category. | Valid values are:
For I/O optimized instances, the default value is cloud_efficiency. For non-I/O optimized instances, the default value is cloud. If a custom image contains a data disk, you can set the Category property to the data disk category that you want to use in an ROS template when you create an ECS instance. For example: |
DiskName | String | No | No | The data disk name. | Length: 2 to 128 characters. The name must start with a letter or a Chinese character. It cannot start with |
Description | String | No | No | The description. | Length: 2 to 256 characters. The description cannot start with |
Device | String | No | No | The mount target. | None |
PerformanceLevel | String | No | No | The performance level of an enterprise SSD used as the data disk. | Valid values are:
For information about how to select an ESSD performance level, see enterprise SSD. |
SnapshotId | String | No | No | The snapshot ID used for the data disk. | None |
Tags syntax
"Tags": [
{
"Value": String,
"Key": String
}
]Tags properties
Property name | Type | Required | Update allowed | Description | Constraint |
Key | String | Yes | No | The tag key. | Length: 1 to 128 characters. The key cannot start with |
Value | String | No | No | The tag value. | Length: 0 to 128 characters. The value cannot start with |
PrivatePoolOptions syntax
"PrivatePoolOptions": [
{
"Id": String,
"MatchCriteria": String
}
]PrivatePoolOptions properties
Property name | Type | Required | Update allowed | Description | Constraint |
Id | String | No | No | The private pool ID. This is the ID of the elastic guarantee service or capacity reservation service. | None |
MatchCriteria | String | No | No | After the elastic guarantee service or capacity reservation service becomes effective, it generates private pool capacity for instance startup. | Valid values:
In any of the following scenarios, the private pool capacity option for an instance launch can only be set to
|
Return values
Fn::GetAtt
InstanceId: The instance ID. This is a globally unique identifier generated by the system.
PrivateIp: The private IP address of a VPC-type instance.
InnerIp: The internal IP address of a classic-type instance.
PublicIp: The public IP address of a classic-type instance.
ZoneId: The zone ID.
HostName: The hostname of the ECS instance.
PrimaryNetworkInterfaceId: The primary NIC ID.
SecurityGroupIds: A list of security group IDs for the created instance.
Examples
Scenario 1: Create two ECS instances and enable passwordless logon.
ROSTemplateFormatVersion: '2015-09-01'
Description: Creates VPC ECS instance
Metadata: {}
Parameters:
VpcId:
AssociationProperty: ALIYUN::ECS::VPC::VPCId
Type: String
Description:
en: Please search the ID starting with (vpc-xxx) from console-Virtual Private Cloud
zh-cn: Existing virtual private cloud (VPC) ID
Label:
en: VPC ID
zh-cn: Virtual private cloud (VPC) ID
VSwitchZoneId:
AssociationProperty: ALIYUN::ECS::Instance:ZoneId
Type: String
Description:
zh-cn: Zone ID.
<b>Note: <font color='blue'>Before selecting, confirm that the zone supports the ECS instance type. We recommend selecting a different zone than other vSwitches.</font>
en: Availability Zone ID.
<b>Note: <font color='blue'>Before selecting, confirm that the Availability Zone supports the ECS instance type. We recommend selecting a different zone than other vSwitches.</font>
Label:
zh-cn: vSwitch zone
en: vSwitch Availability Zone
VSwitchId:
AssociationProperty: ALIYUN::ECS::VSwitch::VSwitchId
AssociationPropertyMetadata:
VpcId: ${VpcId}
ZoneId: ${VSwitchZoneId}
Type: String
Description:
en: Existing vSwitch ID, found in console-Virtual Private Cloud-vSwitches
zh-cn: Existing vSwitch ID
Label:
en: vSwitch ID
zh-cn: vSwitch ID
SecurityGroupId:
Type: String
AssociationProperty: ALIYUN::ECS::SecurityGroup::SecurityGroupId
AssociationPropertyMetadata:
VpcId: ${VpcId}
Description:
en: Business security group ID starting with (sg-xxx), found in console-ECS-Network & Security
zh-cn: Existing business security group ID
Label:
en: Business Security Group ID
zh-cn: Business Security Group ID
InstanceType:
Type: String
Description:
zh-cn: Instance type available in the vSwitch zone.
en: Instance type available in the vSwitch availability zone.
Label:
zh-cn: Instance type
en: Instance Type
AssociationProperty: ALIYUN::ECS::Instance::InstanceType
AssociationPropertyMetadata:
ZoneId: ${VSwitchZoneId}
SystemDiskCategory:
Type: String
AssociationProperty: ALIYUN::ECS::Disk::SystemDiskCategory
AssociationPropertyMetadata:
ZoneId: ${VSwitchZoneId}
InstanceType: ${InstanceType}
Label:
en: System Disk Type
zh-cn: System disk type
Description:
en: '<font color=''blue''>Optional values:</font>
[cloud_efficiency: <font color=''green''>Efficient Cloud Disk</font>]<br>[cloud_ssd: <font color=''green''>SSD Cloud Disk</font>]<br>[cloud_essd: <font color=''green''>ESSD Cloud Disk</font>]<br>[cloud: <font color=''green''>Cloud Disk</font>]<br>[ephemeral_ssd: <font color=''green''>Local SSD Cloud Disk</font>]'
zh-cn: '<font color=''blue''><b>Optional values:</font><br>[cloud_efficiency: <font color=''green''>Efficient Cloud Disk</font>]<br>[cloud_ssd: <font color=''green''>SSD Cloud Disk</font>]<br>[cloud_essd: <font color=''green''>ESSD Cloud Disk</font>]<br>[cloud: <font color=''green''>Cloud Disk</font>]<br>[ephemeral_ssd: <font color=''green''>Local SSD Cloud Disk</font>]'
SystemDiskSize:
Default: 40
Type: Number
Description:
zh-cn: System disk size. Valid values: 40 to 500. Unit: GiB.
en: 'System disk size, range of values: 40-500, units: GiB.'
Label:
zh-cn: System disk space
en: System Disk Space
Resources:
OpsEcsInstance:
Type: ALIYUN::ECS::Instance
Properties:
HostName: OpsEcsInstance
UserData:
Fn::Sub:
- |
#!/bin/bash
RootPassword=${RootPassword}
ProdIP=${ProdIP}
SSHConfig() {
echo '[ ! -f /root/.ssh/id_rsa.pub ] && ssh-keygen -t rsa -P "" -f ~/.ssh/id_rsa &>/dev/null' >> /tmp/auto_ssh.sh
echo 'while read line;do' >> /tmp/auto_ssh.sh
echo ' ip=`echo $line | cut -d " " -f1`' >> /tmp/auto_ssh.sh
echo ' user_name=`echo $line | cut -d " " -f2`' >> /tmp/auto_ssh.sh
echo ' pass_word=`echo $line | cut -d " " -f3`' >> /tmp/auto_ssh.sh
echo 'expect <<EOF' >> /tmp/auto_ssh.sh
echo ' spawn ssh-copy-id -i /root/.ssh/id_rsa.pub $user_name@$ip' >> /tmp/auto_ssh.sh
echo ' expect {' >> /tmp/auto_ssh.sh
echo ' "yes/no" { send "yes\n";exp_continue}' >> /tmp/auto_ssh.sh
echo ' "password" { send "$pass_word\n"}' >> /tmp/auto_ssh.sh
echo ' }' >> /tmp/auto_ssh.sh
echo ' expect eof' >> /tmp/auto_ssh.sh
echo 'EOF' >> /tmp/auto_ssh.sh
echo 'done < /tmp/host_ip.txt' >> /tmp/auto_ssh.sh
}
SetHostsConfig() {
echo "`ifconfig eth0 | awk '/inet /{print $2}'` root ${RootPassword}" >> /tmp/host_ip.txt
echo "${ProdIP} root ${RootPassword}" >> /tmp/host_ip.txt
sh /tmp/auto_ssh.sh
}
main() {
yum install -y expect
SSHConfig
SetHostsConfig
rm -rf /tmp/host_ip.txt
}
main
- ProdIP:
Fn::GetAtt:
- ProdEcsInstance
- PrivateIp
RootPassword: Admin@123!
VpcId:
Ref: VpcId
SecurityGroupId:
Ref: SecurityGroupId
VSwitchId:
Ref: VSwitchId
ImageId: centos_7
AllocatePublicIP: false
InstanceType:
Ref: InstanceType
SystemDiskSize: 40
SystemDiskCategory:
Ref: SystemDiskCategory
Password: Admin@123!
ProdEcsInstance:
Type: ALIYUN::ECS::Instance
Properties:
HostName: ProdEcsInstance
SystemDiskCategory:
Ref: SystemDiskCategory
VpcId:
Ref: VpcId
SecurityGroupId:
Ref: SecurityGroupId
SystemDiskSize: 40
ImageId: centos_7
VSwitchId:
Ref: VSwitchId
Password: Admin@123!
InstanceType:
Ref: InstanceType
AllocatePublicIP: false
Outputs: {} {
"ROSTemplateFormatVersion": "2015-09-01",
"Description": "Creates VPC ECS instance",
"Metadata": {},
"Parameters": {
"VpcId": {
"AssociationProperty": "ALIYUN::ECS::VPC::VPCId",
"Type": "String",
"Description": {
"en": "Please search the ID starting with (vpc-xxx) from console-Virtual Private Cloud",
"zh-cn": "Existing virtual private cloud (VPC) ID"
},
"Label": {
"en": "VPC ID",
"zh-cn": "Virtual private cloud (VPC) ID"
}
},
"VSwitchZoneId": {
"AssociationProperty": "ALIYUN::ECS::Instance:ZoneId",
"Type": "String",
"Description": {
"zh-cn": "Zone ID.
<b>Note: <font color='blue'>Before selecting, confirm that the zone supports the ECS instance type. We recommend selecting a different zone than other vSwitches.</font>",
"en": "Availability Zone ID.
<b>Note: <font color='blue'>Before selecting, confirm that the Availability Zone supports the ECS instance type. We recommend selecting a different zone than other vSwitches.</font>"
},
"Label": {
"zh-cn": "vSwitch zone",
"en": "vSwitch Availability Zone"
}
},
"VSwitchId": {
"AssociationProperty": "ALIYUN::ECS::VSwitch::VSwitchId",
"AssociationPropertyMetadata": {
"VpcId": "${VpcId}",
"ZoneId": "${VSwitchZoneId}"
},
"Type": "String",
"Description": {
"en": "Existing vSwitch ID, found in console-Virtual Private Cloud-vSwitches",
"zh-cn": "Existing vSwitch ID"
},
"Label": {
"en": "vSwitch ID",
"zh-cn": "vSwitch ID"
}
},
"SecurityGroupId": {
"Type": "String",
"AssociationProperty": "ALIYUN::ECS::SecurityGroup::SecurityGroupId",
"AssociationPropertyMetadata": {
"VpcId": "${VpcId}"
},
"Description": {
"en": "Business security group ID starting with (sg-xxx), found in console-ECS-Network & Security",
"zh-cn": "Existing business security group ID"
},
"Label": {
"en": "Business Security Group ID",
"zh-cn": "Business Security Group ID"
}
},
"InstanceType": {
"Type": "String",
"Description": {
"zh-cn": "Instance type available in the vSwitch zone.",
"en": "Instance type available in the vSwitch availability zone."
},
"Label": {
"zh-cn": "Instance type",
"en": "Instance Type"
},
"AssociationProperty": "ALIYUN::ECS::Instance::InstanceType",
"AssociationPropertyMetadata": {
"ZoneId": "${VSwitchZoneId}"
}
},
"SystemDiskCategory": {
"Type": "String",
"AssociationProperty": "ALIYUN::ECS::Disk::SystemDiskCategory",
"AssociationPropertyMetadata": {
"ZoneId": "${VSwitchZoneId}",
"InstanceType": "${InstanceType}"
},
"Label": {
"en": "System Disk Type",
"zh-cn": "System disk type"
},
"Description": {
"en": "<font color='blue'>Optional values:</font>
[cloud_efficiency: <font color='green'>Efficient Cloud Disk</font>]<br>[cloud_ssd: <font color='green'>SSD Cloud Disk</font>]<br>[cloud_essd: <font color='green'>ESSD Cloud Disk</font>]<br>[cloud: <font color='green'>Cloud Disk</font>]<br>[ephemeral_ssd: <font color='green'>Local SSD Cloud Disk</font>]",
"zh-cn": "<font color='blue'><b>Optional values:</font><br>[cloud_efficiency: <font color='green'>Efficient Cloud Disk</font>]<br>[cloud_ssd: <font color='green'>SSD Cloud Disk</font>]<br>[cloud_essd: <font color='green'>ESSD Cloud Disk</font>]<br>[cloud: <font color='green'>Cloud Disk</font>]<br>[ephemeral_ssd: <font color='green'>Local SSD Cloud Disk</font>]"
}
},
"SystemDiskSize": {
"Default": 40,
"Type": "Number",
"Description": {
"zh-cn": "System disk size. Valid values: 40 to 500. Unit: GiB.",
"en": "System disk size, range of values: 40-500, units: GiB."
},
"Label": {
"zh-cn": "System disk space",
"en": "System Disk Space"
}
}
},
"Resources": {
"OpsEcsInstance": {
"Type": "ALIYUN::ECS::Instance",
"Properties": {
"HostName": "OpsEcsInstance",
"UserData": {
"Fn::Sub": [
"#!/bin/bash\nRootPassword=${RootPassword}\nProdIP=${ProdIP}\nSSHConfig() {\necho '[ ! -f /root/.ssh/id_rsa.pub ] && ssh-keygen -t rsa -P \"\" -f ~/.ssh/id_rsa &>/dev/null' >> /tmp/auto_ssh.sh\necho 'while read line;do' >> /tmp/auto_ssh.sh\necho ' ip=`echo $line | cut -d \" \" -f1`' >> /tmp/auto_ssh.sh\necho ' user_name=`echo $line | cut -d \" \" -f2`' >> /tmp/auto_ssh.sh\necho ' pass_word=`echo $line | cut -d \" \" -f3`' >> /tmp/auto_ssh.sh\necho 'expect <<EOF' >> /tmp/auto_ssh.sh\necho ' spawn ssh-copy-id -i /root/.ssh/id_rsa.pub $user_name@$ip' >> /tmp/auto_ssh.sh\necho ' expect {' >> /tmp/auto_ssh.sh\necho ' \"yes/no\" { send \"yes\\n\";exp_continue}' >> /tmp/auto_ssh.sh\necho ' \"password\" { send \"$pass_word\\n\"}' >> /tmp/auto_ssh.sh\necho ' }' >> /tmp/auto_ssh.sh\necho ' expect eof' >> /tmp/auto_ssh.sh\necho 'EOF' >> /tmp/auto_ssh.sh\necho 'done < /tmp/host_ip.txt' >> /tmp/auto_ssh.sh\n}\nSetHostsConfig() {\necho \"`ifconfig eth0 | awk '/inet /{print $2}'` root ${RootPassword}\" >> /tmp/host_ip.txt\necho \"${ProdIP} root ${RootPassword}\" >> /tmp/host_ip.txt\nsh /tmp/auto_ssh.sh\n}\nmain() {\nyum install -y expect\nSSHConfig\nSetHostsConfig\nrm -rf /tmp/host_ip.txt\n}\nmain\n",
{
"ProdIP": {
"Fn::GetAtt": [
"ProdEcsInstance",
"PrivateIp"
]
},
"RootPassword": "Admin@123!"
}
]
},
"VpcId": {
"Ref": "VpcId"
},
"SecurityGroupId": {
"Ref": "SecurityGroupId"
},
"VSwitchId": {
"Ref": "VSwitchId"
},
"ImageId": "centos_7",
"AllocatePublicIP": false,
"InstanceType": {
"Ref": "InstanceType"
},
"SystemDiskSize": 40,
"SystemDiskCategory": {
"Ref": "SystemDiskCategory"
},
"Password": "Admin@123!"
}
},
"ProdEcsInstance": {
"Type": "ALIYUN::ECS::Instance",
"Properties": {
"HostName": "ProdEcsInstance",
"SystemDiskCategory": {
"Ref": "SystemDiskCategory"
},
"VpcId": {
"Ref": "VpcId"
},
"SecurityGroupId": {
"Ref": "SecurityGroupId"
},
"SystemDiskSize": 40,
"ImageId": "centos_7",
"VSwitchId": {
"Ref": "VSwitchId"
},
"Password": "Admin@123!",
"InstanceType": {
"Ref": "InstanceType"
},
"AllocatePublicIP": false
}
}
},
"Outputs": {}
} Scenario 2: Create an ECS instance with multiple private IP addresses.
ROSTemplateFormatVersion: '2015-09-01'
Description:
zh-cn: Create an ECS instance, configure VPC, security group, multiple IP addresses, system disk and network interface, and support customizing instance specifications, mirroring and network settings.
en: Create an ECS instance, configure VPC, security group, multiple IP addresses, system disk and network interface, and support customizing instance specifications, mirroring and network settings.
Parameters:
EcsInstanceType:
AssociationProperty: ALIYUN::ECS::Instance::InstanceType
AssociationPropertyMetadata:
ZoneId: VSwitchZoneId
Type: String
Description:
zh-cn: <font color='blue'>1. Before selecting the instance type, confirm that it is available in the current zone. Some instance types require advance registration.</font>
<font color='blue'><b>2. Available instance types</font><br></font>[ecs.c5.large <font color='green'>2 vCPUs, 4 GiB memory, 1 Gbit/s intranet bandwidth, 300,000 PPS</font>]
[ecs.c5.xlarge <font color='green'>4 vCPUs, 8 GiB memory, 1.5 Gbit/s intranet bandwidth, 500,000 PPS</font>]
[ecs.c5.2xlarge <font color='green'>8 vCPUs, 16 GiB memory, 2.5 Gbit/s intranet bandwidth, 800,000 PPS</font>]
en: <font color='blue'>1. Before selecting the instance type, confirm that it is available in the current zone. Some instance types require advance registration.</font>
<font color='blue'><b>2. Available instance types</font><br></font>[ecs.c5.large <font color='green'>2 vCPUs, 4 GiB memory, 1 Gbit/s intranet bandwidth, 300,000 PPS</font>]
[ecs.c5.xlarge <font color='green'>4 vCPUs, 8 GiB memory, 1.5 Gbit/s intranet bandwidth, 500,000 PPS</font>]
[ecs.c5.2xlarge <font color='green'>8 vCPUs, 16 GiB memory, 2.5 Gbit/s intranet bandwidth, 800,000 PPS</font>]
Label:
zh-cn: Instance type
en: Instance Type
VSwitchZoneId:
AssociationProperty: ALIYUN::ECS::Instance:ZoneId
Type: String
Description:
zh-cn: Zone ID.
<b>Note: <font color='blue'>Before selecting, confirm that the zone supports the ECS instance type.</font>
en: Availability Zone ID.
<b>Note: <font color='blue'>Before selecting, confirm that the Availability Zone supports the ECS instance type.</font>
Label:
zh-cn: vSwitch zone
en: vSwitch Availability Zone
EcsSystemDiskSize:
Default: 40
Type: Number
Description:
zh-cn: System disk size. Valid values: 40 to 500. Unit: GiB.
en: 'System disk size, range of values: 40-500, units: GiB.'
Label:
zh-cn: System disk space
en: System Disk Space
EcsPassword:
Description:
zh-cn: Server logon password. Length: 8 to 30 characters. Must contain three of the following: uppercase letters, lowercase letters, digits, and special characters ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/.
en: Server logon password. Length: 8 to 30 characters. Must contain three of the following: uppercase letters, lowercase letters, digits, and special characters ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/.
Type: String
Label:
zh-cn: Instance password
en: Instance Password
NoEcho: true
AssociationProperty: ALIYUN::ECS::Instance::Password
ConstraintDescription:
zh-cn: Length: 8 to 30 characters. Must contain three of the following: uppercase letters, lowercase letters, digits, and special characters ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/.
en: Length: 8 to 30 characters. Must contain three of the following: uppercase letters, lowercase letters, digits, and special characters ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/.
EcsImageId:
AssociationPropertyMetadata:
InstanceType: ${EcsInstanceType}
SupportedImageOwnerAlias:
- system
- self
- others
Description:
zh-cn: Image ID. See: <a href='https://www.alibabacloud.com/help/document_detail/112977.html' target='_blank'><font color='blue'>Find the image</font></a>
en: 'Image ID. See detail: <a href=''https://www.alibabacloud.com/help/doc-detail/112977.html'' target=''_blank''><font color=''blue''>Find the mirror</font></a>'
Default: centos_7_04_64_20G_alibase_201701015.vhd
Label:
zh-cn: Image ID
en: Image ID
AssociationProperty: ALIYUN::ECS::Image::ImageId
Type: String
EcsSystemDiskCategory:
AssociationProperty: ALIYUN::ECS::Disk::SystemDiskCategory
AssociationPropertyMetadata:
LocaleKey: DiskCategory
InstanceType: ${EcsInstanceType}
Type: String
Description:
zh-cn: '<font color=''blue''>Optional values:</font>
[cloud_efficiency: <font color=''green''>Efficient Cloud Disk</font>]<br>[cloud_ssd: <font color=''green''>SSD Cloud Disk</font>]<br>[cloud_essd: <font color=''green''>ESSD Cloud Disk</font>]<br>[cloud: <font color=''green''>Cloud Disk</font>]<br>[ephemeral_ssd: <font color=''green''>Local SSD Cloud Disk</font>]'
en: '<font color=''blue''><b>Optional values:</font><br>[cloud_efficiency: <font color=''green''>Efficient Cloud Disk</font>]<br>[cloud_ssd: <font color=''green''>SSD Cloud Disk</font>]<br>[cloud_essd: <font color=''green''>ESSD Cloud Disk</font>]<br>[cloud: <font color=''green''>Cloud Disk</font>]<br>[ephemeral_ssd: <font color=''green''>Local SSD Cloud Disk</font>]'
Label:
zh-cn: System disk type
en: System Disk Type
IpAddressCount:
Description:
zh-cn: Valid values: 1 to 9.
en: 'Allowed values: 1~9.'
Default: 1
MaxValue: 9
MinValue: 1
Label:
zh-cn: Number of IPv4 addresses for the network interface
en: Number of IPv4 Network Card
Type: Number
Outputs:
InstanceId:
Value:
Ref: EcsInstance
EIP:
Value:
Fn::GetAtt:
- Eip
- EipAddress
PrimaryPrivateIPAddress:
Value:
Fn::GetAtt:
- EcsInstance
- PrivateIp
AddPrivateIPAddressList:
Value:
Fn::GetAtt:
- EcsAssignPrivateIpAddresses
- PrivateIpAddresses
Resources:
EcsAssignPrivateIpAddresses:
Type: ALIYUN::ECS::AssignPrivateIpAddresses
Properties:
NetworkInterfaceId:
Ref: EcsENI
SecondaryPrivateIpAddressCount:
Ref: IpAddressCount
DependsOn:
- EcsENI
EcsENI:
Type: ALIYUN::ECS::NetworkInterface
Properties:
SecurityGroupId:
Ref: EcsSecurityGroup
VSwitchId:
Ref: EcsVSwitch
EcsSecurityGroup:
Type: ALIYUN::ECS::SecurityGroup
Properties:
VpcId:
Ref: EcsVpc
SecurityGroupName:
Fn::Join:
- _
- - StackId
- Ref: ALIYUN::StackId
Eip:
Type: ALIYUN::VPC::EIP
Properties:
InternetChargeType: PayByTraffic
InstanceChargeType: Postpaid
EcsVSwitch:
Type: ALIYUN::ECS::VSwitch
Properties:
VSwitchName:
Fn::Join:
- _
- - StackId
- Ref: ALIYUN::StackId
VpcId:
Ref: EcsVpc
CidrBlock: 192.168.0.0/24
ZoneId:
Ref: VSwitchZoneId
EcsEniAttachment:
Type: ALIYUN::ECS::NetworkInterfaceAttachment
Properties:
InstanceId:
Ref: EcsInstance
NetworkInterfaceId:
Ref: EcsENI
DependsOn:
- EcsInstance
- EipAssociation
EcsInstance:
Type: ALIYUN::ECS::Instance
Properties:
SystemDiskCategory:
Ref: EcsSystemDiskCategory
VpcId:
Ref: EcsVpc
SecurityGroupId:
Ref: EcsSecurityGroup
SystemDiskSize:
Ref: EcsSystemDiskSize
ImageId:
Ref: EcsImageId
AllocatePublicIP: false
InstanceChargeType: Postpaid
VSwitchId:
Ref: EcsVSwitch
IoOptimized: optimized
Password:
Ref: EcsPassword
InstanceType:
Ref: EcsInstanceType
EcsVpc:
Type: ALIYUN::ECS::VPC
Properties:
VpcName:
Fn::Join:
- '-'
- - StackId
- Ref: ALIYUN::StackId
CidrBlock: 192.168.0.0/16
EipAssociation:
Type: ALIYUN::VPC::EIPAssociation
Properties:
InstanceId:
Ref: EcsENI
AllocationId:
Ref: Eip
Mode: NAT
DependsOn:
- EcsAssignPrivateIpAddresses
- Eip
Metadata:
ALIYUN::ROS::Interface:
ParameterGroups:
- Parameters:
- VSwitchZoneId
- IpAddressCount
Label:
default:
zh-cn: Virtual private cloud (VPC)
en: VPC
- Parameters:
- EcsInstanceType
- EcsImageId
- EcsSystemDiskCategory
- EcsSystemDiskSize
- EcsPassword
Label:
default:
zh-cn: ECS configuration
en: ECS
{
"ROSTemplateFormatVersion": "2015-09-01",
"Description": {
"zh-cn": "Create an ECS instance, configure VPC, security group, multiple IP addresses, system disk and network interface, and support customizing instance specifications, mirroring and network settings.",
"en": "Create an ECS instance, configure VPC, security group, multiple IP addresses, system disk and network interface, and support customizing instance specifications, mirroring and network settings."
},
"Parameters": {
"EcsInstanceType": {
"AssociationProperty": "ALIYUN::ECS::Instance::InstanceType",
"AssociationPropertyMetadata": {
"ZoneId": "VSwitchZoneId"
},
"Type": "String",
"Description": {
"zh-cn": "<font color='blue'>1. Before selecting the instance type, confirm that it is available in the current zone. Some instance types require advance registration.</font>
<font color='blue'><b>2. Available instance types</font><br></font>[ecs.c5.large <font color='green'>2 vCPUs, 4 GiB memory, 1 Gbit/s intranet bandwidth, 300,000 PPS</font>]
[ecs.c5.xlarge <font color='green'>4 vCPUs, 8 GiB memory, 1.5 Gbit/s intranet bandwidth, 500,000 PPS</font>]
[ecs.c5.2xlarge <font color='green'>8 vCPUs, 16 GiB memory, 2.5 Gbit/s intranet bandwidth, 800,000 PPS</font>]",
"en": "<font color='blue'>1. Before selecting the instance type, confirm that it is available in the current zone. Some instance types require advance registration.</font>
<font color='blue'><b>2. Available instance types</font><br></font>[ecs.c5.large <font color='green'>2 vCPUs, 4 GiB memory, 1 Gbit/s intranet bandwidth, 300,000 PPS</font>]
[ecs.c5.xlarge <font color='green'>4 vCPUs, 8 GiB memory, 1.5 Gbit/s intranet bandwidth, 500,000 PPS</font>]
[ecs.c5.2xlarge <font color='green'>8 vCPUs, 16 GiB memory, 2.5 Gbit/s intranet bandwidth, 800,000 PPS</font>]"
},
"Label": {
"zh-cn": "Instance type",
"en": "Instance Type"
}
},
"VSwitchZoneId": {
"AssociationProperty": "ALIYUN::ECS::Instance:ZoneId",
"Type": "String",
"Description": {
"zh-cn": "Zone ID.
<b>Note: <font color='blue'>Before selecting, confirm that the zone supports the ECS instance type.</font>",
"en": "Availability Zone ID.
<b>Note: <font color='blue'>Before selecting, confirm that the Availability Zone supports the ECS instance type.</font>"
},
"Label": {
"zh-cn": "vSwitch zone",
"en": "vSwitch Availability Zone"
}
},
"EcsSystemDiskSize": {
"Default": 40,
"Type": "Number",
"Description": {
"zh-cn": "System disk size. Valid values: 40 to 500. Unit: GiB.",
"en": "System disk size, range of values: 40-500, units: GiB."
},
"Label": {
"zh-cn": "System disk space",
"en": "System Disk Space"
}
},
"EcsPassword": {
"Description": {
"zh-cn": "Server logon password. Length: 8 to 30 characters. Must contain three of the following: uppercase letters, lowercase letters, digits, and special characters ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/.",
"en": "Server logon password. Length: 8 to 30 characters. Must contain three of the following: uppercase letters, lowercase letters, digits, and special characters ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/."
},
"Type": "String",
"Label": {
"zh-cn": "Instance password",
"en": "Instance Password"
},
"NoEcho": true,
"AssociationProperty": "ALIYUN::ECS::Instance::Password",
"ConstraintDescription": {
"zh-cn": "Length: 8 to 30 characters. Must contain three of the following: uppercase letters, lowercase letters, digits, and special characters ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/.",
"en": "Length: 8 to 30 characters. Must contain three of the following: uppercase letters, lowercase letters, digits, and special characters ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/."
}
},
"EcsImageId": {
"AssociationPropertyMetadata": {
"InstanceType": "${EcsInstanceType}",
"SupportedImageOwnerAlias": [
"system",
"self",
"others"
]
},
"Description": {
"zh-cn": "Image ID. See: <a href='https://www.alibabacloud.com/help/document_detail/112977.html' target='_blank'><font color='blue'>Find the image</font></a>",
"en": "Image ID. See detail: <a href='https://www.alibabacloud.com/help/doc-detail/112977.html' target='_blank'><font color='blue'>Find the mirror</font></a>"
},
"Default": "centos_7_04_64_20G_alibase_201701015.vhd",
"Label": {
"zh-cn": "Image ID",
"en": "Image ID"
},
"AssociationProperty": "ALIYUN::ECS::Image::ImageId",
"Type": "String"
},
"EcsSystemDiskCategory": {
"AssociationProperty": "ALIYUN::ECS::Disk::SystemDiskCategory",
"AssociationPropertyMetadata": {
"LocaleKey": "DiskCategory",
"InstanceType": "${EcsInstanceType}"
},
"Type": "String",
"Description": {
"zh-cn": "<font color='blue'>Optional values:</font>
[cloud_efficiency: <font color='green'>Efficient Cloud Disk</font>]<br>[cloud_ssd: <font color='green'>SSD Cloud Disk</font>]<br>[cloud_essd: <font color='green'>ESSD Cloud Disk</font>]<br>[cloud: <font color='green'>Cloud Disk</font>]<br>[ephemeral_ssd: <font color='green'>Local SSD Cloud Disk</font>]",
"en": "<font color='blue'><b>Optional values:</font><br>[cloud_efficiency: <font color='green'>Efficient Cloud Disk</font>]<br>[cloud_ssd: <font color='green'>SSD Cloud Disk</font>]<br>[cloud_essd: <font color='green'>ESSD Cloud Disk</font>]<br>[cloud: <font color='green'>Cloud Disk</font>]<br>[ephemeral_ssd: <font color='green'>Local SSD Cloud Disk</font>]"
},
"Label": {
"zh-cn": "System disk type",
"en": "System Disk Type"
}
},
"IpAddressCount": {
"Description": {
"zh-cn": "Valid values: 1 to 9.",
"en": "Allowed values: 1~9."
},
"Default": 1,
"MaxValue": 9,
"MinValue": 1,
"Label": {
"zh-cn": "Number of IPv4 addresses for the network interface",
"en": "Number of IPv4 Network Card"
},
"Type": "Number"
}
},
"Outputs": {
"InstanceId": {
"Value": {
"Ref": "EcsInstance"
}
},
"EIP": {
"Value": {
"Fn::GetAtt": [
"Eip",
"EipAddress"
]
}
},
"PrimaryPrivateIPAddress": {
"Value": {
"Fn::GetAtt": [
"EcsInstance",
"PrivateIp"
]
}
},
"AddPrivateIPAddressList": {
"Value": {
"Fn::GetAtt": [
"EcsAssignPrivateIpAddresses",
"PrivateIpAddresses"
]
}
}
},
"Resources": {
"EcsAssignPrivateIpAddresses": {
"Type": "ALIYUN::ECS::AssignPrivateIpAddresses",
"Properties": {
"NetworkInterfaceId": {
"Ref": "EcsENI"
},
"SecondaryPrivateIpAddressCount": {
"Ref": "IpAddressCount"
}
},
"DependsOn": [
"EcsENI"
]
},
"EcsENI": {
"Type": "ALIYUN::ECS::NetworkInterface",
"Properties": {
"SecurityGroupId": {
"Ref": "EcsSecurityGroup"
},
"VSwitchId": {
"Ref": "EcsVSwitch"
}
}
},
"EcsSecurityGroup": {
"Type": "ALIYUN::ECS::SecurityGroup",
"Properties": {
"VpcId": {
"Ref": "EcsVpc"
},
"SecurityGroupName": {
"Fn::Join": [
"_",
[
"StackId",
{
"Ref": "ALIYUN::StackId"
}
]
]
}
}
},
"Eip": {
"Type": "ALIYUN::VPC::EIP",
"Properties": {
"InternetChargeType": "PayByTraffic",
"InstanceChargeType": "Postpaid"
}
},
"EcsVSwitch": {
"Type": "ALIYUN::ECS::VSwitch",
"Properties": {
"VSwitchName": {
"Fn::Join": [
"_",
[
"StackId",
{
"Ref": "ALIYUN::StackId"
}
]
]
},
"VpcId": {
"Ref": "EcsVpc"
},
"CidrBlock": "192.168.0.0/24",
"ZoneId": {
"Ref": "VSwitchZoneId"
}
}
},
"EcsEniAttachment": {
"Type": "ALIYUN::ECS::NetworkInterfaceAttachment",
"Properties": {
"InstanceId": {
"Ref": "EcsInstance"
},
"NetworkInterfaceId": {
"Ref": "EcsENI"
}
},
"DependsOn": [
"EcsInstance",
"EipAssociation"
]
},
"EcsInstance": {
"Type": "ALIYUN::ECS::Instance",
"Properties": {
"SystemDiskCategory": {
"Ref": "EcsSystemDiskCategory"
},
"VpcId": {
"Ref": "EcsVpc"
},
"SecurityGroupId": {
"Ref": "EcsSecurityGroup"
},
"SystemDiskSize": {
"Ref": "EcsSystemDiskSize"
},
"ImageId": {
"Ref": "EcsImageId"
},
"AllocatePublicIP": false,
"InstanceChargeType": "Postpaid",
"VSwitchId": {
"Ref": "EcsVSwitch"
},
"IoOptimized": "optimized",
"Password": {
"Ref": "EcsPassword"
},
"InstanceType": {
"Ref": "EcsInstanceType"
}
}
},
"EcsVpc": {
"Type": "ALIYUN::ECS::VPC",
"Properties": {
"VpcName": {
"Fn::Join": [
"-",
[
"StackId",
{
"Ref": "ALIYUN::StackId"
}
]
]
},
"CidrBlock": "192.168.0.0/16"
}
},
"EipAssociation": {
"Type": "ALIYUN::VPC::EIPAssociation",
"Properties": {
"InstanceId": {
"Ref": "EcsENI"
},
"AllocationId": {
"Ref": "Eip"
},
"Mode": "NAT"
},
"DependsOn": [
"EcsAssignPrivateIpAddresses",
"Eip"
]
}
},
"Metadata": {
"ALIYUN::ROS::Interface": {
"ParameterGroups": [
{
"Parameters": [
"VSwitchZoneId",
"IpAddressCount"
],
"Label": {
"default": {
"zh-cn": "Virtual private cloud (VPC)",
"en": "VPC"
}
}
},
{
"Parameters": [
"EcsInstanceType",
"EcsImageId",
"EcsSystemDiskCategory",
"EcsSystemDiskSize",
"EcsPassword"
],
"Label": {
"default": {
"zh-cn": "ECS configuration",
"en": "ECS"
}
}
}
]
}
}
}Scenario 3: Create an ECS instance and an Elastic IP Address (EIP), and attach multiple data disks.
ROSTemplateFormatVersion: '2015-09-01'
Description:
zh-cn: Create an ECS instance, configure Elastic IP Address (EIP), attach 2 data disks, and set network environment and security group rules.
en: Create an ECS instance, configure elastic IP, mount 2 data disks, and set network environment and security group rules.
Parameters:
FirstDataDiskCategory:
AssociationProperty: ALIYUN::ECS::Disk::DataDiskCategory
AssociationPropertyMetadata:
InstanceType: ${InstanceType}
ZoneId: ${ZoneId}
Type: String
Label:
zh-cn: Category of data disk 1
en: First Data Disk Category
SystemDiskCategory:
AssociationProperty: ALIYUN::ECS::Disk::SystemDiskCategory
AssociationPropertyMetadata:
InstanceType: InstanceType
ZoneId: ZoneId
Type: String
Label:
zh-cn: System disk type
en: System Disk Type
SecondDataDiskSize:
Default: 40
Type: Number
Description:
zh-cn: The size of the second data disk, in GiB. Value range: cloud:[5, 2000], cloud_efficiency:[20, 32768], cloud_ssd:[20, 32768], ephemeral_ssd:[5, 800]. The value must be equal to or greater than the specific snapshot size.
en: 'The size of the second data disk, in GiB. Value range: cloud: [5, 2000], cloud_efficiency: [20, 32768], cloud_ssd: [20, 32768], ephemeral_ssd: [5, 800]. The value must be equal to or greater than the specific snapshot size.'
Label:
zh-cn: Size of data disk 2
en: Second Data Disk Size
SystemDiskSize:
Default: 40
Type: Number
Description:
zh-cn: The size of the system disk, in GiB. Value range: cloud:[5, 2000], cloud_efficiency:[20, 32768], cloud_ssd:[20, 32768], ephemeral_ssd:[5, 800]. The value must be equal to or greater than the specific snapshot size.
en: 'The size of the system disk, in GiB. Value range: cloud: [5, 2000], cloud_efficiency: [20, 32768], cloud_ssd: [20, 32768], ephemeral_ssd: [5, 800]. The value must be equal to or greater than the specific snapshot size.'
Label:
zh-cn: System disk size
en: System Disk Space
VpcCidrBlock:
Default: 192.168.0.0/16
Label:
zh-cn: VPC CIDR block
en: VPC CIDR Block
Type: String
Description:
zh-cn: The CIDR block for the new VPC. We recommend using one of the following CIDR blocks:
<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>
en: The CIDR block for the new VPC. We recommend using 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
FirstDataDiskSize:
Default: 40
Type: Number
Description:
zh-cn: The size of the first data disk, in GiB. Value range: cloud:[5, 2000], cloud_efficiency:[20, 32768], cloud_ssd:[20, 32768], ephemeral_ssd:[5, 800]. The value must be equal to or greater than the specific snapshot size.
en: 'The size of the first data disk, in GiB. Value range: cloud: [5, 2000], cloud_efficiency: [20, 32768], cloud_ssd: [20, 32768], ephemeral_ssd: [5, 800]. The value must be equal to or greater than the specific snapshot size.'
Label:
zh-cn: Capacity of data disk 1
en: First Data Disk Size
SecondDataDiskCategory:
AssociationProperty: ALIYUN::ECS::Disk::DataDiskCategory
AssociationPropertyMetadata:
InstanceType: ${InstanceType}
ZoneId: ${ZoneId}
Type: String
Label:
zh-cn: Category of data disk 2
en: Second Data Disk Category
VSwitchCidrBlock:
Default: 192.168.0.0/24
Type: String
Description:
zh-cn: The CIDR block for the new vSwitch. This is a subnet of the VPC.
en: The CIDR block for the new vSwitch. This is a subnet of the VPC.
Label:
zh-cn: vSwitch CIDR block
en: VSwitch CIDR Block
Password:
ConstraintDescription:
zh-cn: Length: 8 to 30 characters. Must contain at least three of the following: uppercase letters, lowercase letters, digits, and special characters. Special characters include the following: ()`~!@#$%^&*_-+=|{}[]:;' <>,.?/
en: 'Length: 8 to 30 characters. Must contain at least three of the following: uppercase letters, lowercase letters, digits, and special characters. Special characters include the following: ()`~!@#$%^&*_-+=|{}[]:;''<>,.?/'
Description:
zh-cn: The server logon password. Length: 8 to 30 characters. Must contain at least three of the following: uppercase letters, lowercase letters, digits, and special characters from ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/.
en: The server logon password. Length: 8 to 30 characters. Must contain at least three of the following: uppercase letters, lowercase letters, digits, and special characters from ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/.
MinLength: 8
Label:
zh-cn: Instance password
en: Instance Password
AllowedPattern: '[a-zA-Z0-9-\(\)\`\~\!@\#\$%\^&\*-+=\|\{\}\[\]\:\;\‘\,\.\?\/]*'
NoEcho: true
MaxLength: 30
Type: String
InstanceType:
AssociationProperty: ALIYUN::ECS::Instance::InstanceType
AssociationPropertyMetadata:
ZoneId: ZoneId
Type: String
Description:
zh-cn: <font color='blue'><b>1. Before selecting the instance type, confirm that it is available in the current zone. Some instance types require advance registration.</font>
<font color='blue'><b>2. Available instance types</font><br></font>[ecs.c5.large <font color='green'>2 vCPUs, 4 GiB memory, 1 Gbit/s internal bandwidth, 300,000 PPS</font>]
[ecs.c5.xlarge <font color='green'>4 vCPUs, 8 GiB memory, 1.5 Gbit/s internal bandwidth, 500,000 PPS</font>]
[ecs.c5.2xlarge <font color='green'>8 vCPUs, 16 GiB memory, 2.5 Gbit/s internal bandwidth, 800,000 PPS</font>]
en: <font color='blue'>1. Before selecting the instance type, confirm that it is available in the current zone. Some instance types require advance registration.</font>
<font color='blue'><b>2. Available instance types</font><br></font>[ecs.c5.large <font color='green'>2 vCPUs, 4 GiB memory, 1 Gbit/s internal bandwidth, 300,000 PPS</font>]
[ecs.c5.xlarge <font color='green'>4 vCPUs, 8 GiB memory, 1.5 Gbit/s internal bandwidth, 500,000 PPS</font>]
[ecs.c5.2xlarge <font color='green'>8 vCPUs, 16 GiB memory, 2.5 Gbit/s internal bandwidth, 800,000 PPS</font>]
Label:
zh-cn: Instance type
en: Instance Type
ZoneId:
AssociationProperty: ALIYUN::ECS::Instance:ZoneId
Type: String
Description:
zh-cn: Availability Zone ID.
<b>Note: <font color='blue'>Before selecting, confirm that the Availability Zone supports the ECS instance type. We recommend selecting a different zone than other vSwitches.</font>
en: Availability Zone ID.
<b>Note: <font color='blue'>Before selecting, confirm that the Availability Zone supports the ECS instance type. We recommend selecting a different zone than other vSwitches.</font>
Label:
zh-cn: vSwitch zone
en: VSwitch Availability Zone
ImageId:
AssociationPropertyMetadata:
InstanceType: ${InstanceType}
SupportedImageOwnerAlias:
- system
- self
- others
Description:
zh-cn: Image ID. For more information, see <a href='https://www.alibabacloud.com/help/document_detail/112977.html' target='_blank'><font color='blue'>Find an image</font></a>
en: Image ID. For more information, see <a href='https://www.alibabacloud.com/help/doc-detail/112977.html' target='_blank'><font color='blue'>Find an image</font></a>
Default: centos_7_04_64_20G_alibase_201701015.vhd
Label:
zh-cn: Image ID
en: Image ID
AssociationProperty: ALIYUN::ECS::Image::ImageId
Type: String
Outputs:
VpcId:
Description: Id of created VPC.
Value:
Fn::GetAtt:
- Vpc
- VpcId
InstanceId:
Description: The instance id of created ecs instance.
Value:
Fn::GetAtt:
- WebServer
- InstanceId
SecurityGroupId:
Description: generated security group id for security group.
Value:
Fn::GetAtt:
- SecurityGroup
- SecurityGroupId
EipId:
Description: ID that Aliyun assigns to represent the allocation of the address for use with VPC. Returned only for VPC elastic IP addresses.
Value:
Fn::GetAtt:
- Eip
- AllocationId
ZoneId:
Description: Zone ID of created instance.
Value:
Fn::GetAtt:
- WebServer
- ZoneId
VSwitchId:
Description: Id of created VSwitch.
Value:
Fn::GetAtt:
- VSwitch
- VSwitchId
Resources:
EIPBind:
Type: ALIYUN::VPC::EIPAssociation
Properties:
InstanceId:
Ref: WebServer
AllocationId:
Ref: Eip
Metadata:
ALIYUN::ROS::Designer:
id: ece3b051-66c9-46d6-9961-f184d342b21f
Eip:
Type: ALIYUN::VPC::EIP
Properties:
InternetChargeType: PayByTraffic
Bandwidth: 1
Metadata:
ALIYUN::ROS::Designer:
id: a914d36e-d429-46d6-bbd0-a22acd07b096
SecurityGroupEgress:
Type: ALIYUN::ECS::SecurityGroupEgress
Properties:
DestCidrIp: 0.0.0.0/0
IpProtocol: all
SecurityGroupId:
Ref: SecurityGroup
NicType: intranet
PortRange: '-1/-1'
Metadata:
ALIYUN::ROS::Designer:
id: faa26b3c-3507-41e9-9959-5db9a9e67446
SecurityGroup:
Type: ALIYUN::ECS::SecurityGroup
Properties:
VpcId:
Ref: Vpc
Metadata:
ALIYUN::ROS::Designer:
id: fde92bb4-877d-4e7b-b9dd-be6f5e552544
SecurityGroupIngress:
Type: ALIYUN::ECS::SecurityGroupIngress
Properties:
IpProtocol: all
SecurityGroupId:
Ref: SecurityGroup
NicType: intranet
SourceCidrIp: 0.0.0.0/0
PortRange: '-1/-1'
Metadata:
ALIYUN::ROS::Designer:
id: 2a6cfdef-e236-4966-a976-dd7e7bbc37a5
WebServer:
Type: ALIYUN::ECS::Instance
Properties:
UserData:
Fn::Join:
- ''
- - |
#!/bin/sh
- |
logs=~/mount_logs
- |
i=1
- |
total=2
- |
while [ $i -le $total ]
- |
do
- |2
disk_suffix=`echo $i|awk '{printf "%c", 97+$i}'`
- |
fdisk -S 56 /dev/vd$disk_suffix <<ESXU
- |
n
- |
p
- |
1
- |+
- |+
- |
w
- |
ESXU
- |2
echo "/dev/vd$disk_suffix is fdisked!" >> $logs
- |2
mkfs.ext4 /dev/vd${disk_suffix}1
- |2
if [ $? -eq 0 ];then
- |2
echo "/dev/vd${disk_suffix}1 is formated!" >> $logs
- |2
fi
- |2
touch ~/test_ftab
- |2
mkdir $disk_suffix$i
- |2
disk_uuid=`blkid | grep /dev/vd${disk_suffix}1 |awk '{printf $2}'|sed 's/\"//g'`
- |
cat << ESXU > ~/test_ftab
- |
$disk_uuid $disk_suffix$i ext4 defaults 0 0
- |
ESXU
- |2
cat ~/test_ftab >> /etc/fstab
- |2
mount -a
- |2
chmod -R 777 $disk_suffix$i
- |2
rm -rf ~/test_ftab
- |2
echo "/dev/vd${disk_suffix}1 is mounted!" >> $logs
- |2
let i+=1
- |
done
SystemDiskCategory:
Ref: SystemDiskCategory
VpcId:
Ref: Vpc
SecurityGroupId:
Ref: SecurityGroup
SystemDiskSize:
Ref: SystemDiskSize
ImageId:
Ref: ImageId
AllocatePublicIP: 'false'
VSwitchId:
Ref: VSwitch
IoOptimized: optimized
Password:
Ref: Password
DiskMappings:
- Category:
Ref: FirstDataDiskCategory
Size:
Ref: FirstDataDiskSize
- Category:
Ref: SecondDataDiskCategory
Size:
Ref: SecondDataDiskSize
InstanceType:
Ref: InstanceType
Metadata:
ALIYUN::ROS::Designer:
id: 4f476130-0cde-4cff-a973-2cb026e18f13
Vpc:
Type: ALIYUN::ECS::VPC
Properties:
CidrBlock:
Ref: VpcCidrBlock
Metadata:
ALIYUN::ROS::Designer:
id: adfdd097-9c30-49ff-8738-ae3b59eada43
VSwitch:
Type: ALIYUN::ECS::VSwitch
Properties:
VpcId:
Fn::GetAtt:
- Vpc
- VpcId
CidrBlock:
Ref: VSwitchCidrBlock
ZoneId:
Ref: ZoneId
Metadata:
ALIYUN::ROS::Designer:
id: bd814869-3bd7-4551-a5db-0ec7ad3d3246
Metadata:
ALIYUN::ROS::Interface:
ParameterGroups:
- Parameters:
- ZoneId
- VpcCidrBlock
- VSwitchCidrBlock
Label:
default:
zh-cn: Infrastructure Configuration (Required)
en: Infrastructure Configuration
- Parameters:
- InstanceType
- ImageId
- Password
Label:
default:
zh-cn: ECS Configuration (Required)
en: ECS Configuration
- Parameters:
- SystemDiskSize
- SystemDiskCategory
- FirstDataDiskSize
- FirstDataDiskCategory
- SecondDataDiskSize
- SecondDataDiskCategory
Label:
default:
zh-cn: ECS Disk Configuration (Required)
en: ECS Disk Configuration
{
"ROSTemplateFormatVersion": "2015-09-01",
"Description": {
"zh-cn": "Create an ECS instance, configure an Elastic IP Address (EIP), attach two data disks, and set up the network environment and security group rules.",
"en": "Create an ECS instance, configure an Elastic IP Address (EIP), attach two data disks, and set up the network environment and security group rules."
},
"Parameters": {
"FirstDataDiskCategory": {
"AssociationProperty": "ALIYUN::ECS::Disk::DataDiskCategory",
"AssociationPropertyMetadata": {
"InstanceType": "${InstanceType}",
"ZoneId": "${ZoneId}"
},
"Type": "String",
"Label": {
"zh-cn": "Category of data disk 1",
"en": "First Data Disk Category"
}
},
"SystemDiskCategory": {
"AssociationProperty": "ALIYUN::ECS::Disk::SystemDiskCategory",
"AssociationPropertyMetadata": {
"InstanceType": "InstanceType",
"ZoneId": "ZoneId"
},
"Type": "String",
"Label": {
"zh-cn": "System disk type",
"en": "System Disk Type"
}
},
"SecondDataDiskSize": {
"Default": 40,
"Type": "Number",
"Description": {
"zh-cn": "The size of the second data disk, in GiB. Value range: cloud:[5, 2000], cloud_efficiency:[20, 32768], cloud_ssd:[20, 32768], ephemeral_ssd:[5, 800]. The value must be equal to or greater than the specific snapshot size.",
"en": "The size of the second data disk, in GiB. Value range: cloud: [5, 2000], cloud_efficiency: [20, 32768], cloud_ssd: [20, 32768], ephemeral_ssd: [5, 800]. The value must be equal to or greater than the specific snapshot size."
},
"Label": {
"zh-cn": "Size of data disk 2",
"en": "Second Data Disk Size"
}
},
"SystemDiskSize": {
"Default": 40,
"Type": "Number",
"Description": {
"zh-cn": "The size of the system disk, in GiB. Value range: cloud:[5, 2000], cloud_efficiency:[20, 32768], cloud_ssd:[20, 32768], ephemeral_ssd:[5, 800]. The value must be equal to or greater than the specific snapshot size.",
"en": "The size of the system disk, in GiB. Value range: cloud: [5, 2000], cloud_efficiency: [20, 32768], cloud_ssd: [20, 32768], ephemeral_ssd: [5, 800]. The value must be equal to or greater than the specific snapshot size."
},
"Label": {
"zh-cn": "System disk size",
"en": "System Disk Space"
}
},
"VpcCidrBlock": {
"Default": "192.168.0.0/16",
"Label": {
"zh-cn": "VPC CIDR block",
"en": "VPC CIDR Block"
},
"Type": "String",
"Description": {
"zh-cn": "The CIDR block for the new VPC. We recommend using one of the following CIDR blocks:
<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>",
"en": "The CIDR block for the new VPC. We recommend using 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"
]
},
"FirstDataDiskSize": {
"Default": 40,
"Type": "Number",
"Description": {
"zh-cn": "The size of the first data disk, in GiB. Value range: cloud:[5, 2000], cloud_efficiency:[20, 32768], cloud_ssd:[20, 32768], ephemeral_ssd:[5, 800]. The value must be equal to or greater than the specific snapshot size.",
"en": "The size of the first data disk, in GiB. Value range: cloud: [5, 2000], cloud_efficiency: [20, 32768], cloud_ssd: [20, 32768], ephemeral_ssd: [5, 800]. The value must be equal to or greater than the specific snapshot size."
},
"Label": {
"zh-cn": "Capacity of data disk 1",
"en": "First Data Disk Size"
}
},
"SecondDataDiskCategory": {
"AssociationProperty": "ALIYUN::ECS::Disk::DataDiskCategory",
"AssociationPropertyMetadata": {
"InstanceType": "${InstanceType}",
"ZoneId": "${ZoneId}"
},
"Type": "String",
"Label": {
"zh-cn": "Category of data disk 2",
"en": "Second Data Disk Category"
}
},
"VSwitchCidrBlock": {
"Default": "192.168.0.0/24",
"Type": "String",
"Description": {
"zh-cn": "The CIDR block for the new vSwitch. This is a subnet of the VPC.",
"en": "The CIDR block for the new vSwitch. This is a subnet of the VPC."
},
"Label": {
"zh-cn": "vSwitch CIDR block",
"en": "VSwitch CIDR Block"
}
},
"Password": {
"ConstraintDescription": {
"zh-cn": "Length: 8 to 30 characters. Must contain at least three of the following: uppercase letters, lowercase letters, digits, and special characters. Special characters include the following: ()`~!@#$%^&*_-+=|{}[]:;' <>,.?/",
"en": "Length: 8 to 30 characters. Must contain at least three of the following: uppercase letters, lowercase letters, digits, and special characters. Special characters include the following: ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/"
},
"Description": {
"zh-cn": "The server logon password. Length: 8 to 30 characters. Must contain at least three of the following: uppercase letters, lowercase letters, digits, and special characters from ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/.",
"en": "The server logon password. Length: 8 to 30 characters. Must contain at least three of the following: uppercase letters, lowercase letters, digits, and special characters from ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/."
},
"MinLength": 8,
"Label": {
"zh-cn": "Instance password",
"en": "Instance Password"
},
"AllowedPattern": "[a-zA-Z0-9-\\(\\)\\`\\~\\!@\\#\\$%\\^&\\*-+=\\|\\{\\}\\[\\]\\:\\;\\‘\\,\\.\\?\\/]*",
"NoEcho": true,
"MaxLength": 30,
"Type": "String"
},
"InstanceType": {
"AssociationProperty": "ALIYUN::ECS::Instance::InstanceType",
"AssociationPropertyMetadata": {
"ZoneId": "ZoneId"
},
"Type": "String",
"Description": {
"zh-cn": "<font color='blue'><b>1. Before selecting the instance type, confirm that it is available in the current zone. Some instance types require advance registration.</font>
<font color='blue'><b>2. Available instance types</font><br></font>[ecs.c5.large <font color='green'>2 vCPUs, 4 GiB memory, 1 Gbit/s internal bandwidth, 300,000 PPS</font>]
[ecs.c5.xlarge <font color='green'>4 vCPUs, 8 GiB memory, 1.5 Gbit/s internal bandwidth, 500,000 PPS</font>]
[ecs.c5.2xlarge <font color='green'>8 vCPUs, 16 GiB memory, 2.5 Gbit/s internal bandwidth, 800,000 PPS</font>]",
"en": "<font color='blue'>1. Before selecting the instance type, confirm that it is available in the current zone. Some instance types require advance registration.</font>
<font color='blue'><b>2. Available instance types</font><br></font>[ecs.c5.large <font color='green'>2 vCPUs, 4 GiB memory, 1 Gbit/s internal bandwidth, 300,000 PPS</font>]
[ecs.c5.xlarge <font color='green'>4 vCPUs, 8 GiB memory, 1.5 Gbit/s internal bandwidth, 500,000 PPS</font>]
[ecs.c5.2xlarge <font color='green'>8 vCPUs, 16 GiB memory, 2.5 Gbit/s internal bandwidth, 800,000 PPS</font>]"
},
"Label": {
"zh-cn": "Instance type",
"en": "Instance Type"
}
},
"ZoneId": {
"AssociationProperty": "ALIYUN::ECS::Instance:ZoneId",
"Type": "String",
"Description": {
"zh-cn": "Availability Zone ID.
<b>Note: <font color='blue'>Before selecting, confirm that the Availability Zone supports the ECS instance type. We recommend selecting a different zone than other vSwitches.</font>",
"en": "Availability Zone ID.
<b>Note: <font color='blue'>Before selecting, confirm that the Availability Zone supports the ECS instance type. We recommend selecting a different zone than other vSwitches.</font>"
},
"Label": {
"zh-cn": "vSwitch zone",
"en": "VSwitch Availability Zone"
}
},
"ImageId": {
"AssociationPropertyMetadata": {
"InstanceType": "${InstanceType}",
"SupportedImageOwnerAlias": [
"system",
"self",
"others"
]
},
"Description": {
"zh-cn": "Image ID. For more information, see <a href='https://www.alibabacloud.com/help/document_detail/112977.html' target='_blank'><font color='blue'>Find an image</font></a>",
"en": "Image ID. For more information, see <a href='https://www.alibabacloud.com/help/doc-detail/112977.html' target='_blank'><font color='blue'>Find an image</font></a>"
},
"Default": "centos_7_04_64_20G_alibase_201701015.vhd",
"Label": {
"zh-cn": "Image ID",
"en": "Image ID"
},
"AssociationProperty": "ALIYUN::ECS::Image::ImageId",
"Type": "String"
}
},
"Outputs": {
"VpcId": {
"Description": "Id of created VPC.",
"Value": {
"Fn::GetAtt": [
"Vpc",
"VpcId"
]
}
},
"InstanceId": {
"Description": "The instance id of created ecs instance.",
"Value": {
"Fn::GetAtt": [
"WebServer",
"InstanceId"
]
}
},
"SecurityGroupId": {
"Description": "generated security group id for security group.",
"Value": {
"Fn::GetAtt": [
"SecurityGroup",
"SecurityGroupId"
]
}
},
"EipId": {
"Description": "ID that Aliyun assigns to represent the allocation of the address for use with VPC. Returned only for VPC elastic IP addresses.",
"Value": {
"Fn::GetAtt": [
"Eip",
"AllocationId"
]
}
},
"ZoneId": {
"Description": "Zone ID of created instance.",
"Value": {
"Fn::GetAtt": [
"WebServer",
"ZoneId"
]
}
},
"VSwitchId": {
"Description": "Id of created VSwitch.",
"Value": {
"Fn::GetAtt": [
"VSwitch",
"VSwitchId"
]
}
}
},
"Resources": {
"EIPBind": {
"Type": "ALIYUN::VPC::EIPAssociation",
"Properties": {
"InstanceId": {
"Ref": "WebServer"
},
"AllocationId": {
"Ref": "Eip"
}
},
"Metadata": {
"ALIYUN::ROS::Designer": {
"id": "ece3b051-66c9-46d6-9961-f184d342b21f"
}
}
},
"Eip": {
"Type": "ALIYUN::VPC::EIP",
"Properties": {
"InternetChargeType": "PayByTraffic",
"Bandwidth": 1
},
"Metadata": {
"ALIYUN::ROS::Designer": {
"id": "a914d36e-d429-46d6-bbd0-a22acd07b096"
}
}
},
"SecurityGroupEgress": {
"Type": "ALIYUN::ECS::SecurityGroupEgress",
"Properties": {
"DestCidrIp": "0.0.0.0/0",
"IpProtocol": "all",
"SecurityGroupId": {
"Ref": "SecurityGroup"
},
"NicType": "intranet",
"PortRange": "-1/-1"
},
"Metadata": {
"ALIYUN::ROS::Designer": {
"id": "faa26b3c-3507-41e9-9959-5db9a9e67446"
}
}
},
"SecurityGroup": {
"Type": "ALIYUN::ECS::SecurityGroup",
"Properties": {
"VpcId": {
"Ref": "Vpc"
}
},
"Metadata": {
"ALIYUN::ROS::Designer": {
"id": "fde92bb4-877d-4e7b-b9dd-be6f5e552544"
}
}
},
"SecurityGroupIngress": {
"Type": "ALIYUN::ECS::SecurityGroupIngress",
"Properties": {
"IpProtocol": "all",
"SecurityGroupId": {
"Ref": "SecurityGroup"
},
"NicType": "intranet",
"SourceCidrIp": "0.0.0.0/0",
"PortRange": "-1/-1"
},
"Metadata": {
"ALIYUN::ROS::Designer": {
"id": "2a6cfdef-e236-4966-a976-dd7e7bbc37a5"
}
}
},
"WebServer": {
"Type": "ALIYUN::ECS::Instance",
"Properties": {
"UserData": {
"Fn::Join": [
"",
[
"#!/bin/sh\n",
"logs=~/mount_logs\n",
"i=1\n",
"total=2\n",
"while [ $i -le $total ]\n",
"do\n",
" disk_suffix=`echo $i|awk '{printf \"%c\", 97+$i}'`\n",
"fdisk -S 56 /dev/vd$disk_suffix <<ESXU\n",
"n\n",
"p\n",
"1\n",
"\n",
"\n",
"w\n",
"ESXU\n",
" echo \"/dev/vd$disk_suffix is fdisked!\" >> $logs\n",
" mkfs.ext4 /dev/vd${disk_suffix}1\n",
" if [ $? -eq 0 ];then\n",
" echo \"/dev/vd${disk_suffix}1 is formated!\" >> $logs\n",
" fi\n",
" touch ~/test_ftab\n",
" mkdir $disk_suffix$i\n",
" disk_uuid=`blkid | grep /dev/vd${disk_suffix}1 |awk '{printf $2}'|sed 's/\\\"//g'`\n",
"cat << ESXU > ~/test_ftab\n",
"$disk_uuid $disk_suffix$i ext4 defaults 0 0\n",
"ESXU\n",
" cat ~/test_ftab >> /etc/fstab\n",
" mount -a\n",
" chmod -R 777 $disk_suffix$i\n",
" rm -rf ~/test_ftab\n",
" echo \"/dev/vd${disk_suffix}1 is mounted!\" >> $logs\n",
" let i+=1\n",
"done\n"
]
]
},
"SystemDiskCategory": {
"Ref": "SystemDiskCategory"
},
"VpcId": {
"Ref": "Vpc"
},
"SecurityGroupId": {
"Ref": "SecurityGroup"
},
"SystemDiskSize": {
"Ref": "SystemDiskSize"
},
"ImageId": {
"Ref": "ImageId"
},
"AllocatePublicIP": "false",
"VSwitchId": {
"Ref": "VSwitch"
},
"IoOptimized": "optimized",
"Password": {
"Ref": "Password"
},
"DiskMappings": [
{
"Category": {
"Ref": "FirstDataDiskCategory"
},
"Size": {
"Ref": "FirstDataDiskSize"
}
},
{
"Category": {
"Ref": "SecondDataDiskCategory"
},
"Size": {
"Ref": "SecondDataDiskSize"
}
}
],
"InstanceType": {
"Ref": "InstanceType"
}
},
"Metadata": {
"ALIYUN::ROS::Designer": {
"id": "4f476130-0cde-4cff-a973-2cb026e18f13"
}
}
},
"Vpc": {
"Type": "ALIYUN::ECS::VPC",
"Properties": {
"CidrBlock": {
"Ref": "VpcCidrBlock"
}
},
"Metadata": {
"ALIYUN::ROS::Designer": {
"id": "adfdd097-9c30-49ff-8738-ae3b59eada43"
}
}
},
"VSwitch": {
"Type": "ALIYUN::ECS::VSwitch",
"Properties": {
"VpcId": {
"Fn::GetAtt": [
"Vpc",
"VpcId"
]
},
"CidrBlock": {
"Ref": "VSwitchCidrBlock"
},
"ZoneId": {
"Ref": "ZoneId"
}
},
"Metadata": {
"ALIYUN::ROS::Designer": {
"id": "bd814869-3bd7-4551-a5db-0ec7ad3d3246"
}
}
}
},
"Metadata": {
"ALIYUN::ROS::Interface": {
"ParameterGroups": [
{
"Parameters": [
"ZoneId",
"VpcCidrBlock",
"VSwitchCidrBlock"
],
"Label": {
"default": {
"zh-cn": "Infrastructure Configuration (Required)",
"en": "Infrastructure Configuration"
}
}
},
{
"Parameters": [
"InstanceType",
"ImageId",
"Password"
],
"Label": {
"default": {
"zh-cn": "ECS Configuration (Required)",
"en": "ECS Configuration"
}
}
},
{
"Parameters": [
"SystemDiskSize",
"SystemDiskCategory",
"FirstDataDiskSize",
"FirstDataDiskCategory",
"SecondDataDiskSize",
"SecondDataDiskCategory"
],
"Label": {
"default": {
"zh-cn": "ECS Disk Configuration (Required)",
"en": "ECS Disk Configuration"
}
}
}
]
}
}
}For more examples, see public templates that include this resource.