All Products
Search
Document Center

Resource Orchestration Service:ALIYUN::ECS::Instance

Last Updated:Jun 02, 2026

Creates an ECS instance.

Important

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.

  • Set the value to 0 to use the no-protection-period pattern.

  • The retention period of 2 to 6 days is in invitational preview. To enable it, submit a ticket.

  • The default value is 1.

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:

  • Specifying ubuntu matches ubuntu16_0402_64_20G_alibase_20170818.vhd.

  • Specifying ubuntu_14 matches ubuntu_14_0405_64_20G_alibase_20170824.vhd.

  • Specifying ubuntu*14*32 matches ubuntu_14_0405_32_40G_alibase_20170711.vhd.

  • Specifying ubuntu_16_0402_32 matches ubuntu_16_0402_32_40G_alibase_20170711.vhd.

InstanceType

String

Yes

Yes

The ECS instance type.

Supported types: 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:

  • Active: Enable security hardening. This setting applies only to public images.

  • Inactive (default): Do not enable security hardening. This setting applies to all image types.

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 http:// or https://. It can contain digits, colons (:), underscores (_), and hyphens (-).

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: ( ) ' ~ ! @ # $ % ^ & * - + = | { } [ ] : ; < > , . ? / -. If you specify this property, call the API over HTTPS to prevent password leaks.

PasswordInherit

Boolean

No

No

Specifies whether to use the password preset in the image.

Valid values are:

  • true: Enabled.

  • false (default): Disabled.

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 (-).

  • For Windows platforms, the name can be up to 15 characters long. It can contain letters, digits, and hyphens (-). The name cannot contain periods (.) or consist only of digits.

  • For other platforms, such as Linux, the name can be up to 30 characters long. It consists of segments separated by periods (.). Each segment can contain letters, digits, and hyphens (-).

AllocatePublicIP

Boolean

No

No

Specifies whether to assign a public IP address.

Value:

  • true (default): Assigns a public IP.

  • false: Does not assign a public IP.

Note

A public IP is assigned if InternetMaxBandwidthOut is greater than 0.

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:

  • PayByBandwidth: Pay-by-bandwidth.

  • PayByTraffic (default): Pay-by-data-transfer.

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:

  • none: Do not create an I/O optimized instance.

  • optimized (default): Create an I/O optimized instance.

DiskMappings

List

No

Yes

The data disks to attach.

You can specify up to 16 data disks.

DiskMappings syntax. DiskMappings properties.

SystemDiskCategory

String

No

Yes

The system disk category.

Valid values are:

  • cloud: basic disk.

  • cloud_ssd: Standard SSD.

  • cloud_efficiency: ultra disk.

  • cloud_essd: enterprise SSD (ESSD).

  • ephemeral_ssd: local SSD disk.

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 description of the system disk.

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 http:// or https://. It can contain letters, digits, colons (:), underscores (_), and hyphens (-).

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: [{"Key": "tagKey", "Value": "tagValue"},{"Key": "tagKey2", "Value": "tagValue2"}].

Tags syntax. 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:

  • PrePaid: Subscription. If you specify PrePaid, ensure that your account has a sufficient balance. Otherwise, instance creation fails.

  • PostPaid (default): Pay-as-you-go.

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.

Create a RAM role. View RAM roles.

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:

  • NoSpot (default): Normal pay-as-you-go instance.

  • SpotWithPriceLimit: Spot instance with an upper price limit.

  • SpotAsPriceGo: The system bids automatically, up to the pay-as-you-go price.

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:

  • Week.

  • Month (default)

AutoRenewPeriod

Number

No

No

The duration of each auto-renewal.

AutoRenewPeriod is a required property when AutoRenew is set to True.

Values:

  • If PeriodUnit is Week, AutoRenewPeriod can be 1, 2, or 3.

  • If PeriodUnit is Month, AutoRenewPeriod can be 1, 2, 3, 6, or 12.

AutoRenew

String

No

No

Specifies whether to enable auto-renewal.

Valid values:

  • True: Enable auto-renewal.

  • False (default): Disable auto-renewal.

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:

  • true: Enable instance release protection.

  • false (default): Disable instance release protection.

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:

  • PL0: Maximum random read/write IOPS per single disk is 10,000.

  • PL1 (default value): Maximum random read/write IOPS per single disk is 50,000.

  • PL2: Maximum random read/write IOPS per single disk is 100,000.

  • PL3: Maximum random read/write IOPS per single disk is 1,000,000.

ESSD selection guide: 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.

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:

  • optional (default): Not enforced.

  • required: Enforced. If set, NAT mode cannot access instance metadata.

Note

Access patterns: 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:

  • Enabled (default): Enables the feature.

  • Disabled: Disables the feature.

Tenancy

String

No

No

Specifies whether to create the instance on a Dedicated Host.

Valid values are:

  • default: Create a regular instance.

  • host: Create a Dedicated Host instance. If you do not specify a DedicatedHostId, Alibaba Cloud automatically selects a Dedicated Host to place the instance.

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:

  • default: The instance is not associated with a Dedicated Host. When a stopped instance with economical mode enabled is restarted, it is moved to a different Dedicated Host in the automatic deployment resource pool if the original host lacks sufficient resources.

  • host: The instance is associated with a Dedicated Host. When a stopped instance with economical mode enabled is restarted, it remains on the original Dedicated Host. If the original host lacks sufficient resources, the restart fails.

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:

  • true

  • false

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.

  • If you set the ImageId parameter, do not set this parameter.

  • If you do not set the ImageId parameter, but the launch template specified by LaunchTemplateId or LaunchTemplateName has ImageId set, do not set this parameter.

  • If you do not set ImageId, and the launch template specified by LaunchTemplateId or LaunchTemplateName does not have ImageId set, you can set this parameter.

  • If you do not set ImageId, and you do not set LaunchTemplateId or LaunchTemplateName, you can set this parameter.

Note

Available image families: 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:

  • Cloud: basic disk.

  • cloud_ssd: Standard SSD.

  • cloud_essd: enterprise SSD (ESSD).

  • cloud_efficiency: ultra disk.

  • ephemeral_ssd: local SSD.

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:

{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Resources": {
    "Instance": {
      "Type": "ALIYUN::ECS::Instance",
      "Properties": {
        "InstanceName": "rostest",
        "ImageId": "m-2ze5ysugu8ss7nxr****",
        "InstanceType": "ecs.g6e.large",
        "Password": "Ros1****",
        "IoOptimized": "optimized",
        "VSwitchId": "vsw-2zej7phc6euuelo8l****",
        "VpcId": "vpc-2zebbi27bn7w42n30****",
        "SecurityGroupId": "sg-2ze5bdyyg7sfrcv6****",
        "SystemDiskCategory": "cloud_essd",
        "DiskMappings": [
          {
            "Category": "cloud_essd",
            "Size": 40,
            "Device": "/dev/xvdb"
          }
        ]
      }
    }
  }
}
                                

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 http:// or https://. It can contain letters, Chinese characters, digits, underscores (_), colons (:), and hyphens (-).

Description

String

No

No

The description.

Length: 2 to 256 characters. The description cannot start with http:// or https://.

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:

  • PL1 (default): Up to 50,000 random read/write IOPS per disk.

  • PL2: Up to 100,000 random read/write IOPS per disk.

  • PL3: Up to 1,000,000 random read/write IOPS per disk.

ESSD selection guide: 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 aliyun or acs:. It cannot contain http:// or https://.

Value

String

No

No

The tag value.

Length: 0 to 128 characters. The value cannot start with aliyun or acs:. It cannot contain http:// or https://.

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:

  • Open: Launch instances using available capacity from private pools that match your criteria. If no matching private pool capacity is available, Alibaba Cloud uses public pool resources instead. Do not set the PrivatePoolOptions.Id parameter in this mode.

  • Target: Launch instances using a specific private pool. If the specified private pool is unavailable, the instance launch fails. Set the PrivatePoolOptions.Id parameter in this mode.

  • None (default): Do not use private pool capacity. Instances launch using only public pool resources.

In any of the following scenarios, the private pool capacity option for an instance launch can only be set to None or be omitted.

  • Create a spot instance.

  • Create an ECS instance of the classic network type.

  • Create an ECS instance on a Dedicated Host (DDH).

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.

Quick create

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: 现有专有网络的实例ID
    Label:
      en: VPC ID
      zh-cn: 专有网络VPC实例ID
  VSwitchZoneId:
    AssociationProperty: ALIYUN::ECS::Instance:ZoneId
    Type: String
    Description:
      zh-cn: 可用区ID。<br><b>注: <font color='blue'>选择前请确认该可用区是否支持创建ECS资源的规格,建议与其他交换机可用区不同</font></b>
      en: Availability Zone ID.<br><b>note:<font color='blue'>before selecting, please confirm that the Availability Zone supports the specification of creating ECS resources,which is recommended to be different from other VSwitch Availability Zone</font></b>
    Label:
      zh-cn: 交换机可用区
      en: VSwitch Availability Zone
  VSwitchId:
    AssociationProperty: ALIYUN::ECS::VSwitch::VSwitchId
    AssociationPropertyMetadata:
      VpcId: ${VpcId}
      ZoneId: ${VSwitchZoneId}
    Type: String
    Description:
      en: Instance ID of existing business network switches, console-Virtual Private Cloud-VSwitches under query
      zh-cn: 现有业务网络交换机的实例ID
    Label:
      en: VSwitch ID
      zh-cn: 交换机实例ID
  SecurityGroupId:
    Type: String
    AssociationProperty: ALIYUN::ECS::SecurityGroup::SecurityGroupId
    AssociationPropertyMetadata:
      VpcId: ${VpcId}
    Description:
      en: Please search the business security group ID starting with(sg-xxx)from console-ECS-Network & Security
      zh-cn: 现有业务安全组的实例ID
    Label:
      en: Business Security Group ID
      zh-cn: 业务安全组ID
  InstanceType:
    Type: String
    Description:
      zh-cn: 填写VSwitch可用区下可使用的规格。
      en: Fill in the specifications that can be used under the VSwitch availability zone.
    Label:
      zh-cn: 实例规格
      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: 系统盘类型
    Description:
      en: '<font color=''blue''><b>Optional values:</b></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>]'
      zh-cn: '<font color=''blue''><b>可选值:</b></font><br>[cloud_efficiency: <font color=''green''>高效云盘</font>]<br>[cloud_ssd: <font color=''green''>SSD云盘</font>]<br>[cloud_essd: <font color=''green''>ESSD云盘</font>]<br>[cloud: <font color=''green''>普通云盘</font>]<br>[ephemeral_ssd: <font color=''green''>本地SSD盘</font>]'
  SystemDiskSize:
    Default: 40
    Type: Number
    Description:
      zh-cn: 系统盘大小, 取值范围:[40, 500], 单位:GB。
      en: 'System disk size, range of values: 40-500, units: GB.'
    Label:
      zh-cn: 系统盘空间
      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": "现有专有网络的实例ID"
      },
      "Label": {
        "en": "VPC ID",
        "zh-cn": "专有网络VPC实例ID"
      }
    },
    "VSwitchZoneId": {
      "AssociationProperty": "ALIYUN::ECS::Instance:ZoneId",
      "Type": "String",
      "Description": {
        "zh-cn": "可用区ID。<br><b>注: <font color='blue'>选择前请确认该可用区是否支持创建ECS资源的规格,建议与其他交换机可用区不同</font></b>",
        "en": "Availability Zone ID.<br><b>note:<font color='blue'>before selecting, please confirm that the Availability Zone supports the specification of creating ECS resources,which is recommended to be different from other VSwitch Availability Zone</font></b>"
      },
      "Label": {
        "zh-cn": "交换机可用区",
        "en": "VSwitch Availability Zone"
      }
    },
    "VSwitchId": {
      "AssociationProperty": "ALIYUN::ECS::VSwitch::VSwitchId",
      "AssociationPropertyMetadata": {
        "VpcId": "${VpcId}",
        "ZoneId": "${VSwitchZoneId}"
      },
      "Type": "String",
      "Description": {
        "en": "Instance ID of existing business network switches, console-Virtual Private Cloud-VSwitches under query",
        "zh-cn": "现有业务网络交换机的实例ID"
      },
      "Label": {
        "en": "VSwitch ID",
        "zh-cn": "交换机实例ID"
      }
    },
    "SecurityGroupId": {
      "Type": "String",
      "AssociationProperty": "ALIYUN::ECS::SecurityGroup::SecurityGroupId",
      "AssociationPropertyMetadata": {
        "VpcId": "${VpcId}"
      },
      "Description": {
        "en": "Please search the business security group ID starting with(sg-xxx)from console-ECS-Network & Security",
        "zh-cn": "现有业务安全组的实例ID"
      },
      "Label": {
        "en": "Business Security Group ID",
        "zh-cn": "业务安全组ID"
      }
    },
    "InstanceType": {
      "Type": "String",
      "Description": {
        "zh-cn": "填写VSwitch可用区下可使用的规格。",
        "en": "Fill in the specifications that can be used under the VSwitch availability zone."
      },
      "Label": {
        "zh-cn": "实例规格",
        "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": "系统盘类型"
      },
      "Description": {
        "en": "<font color='blue'><b>Optional values:</b></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>]",
        "zh-cn": "<font color='blue'><b>可选值:</b></font><br>[cloud_efficiency: <font color='green'>高效云盘</font>]<br>[cloud_ssd: <font color='green'>SSD云盘</font>]<br>[cloud_essd: <font color='green'>ESSD云盘</font>]<br>[cloud: <font color='green'>普通云盘</font>]<br>[ephemeral_ssd: <font color='green'>本地SSD盘</font>]"
      }
    },
    "SystemDiskSize": {
      "Default": 40,
      "Type": "Number",
      "Description": {
        "zh-cn": "系统盘大小, 取值范围:[40, 500], 单位:GB。",
        "en": "System disk size, range of values: 40-500, units: GB."
      },
      "Label": {
        "zh-cn": "系统盘空间",
        "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.

Quick create

ROSTemplateFormatVersion: '2015-09-01'
Description:
  zh-cn: 创建ECS实例,配置VPC、安全组、多IP地址、系统盘及网络接口,支持自定义实例规格、镜像和网络设置。
  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'><b>1.选择机型前请先确认当前可用区下该机型是否有货,部分机型需要提前报备</b></font><br><font color='blue'><b>2.可选机型列表</font><br></b></font>[ecs.c5.large <font color='green'>2vCPU 4GiB 内网带宽1Gbps 内网收发包30万PPS</font>]<br></b>[ecs.c5.xlarge <font color='green'>4vCPU 8GiB 内网带宽1.5Gbps 内网收发包50万PPS</font>]<br></b>[ecs.c5.2xlarge <font color='green'>8vCPU 16GiB 内网带宽2.5Gbps 内网收发包80万PPS</font>]
      en: <font color='blue'><b>1.Before selecting the model please confirm that the current available zone under the model is in stock, some models need to be reported in advance</b></font><br><font color='blue'><b>2.List of optional models</font><br></b></font>[ecs.c5.large <font color='green'>2vCPU 4GiB Intranet bandwidth1Gbps In-grid sending and receiving packages30MillionPPS</font>]<br></b>[ecs.c5.xlarge <font color='green'>4vCPU 8GiB Intranet bandwidth1.5Gbps In-grid sending and receiving packages50MillionPPS</font>]<br></b>[ecs.c5.2xlarge <font color='green'>8vCPU 16GiB Intranet bandwidth2.5Gbps In-grid sending and receiving packages80MillionPPS</font>]
    Label:
      zh-cn: 实例规格
      en: Instance Type
  VSwitchZoneId:
    AssociationProperty: ALIYUN::ECS::Instance:ZoneId
    Type: String
    Description:
      zh-cn: 可用区ID,<br><b>注: <font color='blue'>选择可用区前请确认该可用区是否支持创建ECS资源的规格</font></b>
      en: Availability Zone ID,<br><b>note: <font color='blue'>Before selecting, please confirm that the Availability Zone supports the specification of creating ECS resources</font></b>
    Label:
      zh-cn: 交换机可用区
      en: VSwitch Availability Zone
  EcsSystemDiskSize:
    Default: 40
    Type: Number
    Description:
      zh-cn: 系统盘大小, 取值范围:[40, 500], 单位:GB。
      en: 'System disk size, range of values: 40-500, units: GB.'
    Label:
      zh-cn: 系统盘空间
      en: System Disk Space
  EcsPassword:
    Description:
      zh-cn: 服务器登录密码,长度8-30,必须包含三项(大写字母、小写字母、数字、 ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ 中的特殊符号)。
      en: Server login password, Length 8-30, must contain three(Capital letters, lowercase letters, numbers, ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ Special symbol in).
    Type: String
    Label:
      zh-cn: 实例密码
      en: Instance Password
    NoEcho: true
    AssociationProperty: ALIYUN::ECS::Instance::Password
    ConstraintDescription:
      zh-cn: 长度8-30,必须包含三项(大写字母、小写字母、数字、 ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ 中的特殊符号)。
      en: Length 8-30, must contain three(Capital letters, lowercase letters, numbers, ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ Special symbol in).
  EcsImageId:
    AssociationPropertyMetadata:
      InstanceType: ${EcsInstanceType}
      SupportedImageOwnerAlias:
        - system
        - self
        - others
    Description:
      zh-cn: 实例镜像,详见:<b><a href='https://www.alibabacloud.com/help/document_detail/112977.html' target='_blank'><font color='blue'>查找镜像</font></a></b>
      en: 'Instance Image ID. see detail: <b><a href=''https://www.alibabacloud.com/help/doc-detail/112977.html'' target=''_blank''><font color=''blue''>Find the mirror</font></a></b>'
    Default: centos_7_04_64_20G_alibase_201701015.vhd
    Label:
      zh-cn: 镜像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''><b>可选值:</b></font><br>[cloud_efficiency: <font color=''green''>高效云盘</font>]<br>[cloud_ssd: <font color=''green''>SSD云盘</font>]<br>[cloud_essd: <font color=''green''>ESSD云盘</font>]<br>[cloud: <font color=''green''>普通云盘</font>]<br>[ephemeral_ssd: <font color=''green''>本地SSD盘</font>]'
      en: '<font color=''blue''><b>Optional values:</b></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: 系统盘类型
      en: System Disk Type
  IpAddressCount:
    Description:
      zh-cn: 取值范围:1-9。
      en: 'Allowed values: 1~9.'
    Default: 1
    MaxValue: 9
    MinValue: 1
    Label:
      zh-cn: 网卡分配IPv4数量
      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: 专有网络
            en: VPC
      - Parameters:
          - EcsInstanceType
          - EcsImageId
          - EcsSystemDiskCategory
          - EcsSystemDiskSize
          - EcsPassword
        Label:
          default:
            zh-cn: 云服务器
            en: ECS
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Description": {
    "zh-cn": "创建ECS实例,配置VPC、安全组、多IP地址、系统盘及网络接口,支持自定义实例规格、镜像和网络设置。",
    "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'><b>1.选择机型前请先确认当前可用区下该机型是否有货,部分机型需要提前报备</b></font><br><font color='blue'><b>2.可选机型列表</font><br></b></font>[ecs.c5.large <font color='green'>2vCPU 4GiB 内网带宽1Gbps 内网收发包30万PPS</font>]<br></b>[ecs.c5.xlarge <font color='green'>4vCPU 8GiB 内网带宽1.5Gbps 内网收发包50万PPS</font>]<br></b>[ecs.c5.2xlarge <font color='green'>8vCPU 16GiB 内网带宽2.5Gbps 内网收发包80万PPS</font>]",
        "en": "<font color='blue'><b>1.Before selecting the model please confirm that the current available zone under the model is in stock, some models need to be reported in advance</b></font><br><font color='blue'><b>2.List of optional models</font><br></b></font>[ecs.c5.large <font color='green'>2vCPU 4GiB Intranet bandwidth1Gbps In-grid sending and receiving packages30MillionPPS</font>]<br></b>[ecs.c5.xlarge <font color='green'>4vCPU 8GiB Intranet bandwidth1.5Gbps In-grid sending and receiving packages50MillionPPS</font>]<br></b>[ecs.c5.2xlarge <font color='green'>8vCPU 16GiB Intranet bandwidth2.5Gbps In-grid sending and receiving packages80MillionPPS</font>]"
      },
      "Label": {
        "zh-cn": "实例规格",
        "en": "Instance Type"
      }
    },
    "VSwitchZoneId": {
      "AssociationProperty": "ALIYUN::ECS::Instance:ZoneId",
      "Type": "String",
      "Description": {
        "zh-cn": "可用区ID,<br><b>注: <font color='blue'>选择可用区前请确认该可用区是否支持创建ECS资源的规格</font></b>",
        "en": "Availability Zone ID,<br><b>note: <font color='blue'>Before selecting, please confirm that the Availability Zone supports the specification of creating ECS resources</font></b>"
      },
      "Label": {
        "zh-cn": "交换机可用区",
        "en": "VSwitch Availability Zone"
      }
    },
    "EcsSystemDiskSize": {
      "Default": 40,
      "Type": "Number",
      "Description": {
        "zh-cn": "系统盘大小, 取值范围:[40, 500], 单位:GB。",
        "en": "System disk size, range of values: 40-500, units: GB."
      },
      "Label": {
        "zh-cn": "系统盘空间",
        "en": "System Disk Space"
      }
    },
    "EcsPassword": {
      "Description": {
        "zh-cn": "服务器登录密码,长度8-30,必须包含三项(大写字母、小写字母、数字、 ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ 中的特殊符号)。",
        "en": "Server login password, Length 8-30, must contain three(Capital letters, lowercase letters, numbers, ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ Special symbol in)."
      },
      "Type": "String",
      "Label": {
        "zh-cn": "实例密码",
        "en": "Instance Password"
      },
      "NoEcho": true,
      "AssociationProperty": "ALIYUN::ECS::Instance::Password",
      "ConstraintDescription": {
        "zh-cn": "长度8-30,必须包含三项(大写字母、小写字母、数字、 ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ 中的特殊符号)。",
        "en": "Length 8-30, must contain three(Capital letters, lowercase letters, numbers, ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ Special symbol in)."
      }
    },
    "EcsImageId": {
      "AssociationPropertyMetadata": {
        "InstanceType": "${EcsInstanceType}",
        "SupportedImageOwnerAlias": [
          "system",
          "self",
          "others"
        ]
      },
      "Description": {
        "zh-cn": "实例镜像,详见:<b><a href='https://www.alibabacloud.com/help/document_detail/112977.html' target='_blank'><font color='blue'>查找镜像</font></a></b>",
        "en": "Instance Image ID. see detail: <b><a href='https://www.alibabacloud.com/help/doc-detail/112977.html' target='_blank'><font color='blue'>Find the mirror</font></a></b>"
      },
      "Default": "centos_7_04_64_20G_alibase_201701015.vhd",
      "Label": {
        "zh-cn": "镜像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'><b>可选值:</b></font><br>[cloud_efficiency: <font color='green'>高效云盘</font>]<br>[cloud_ssd: <font color='green'>SSD云盘</font>]<br>[cloud_essd: <font color='green'>ESSD云盘</font>]<br>[cloud: <font color='green'>普通云盘</font>]<br>[ephemeral_ssd: <font color='green'>本地SSD盘</font>]",
        "en": "<font color='blue'><b>Optional values:</b></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": "系统盘类型",
        "en": "System Disk Type"
      }
    },
    "IpAddressCount": {
      "Description": {
        "zh-cn": "取值范围:1-9。",
        "en": "Allowed values: 1~9."
      },
      "Default": 1,
      "MaxValue": 9,
      "MinValue": 1,
      "Label": {
        "zh-cn": "网卡分配IPv4数量",
        "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": "专有网络",
              "en": "VPC"
            }
          }
        },
        {
          "Parameters": [
            "EcsInstanceType",
            "EcsImageId",
            "EcsSystemDiskCategory",
            "EcsSystemDiskSize",
            "EcsPassword"
          ],
          "Label": {
            "default": {
              "zh-cn": "云服务器",
              "en": "ECS"
            }
          }
        }
      ]
    }
  }
}

Scenario 3: Create an ECS instance and an Elastic IP Address (EIP), and attach multiple data disks.

Quick create

ROSTemplateFormatVersion: '2015-09-01'
Description:
  zh-cn: 创建ECS实例,配置弹性IP,挂载2个数据盘,设置网络环境与安全组规则。
  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: 数据盘1的磁盘类别
      en: First Data Disk Category
  SystemDiskCategory:
    AssociationProperty: ALIYUN::ECS::Disk::SystemDiskCategory
    AssociationPropertyMetadata:
      InstanceType: InstanceType
      ZoneId: ZoneId
    Type: String
    Label:
      zh-cn: 系统盘类型
      en: System Disk Type
  SecondDataDiskSize:
    Default: 40
    Type: Number
    Description:
      zh-cn: 第二个数据盘的大小,单位为GB。值范围:cloud:[5,2000]、cloud_efficiency:[20,32768]、cloud_ssd:[20,32768]、ephemeral_ssd:[5,800]。该值应等于或大于特定快照。
      en: 'The size of the Second volume, unit in GB.Value range: cloud: [5,2000], cloud_efficiency: [20,32768], cloud_ssd: [20,32768], ephemeral_ssd: [5,800].The value should be equal to or greater than the specific snapshot.'
    Label:
      zh-cn: 数据盘2的磁盘大小
      en: Second Data Disk Size
  SystemDiskSize:
    Default: 40
    Type: Number
    Description:
      zh-cn: 系统盘的大小,单位为GB。值范围:cloud:[5,2000]、cloud_efficiency:[20,32768]、cloud_ssd:[20,32768]、ephemeral_ssd:[5,800]。该值应等于或大于特定快照。
      en: 'Disk size of the system disk, unit in GB.Value range: cloud: [5,2000], cloud_efficiency: [20,32768], cloud_ssd: [20,32768], ephemeral_ssd: [5,800].The value should be equal to or greater than the specific snapshot.'
    Label:
      zh-cn: 系统盘大小
      en: System Disk Space
  VpcCidrBlock:
    Default: 192.168.0.0/16
    Label:
      zh-cn: 专有网络网段
      en: VPC CIDR Block
    Type: String
    Description:
      zh-cn: 新建专有网络IP地址段范围,推荐使用以下的IP地址段<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>
      en: New proprietary network IP address segment range, recommended use of the following IP address segments<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: 第一个数据盘的大小,单位为GB。值范围:cloud:[5,2000]、cloud_efficiency:[20,32768]、cloud_ssd:[20,32768]、ephemeral_ssd:[5,800]。该值应等于或大于特定快照。
      en: 'The size of the first volume, unit in GB.Value range: cloud: [5,2000], cloud_efficiency: [20,32768], cloud_ssd: [20,32768], ephemeral_ssd: [5,800].The value should be equal to or greater than the specific snapshot.'
    Label:
      zh-cn: 数据盘1的磁盘容量
      en: First Data Disk Size
  SecondDataDiskCategory:
    AssociationProperty: ALIYUN::ECS::Disk::DataDiskCategory
    AssociationPropertyMetadata:
      InstanceType: ${InstanceType}
      ZoneId: ${ZoneId}
    Type: String
    Label:
      zh-cn: 数据盘2的磁盘类别
      en: Second Data Disk Category
  VSwitchCidrBlock:
    Default: 192.168.0.0/24
    Type: String
    Description:
      zh-cn: 新建交换机的网段,所属虚拟专有网络的子网
      en: Network segments of new switches, subnets of virtual proprietary networks
    Label:
      zh-cn: 交换机网段
      en: VSwitch CIDR Block
  Password:
    ConstraintDescription:
      zh-cn: 长度8-30,必须包含大写字母、小写字母、数字、特殊符号三种;特殊字符包括:()`~!@#$%^&*_-+=|{}[]:;' <>,.?/
      en: 'Length 8-30, must contain upper case letters, lower case letters, Numbers, special symbols three; special characters include: ()`~!@#$%^&*_-+=|{}[]:;''<>,.?/'
    Description:
      zh-cn: 服务器登录密码,长度8-30,必须包含三项(大写字母、小写字母、数字、 ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ 中的特殊符号)。
      en: Server login password, Length 8-30, must contain three(Capital letters, lowercase letters, numbers, ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ Special symbol in).
    MinLength: 8
    Label:
      zh-cn: 实例密码
      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.选择机型前请先确认当前可用区下该机型是否有货,部分机型需要提前报备</b></font><br><font color='blue'><b>2.可选机型列表</font><br></b></font>[ecs.c5.large <font color='green'>2vCPU 4GiB 内网带宽1Gbps 内网收发包30万PPS</font>]<br></b>[ecs.c5.xlarge <font color='green'>4vCPU 8GiB 内网带宽1.5Gbps 内网收发包50万PPS</font>]<br></b>[ecs.c5.2xlarge <font color='green'>8vCPU 16GiB 内网带宽2.5Gbps 内网收发包80万PPS</font>]
      en: <font color='blue'><b>1.Before selecting the model please confirm that the current available zone under the model is in stock, some models need to be reported in advance</b></font><br><font color='blue'><b>2.List of optional models</font><br></b></font>[ecs.c5.large <font color='green'>2vCPU 4GiB Intranet bandwidth1Gbps In-grid sending and receiving packages30MillionPPS</font>]<br></b>[ecs.c5.xlarge <font color='green'>4vCPU 8GiB Intranet bandwidth1.5Gbps In-grid sending and receiving packages50MillionPPS</font>]<br></b>[ecs.c5.2xlarge <font color='green'>8vCPU 16GiB Intranet bandwidth2.5Gbps In-grid sending and receiving packages80MillionPPS</font>]
    Label:
      zh-cn: 实例规格
      en: Instance Type
  ZoneId:
    AssociationProperty: ALIYUN::ECS::Instance:ZoneId
    Type: String
    Description:
      zh-cn: 可用区ID。<br><b>注: <font color='blue'>选择前请确认该可用区是否支持创建ECS资源的规格,建议与其他交换机可用区不同</font></b>
      en: Availability Zone ID.<br><b>note:<font color='blue'>before selecting, please confirm that the Availability Zone supports the specification of creating ECS resources,which is recommended to be different from other VSwitch Availability Zone</font></b>
    Label:
      zh-cn: 交换机可用区
      en: VSwitch Availability Zone
  ImageId:
    AssociationPropertyMetadata:
      InstanceType: ${InstanceType}
      SupportedImageOwnerAlias:
        - system
        - self
        - others
    Description:
      zh-cn: 镜像ID, 详见:<b><a href='https://www.alibabacloud.com/help/document_detail/112977.html' target='_blank'><font color='blue'>查找镜像</font></a></b>
      en: Image ID,See detail:<b><a href='https://www.alibabacloud.com/help/doc-detail/112977.html' target='_blank'><font color='blue'>Find the mirror</font></a></b>
    Default: centos_7_04_64_20G_alibase_201701015.vhd
    Label:
      zh-cn: 镜像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: 基础资源配置(必填)
            en: Infrastructure Configuration
      - Parameters:
          - InstanceType
          - ImageId
          - Password
        Label:
          default:
            zh-cn: ECS 配置(必填)
            en: ECS Configuration
      - Parameters:
          - SystemDiskSize
          - SystemDiskCategory
          - FirstDataDiskSize
          - FirstDataDiskCategory
          - SecondDataDiskSize
          - SecondDataDiskCategory
        Label:
          default:
            zh-cn: ECS 磁盘配置(必填)
            en: ECS Disk Configuration
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Description": {
    "zh-cn": "创建ECS实例,配置弹性IP,挂载2个数据盘,设置网络环境与安全组规则。",
    "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": "数据盘1的磁盘类别",
        "en": "First Data Disk Category"
      }
    },
    "SystemDiskCategory": {
      "AssociationProperty": "ALIYUN::ECS::Disk::SystemDiskCategory",
      "AssociationPropertyMetadata": {
        "InstanceType": "InstanceType",
        "ZoneId": "ZoneId"
      },
      "Type": "String",
      "Label": {
        "zh-cn": "系统盘类型",
        "en": "System Disk Type"
      }
    },
    "SecondDataDiskSize": {
      "Default": 40,
      "Type": "Number",
      "Description": {
        "zh-cn": "第二个数据盘的大小,单位为GB。值范围:cloud:[5,2000]、cloud_efficiency:[20,32768]、cloud_ssd:[20,32768]、ephemeral_ssd:[5,800]。该值应等于或大于特定快照。",
        "en": "The size of the Second volume, unit in GB.Value range: cloud: [5,2000], cloud_efficiency: [20,32768], cloud_ssd: [20,32768], ephemeral_ssd: [5,800].The value should be equal to or greater than the specific snapshot."
      },
      "Label": {
        "zh-cn": "数据盘2的磁盘大小",
        "en": "Second Data Disk Size"
      }
    },
    "SystemDiskSize": {
      "Default": 40,
      "Type": "Number",
      "Description": {
        "zh-cn": "系统盘的大小,单位为GB。值范围:cloud:[5,2000]、cloud_efficiency:[20,32768]、cloud_ssd:[20,32768]、ephemeral_ssd:[5,800]。该值应等于或大于特定快照。",
        "en": "Disk size of the system disk, unit in GB.Value range: cloud: [5,2000], cloud_efficiency: [20,32768], cloud_ssd: [20,32768], ephemeral_ssd: [5,800].The value should be equal to or greater than the specific snapshot."
      },
      "Label": {
        "zh-cn": "系统盘大小",
        "en": "System Disk Space"
      }
    },
    "VpcCidrBlock": {
      "Default": "192.168.0.0/16",
      "Label": {
        "zh-cn": "专有网络网段",
        "en": "VPC CIDR Block"
      },
      "Type": "String",
      "Description": {
        "zh-cn": "新建专有网络IP地址段范围,推荐使用以下的IP地址段<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>",
        "en": "New proprietary network IP address segment range, recommended use of the following IP address segments<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": "第一个数据盘的大小,单位为GB。值范围:cloud:[5,2000]、cloud_efficiency:[20,32768]、cloud_ssd:[20,32768]、ephemeral_ssd:[5,800]。该值应等于或大于特定快照。",
        "en": "The size of the first volume, unit in GB.Value range: cloud: [5,2000], cloud_efficiency: [20,32768], cloud_ssd: [20,32768], ephemeral_ssd: [5,800].The value should be equal to or greater than the specific snapshot."
      },
      "Label": {
        "zh-cn": "数据盘1的磁盘容量",
        "en": "First Data Disk Size"
      }
    },
    "SecondDataDiskCategory": {
      "AssociationProperty": "ALIYUN::ECS::Disk::DataDiskCategory",
      "AssociationPropertyMetadata": {
        "InstanceType": "${InstanceType}",
        "ZoneId": "${ZoneId}"
      },
      "Type": "String",
      "Label": {
        "zh-cn": "数据盘2的磁盘类别",
        "en": "Second Data Disk Category"
      }
    },
    "VSwitchCidrBlock": {
      "Default": "192.168.0.0/24",
      "Type": "String",
      "Description": {
        "zh-cn": "新建交换机的网段,所属虚拟专有网络的子网",
        "en": "Network segments of new switches, subnets of virtual proprietary networks"
      },
      "Label": {
        "zh-cn": "交换机网段",
        "en": "VSwitch CIDR Block"
      }
    },
    "Password": {
      "ConstraintDescription": {
        "zh-cn": "长度8-30,必须包含大写字母、小写字母、数字、特殊符号三种;特殊字符包括:()`~!@#$%^&*_-+=|{}[]:;' <>,.?/",
        "en": "Length 8-30, must contain upper case letters, lower case letters, Numbers, special symbols three; special characters include: ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/"
      },
      "Description": {
        "zh-cn": "服务器登录密码,长度8-30,必须包含三项(大写字母、小写字母、数字、 ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ 中的特殊符号)。",
        "en": "Server login password, Length 8-30, must contain three(Capital letters, lowercase letters, numbers, ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ Special symbol in)."
      },
      "MinLength": 8,
      "Label": {
        "zh-cn": "实例密码",
        "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.选择机型前请先确认当前可用区下该机型是否有货,部分机型需要提前报备</b></font><br><font color='blue'><b>2.可选机型列表</font><br></b></font>[ecs.c5.large <font color='green'>2vCPU 4GiB 内网带宽1Gbps 内网收发包30万PPS</font>]<br></b>[ecs.c5.xlarge <font color='green'>4vCPU 8GiB 内网带宽1.5Gbps 内网收发包50万PPS</font>]<br></b>[ecs.c5.2xlarge <font color='green'>8vCPU 16GiB 内网带宽2.5Gbps 内网收发包80万PPS</font>]",
        "en": "<font color='blue'><b>1.Before selecting the model please confirm that the current available zone under the model is in stock, some models need to be reported in advance</b></font><br><font color='blue'><b>2.List of optional models</font><br></b></font>[ecs.c5.large <font color='green'>2vCPU 4GiB Intranet bandwidth1Gbps In-grid sending and receiving packages30MillionPPS</font>]<br></b>[ecs.c5.xlarge <font color='green'>4vCPU 8GiB Intranet bandwidth1.5Gbps In-grid sending and receiving packages50MillionPPS</font>]<br></b>[ecs.c5.2xlarge <font color='green'>8vCPU 16GiB Intranet bandwidth2.5Gbps In-grid sending and receiving packages80MillionPPS</font>]"
      },
      "Label": {
        "zh-cn": "实例规格",
        "en": "Instance Type"
      }
    },
    "ZoneId": {
      "AssociationProperty": "ALIYUN::ECS::Instance:ZoneId",
      "Type": "String",
      "Description": {
        "zh-cn": "可用区ID。<br><b>注: <font color='blue'>选择前请确认该可用区是否支持创建ECS资源的规格,建议与其他交换机可用区不同</font></b>",
        "en": "Availability Zone ID.<br><b>note:<font color='blue'>before selecting, please confirm that the Availability Zone supports the specification of creating ECS resources,which is recommended to be different from other VSwitch Availability Zone</font></b>"
      },
      "Label": {
        "zh-cn": "交换机可用区",
        "en": "VSwitch Availability Zone"
      }
    },
    "ImageId": {
      "AssociationPropertyMetadata": {
        "InstanceType": "${InstanceType}",
        "SupportedImageOwnerAlias": [
          "system",
          "self",
          "others"
        ]
      },
      "Description": {
        "zh-cn": "镜像ID, 详见:<b><a href='https://www.alibabacloud.com/help/document_detail/112977.html' target='_blank'><font color='blue'>查找镜像</font></a></b>",
        "en": "Image ID,See detail:<b><a href='https://www.alibabacloud.com/help/doc-detail/112977.html' target='_blank'><font color='blue'>Find the mirror</font></a></b>"
      },
      "Default": "centos_7_04_64_20G_alibase_201701015.vhd",
      "Label": {
        "zh-cn": "镜像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": "基础资源配置(必填)",
              "en": "Infrastructure Configuration"
            }
          }
        },
        {
          "Parameters": [
            "InstanceType",
            "ImageId",
            "Password"
          ],
          "Label": {
            "default": {
              "zh-cn": "ECS 配置(必填)",
              "en": "ECS Configuration"
            }
          }
        },
        {
          "Parameters": [
            "SystemDiskSize",
            "SystemDiskCategory",
            "FirstDataDiskSize",
            "FirstDataDiskCategory",
            "SecondDataDiskSize",
            "SecondDataDiskCategory"
          ],
          "Label": {
            "default": {
              "zh-cn": "ECS 磁盘配置(必填)",
              "en": "ECS Disk Configuration"
            }
          }
        }
      ]
    }
  }
}

For more examples, see public templates that include this resource.