ALIYUN::ECS::Instance is used to create an Elastic Compute Service (ECS) instance.

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,
    "UserData": String,
    "SystemDiskSize": Number,
    "ZoneId": String,
    "InternetMaxBandwidthOut": Integer,
    "VpcId": String,
    "SpotStrategy": String,
    "InstanceName": String,
    "DeletionProtection": Boolean,
    "DeploymentSetId": String,
    "SecurityGroupId": String,
    "SecurityEnhancementStrategy": String,
    "SpotPriceLimit": String,
    "HpcClusterId": String,
    "AllocatePublicIP": Boolean,
    "SystemDiskDescription": String,
    "SystemDiskPerformanceLevel": String,
    "DiskMappings": List
  }
}

Properties

Property Type Required Editable Description Constraint
ResourceGroupId String No No The ID of the resource group. None
SecurityGroupIds List No No The list of security group IDs. You cannot specify SecurityGroupId and SecurityGroupIds at the same time.
ImageId String Yes Yes The ID of the image that is used to create the instance. You can use a public image, a custom image, or an Alibaba Cloud Marketplace image. You can specify a partial public image ID instead of providing the complete ID. Examples:
  • If you enter ubuntu, the system matches it with the following ID: ubuntu16_0402_64_20G_alibase_20170818.vhd.
  • If you enter ubuntu_14, the system matches it with the following ID: ubuntu_14_0405_64_20G_alibase_20170824.vhd.
  • If you enter ubuntu*14*32, the system matches it with the following ID: ubuntu_14_0405_32_40G_alibase_20170711.vhd.
  • If you enter ubuntu_16_0402_32, the system matches it with the following ID: ubuntu_16_0402_32_40G_alibase_20170711.vhd.
InstanceType String Yes No The instance type of the ECS instance. For more information about ECS instance types, see Instance family.
SecurityGroupId String No No The ID of the security group. You cannot specify SecurityGroupId and SecurityGroupIds at the same time.
SecurityEnhancementStrategy String No No Specifies whether to enable security hardening. Default value: Deactive. Valid values:
  • Active: enables security hardening. This setting is applicable only to public images.
  • Deactive: disables security hardening. This setting is applicable to images of all types.
Description String No Yes The description of the ECS instance. The description must be 2 to 256 characters in length.
InstanceName String No No The name of the ECS instance. The name must be 2 to 128 characters in length and can contain letters, digits, colons (:), underscores (_), and hyphens (-). The name must start with a letter but cannot start with http:// or https://.

If this property is not specified, the instance ID is used.

Password String No Yes The password that is used to log on to the ECS instance. The password must be 8 to 30 characters in length. The password must contain at least three of the following character types: uppercase letters, lowercase letters, digits, and special characters. Special characters include ( ) ‘ ~ ! @ # $ % ^ & * - + = | { } [ ] : ; ‘ < > , . ? / -. If you specify this property in the API request, use HTTPS to secure the API and protect your password.
PasswordInherit Boolean No No Specifies whether to use the preset password of the image. Default value: false. Valid values:
  • true: uses the preset password.
  • false: does not use the preset password.
Note When the PasswordInherit property is specified, you must leave the Password property empty and make sure that the selected image has a preset password.
HostName String No No The hostname of the ECS instance. The hostname must be at least 2 characters in length and cannot contain consecutive periods (.) or hyphens (-). The hostname cannot start or end with a period (.) or hyphen (-).
  • For Windows instances, the hostname can be up to 15 characters in length and can contain letters, digits, and hyphens (-). The hostname cannot contain periods (.) or contain only digits.
  • For other instances such as Linux instances, the hostname can be up to 30 characters in length and can contain letters, digits, and hyphens (-). You can use periods (.) to separate a hostname into several segments.
AllocatePublicIP Boolean No No Specifies whether to allocate a public IP address to the ECS instance. Default value: true. Valid values:
  • true: allocates a public IP address to the ECS instance.
  • false: does not allocate a public IP address to the ECS instance.
Note If the InternetMaxBandwidthOut property is set to a value greater than 0, a public IP address is allocated.
PrivateIpAddress String No No The private IP address of the ECS instance in a VPC. The specified IP address must not be used by other instances in the VPC.
InternetChargeType String No No The billing method for network usage. Default value: PayByTraffic. Valid values:
  • PayByBandwidth
  • PayByTraffic
InternetMaxBandwidthOut Integer No No The maximum outbound bandwidth to the Internet. Valid values: 0 to 100.

Default value: 0.

Unit: Mbit/s.
IoOptimized String No No Specifies whether to create an I/O optimized instance. Default value: optimized. Valid values:
  • none: creates an I/O optimized instance.
  • optimized: does not create an I/O optimized instance.
DiskMappings List No No The data disks that you want to attach to the ECS instance. Up to 16 data disks can be attached.

For more information, see DiskMappings syntax and DiskMappings properties.

SystemDiskCategory String No No The type of the system disk. Valid values:
  • cloud: basic disk
  • cloud_ssd: standard SSD
  • cloud_efficiency: ultra disk
  • cloud_essd: enhanced SSD (ESSD)
  • ephemeral_ssd: local SSD
For non-I/O optimized instances of retired instance types, the default value is cloud. For other instances, the default value is cloud_efficiency.
SystemDiskDescription String No No The description of the system disk. None
SystemDiskDiskName String No No The name of the system disk. The name must be 2 to 128 characters in length and can contain letters, digits, colons (:), underscores (_), and hyphens (-). The name must start with a letter but cannot start with http:// or https://.
SystemDiskSize Number No Yes The size of the system disk. Valid values: 20 to 500.

Unit: GB.

If a custom image is used to create a system disk, make sure that the size of the system disk is larger than that of the custom image.
Tags List No Yes The custom tags of the ECS instance. Up to 20 tags can be specified in the [{"Key": "tagKey", "Value": "tagValue"},{"Key": "tagKey2", "Value": "tagValue2"}] format.

For more information, see Tags syntax and Tags properties.

UserData String No Yes The user data that you provide when you create an ECS instance. The user data can be up to 16 KB in size. You do not need to convert the data into Base64-encoded strings. If the data contains special characters, add a backslash (\) before each special character.
ZoneId String No No The zone ID of the ECS instance. None
HpcClusterId String No No The ID of the HPC cluster to which the ECS instance belongs. None
VpcId String No No The ID of the VPC. None
VSwitchId String No No The ID of the vSwitch. None
InstanceChargeType String No No The billing method of the ECS instance. Default value: PostPaid. Valid values:
  • PrePaid. If you set this property to PrePaid, make sure that you have sufficient balance in your account. Otherwise, the ECS instance cannot be created.
  • PostPaid.
Period Number No No The billing cycle of the ECS instance. Period is required if InstanceChargeType is set to PrePaid. PostPaid is optional if InstanceChargeType is set to PostPaid.
KeyPairName String No Yes The name of the key pair that is used to connect to the ECS instance. For Windows ECS instances, this property is ignored by default. For Linux ECS instances, logon by password is disabled by default. To enhance instance security, we recommend that you use the key pair for connection.
RamRoleName String No No The RAM role name of the ECS instance. For more information, see CreateRole and ListRoles.
SpotPriceLimit String No No The maximum hourly price of the instance. A maximum of three decimal places can be specified. This property takes effect only when the SpotStrategy property is set to SpotWithPriceLimit.
SpotStrategy String No No The bidding policy for the pay-as-you-go instance. SpotStrategy is required if InstanceChargeType is set to PostPaid.
Default value: NoSpot. Valid values:
  • NoSpot: applies to regular pay-as-you-go instances.
  • SpotWithPriceLimit: applies to preemptible instances that have maximum hourly prices.
  • SpotAsPriceGo: applies to pay-as-you-go instances that are of the market price at the time of purchase.
DedicatedHostId String No No The ID of the dedicated host for the ECS instance. You can call the DescribeDedicatedHosts API operation to query the list of dedicated host IDs. If this property is specified, the SpotStrategy and SpotPriceLimit properties are ignored. This is because preemptible instances cannot be created on dedicated hosts.
PeriodUnit String No No The unit of the subscription duration. Default value: Month. Valid values:
  • Week
  • Month
AutoRenewPeriod Number No No The auto-renewal period for the ECS instance. AutoRenewPeriod is required if AutoRenew is set to True.
  • Valid values if PeriodUnit is set to Week: 1, 2, and 3.
  • Valid values if PeriodUnit is set to Month: 1, 2, 3, 6, and 12.
AutoRenew String No No Specifies whether to enable auto-renewal for the ECS instance. Default value: False. Valid values:
  • True: enables auto-renewal for the ECS instance.
  • False: does not enable auto-renewal for the ECS instance.
AutoRenew is required if InstanceChargeType is set to PrePaid.
DeletionProtection Boolean No No The release protection property of the ECS instance. It specifies whether to release the ECS instance by using the ECS console or by calling the DeleteInstance API operation. Default value: false. Valid values:
  • true: enables release protection.
  • false: disables release protection.
Note This property is applicable only to pay-as-you-go instances. It can protect instances against manual releases, but not against automatic releases.
DeploymentSetId String No No The ID of the deployment set. None
SystemDiskPerformanceLevel String No No The performance level of the ESSD that is used as the system disk. Default value: PL1. Valid values:
  • PL1: A single ESSD can deliver up to 50,000 random read/write IOPS.
  • PL2: A single ESSD can deliver up to 100,000 random read/write IOPS.
  • PL3: A single ESSD can deliver up to 1,000,000 random read/write IOPS.
For more information about performance levels of ESSDs, see ESSDs.

DiskMappings syntax

"DiskMappings": [
  {
    "Category": String,
    "DiskName": String,
    "Description": String,
    "Device": String,
    "SnapshotId": String,
    "PerformanceLevel": String,
    "Size": String
  }
]

DiskMappings properties

Property Type Required Editable Description Constraint
Size String Yes No The size of the data disk. Valid values: 20 to 500.

Unit: GB.

Category String No No The type of the data disk. Valid values:
  • cloud: basic disk
  • cloud_ssd: standard SSD
  • cloud_essd: 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 Category to the disk type that you want in an ROS template when you create an ECS instance. Examples:

{
  "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 name of the data disk. The name must be 2 to 128 characters in length and can contain letters, digits, underscores (_), colons (:), and hyphens (-). The name must start with a letter but cannot start with http:// or https://.
Description String No No The description of the data disk. The description must be 2 to 256 characters in length and cannot start with http:// or https://.
Device String No No The mount target of the data disk. None
PerformanceLevel String No No The performance level of the ESSD that is used as the data disk. Default value: PL1. Valid values:
  • PL1: A single ESSD can deliver up to 50,000 random read/write IOPS.
  • PL2: A single ESSD can deliver up to 100,000 random read/write IOPS.
  • PL3: A single ESSD can deliver up to 1,000,000 random read/write IOPS.
For more information about performance levels of ESSDs, see ESSDs.
SnapshotId String No No The ID of the snapshot that is used to create the data disk. None

Tags syntax

"Tags": [
  {
    "Value": String,
    "Key": String
  }
]

Tags properties

Property Type Required Editable Description Constraint
Key String Yes No The key of the tag. The key must be 1 to 128 characters in length and cannot contain http:// or https://. It cannot start with acs: or aliyun.
Value String No No The value of the tag. The value must be 0 to 128 characters in length and cannot contain http:// or https://. It cannot start with acs: or aliyun.

Return values

Fn::GetAtt

  • InstanceId: the ID of the ECS instance. An ID is a globally unique identifier (GUID) generated by the system for an instance.
  • PrivateIp: the private IP address of the VPC-type instance.
  • InnerIp: the private IP address of the classic network-type instance.
  • PublicIp: the public IP address of the classic network-type instance.
  • ZoneId: the zone ID of the instance.
  • HostName: the hostname of the ECS instance.
  • PrimaryNetworkInterfaceId: the ID of the primary elastic network interface (ENI).
  • SecurityGroupIds: the IDs of security groups to which the created instance belongs.

Examples

JSON format

{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
    "DedicatedHostId": {
      "Type": "String",
      "Description": "which dedicated host will be deployed"
    },
    "PrivateIpAddress": {
      "Type": "String",
      "Description": "Private IP for the instance created. Only works for VPC instance and cannot duplicated with existing instance."
    },
    "Description": {
      "Type": "String",
      "Description": "Description of the instance, [2, 256] characters. Do not fill or empty, the default is empty."
    },
    "ResourceGroupId": {
      "Type": "String",
      "Description": "Resource group id."
    },
    "DiskMappings": {
      "Type": "Json",
      "Description": "Disk mappings to attach to instance. Max support 16 disks.\nIf the image contains a data disk, you can specify other parameters of the data disk via the same value of parameter \"Device\". If parameter \"Category\" is not specified, it will be cloud_efficiency instead of \"Category\" of data disk in the image.",
      "MaxLength": 16
    },
    "UserData": {
      "Type": "String",
      "Description": "User data to pass to instance. [1, 16KB] characters.User data should not be base64 encoded. If you want to pass base64 encoded string to the property, use function Fn::Base64Decode to decode the base64 string first."
    },
    "SystemDiskSize": {
      "Type": "Number",
      "Description": "Disk size of the system disk, range from 20 to 500 GB. If you specify with your own image, make sure the system disk size bigger than image size. ",
      "MinValue": 20
    },
    "SystemDiskDescription": {
      "Type": "String",
      "Description": "Description of created system disk."
    },
    "InstanceChargeType": {
      "Type": "String",
      "Description": "Instance Charge type, allowed value: Prepaid and Postpaid. If specified Prepaid, please ensure you have sufficient balance in your account. Or instance creation will be failure. Default value is Postpaid.",
      "AllowedValues": [
        "Subscription",
        "PrePaid",
        "PrePay",
        "Prepaid",
        "PayAsYouGo",
        "PostPaid",
        "PayOnDemand",
        "Postpaid"
      ],
      "Default": "PostPaid"
    },
    "AutoRenew": {
      "Type": "String",
      "Description": "Whether renew the fee automatically? When the parameter InstanceChargeType is PrePaid, it will take effect. Range of value:True: automatic renewal.False: no automatic renewal. Default value is False.",
      "AllowedValues": [
        "True",
        "False"
      ],
      "Default": "False"
    },
    "RamRoleName": {
      "Type": "String",
      "Description": "Instance RAM role name. The name is provided and maintained by Resource Access Management (RAM) and can be queried using ListRoles. For more information, see RAM API CreateRole and ListRoles."
    },
    "SystemDiskPerformanceLevel": {
      "Type": "String",
      "Description": "The performance level of the enhanced SSD used as the system disk.Default value: PL1. Valid values:PL0: A single enhanced SSD delivers up to 10,000 random read/write IOPS.PL1: A single enhanced SSD delivers up to 50,000 random read/write IOPS.PL2: A single enhanced SSD delivers up to 100,000 random read/write IOPS.PL3: A single enhanced SSD delivers up to 1,000,000 random read/write IOPS."
    },
    "ImageId": {
      "Type": "String",
      "Description": "Image ID to create ecs instance."
    },
    "SystemDiskDiskName": {
      "Type": "String",
      "Description": "Name of created system disk."
    },
    "SpotPriceLimit": {
      "Type": "String",
      "Description": "The hourly price threshold of a instance, and it takes effect only when parameter InstanceChargeType is PostPaid. Three decimals is allowed at most. "
    },
    "InstanceType": {
      "Type": "String",
      "Description": "Ecs instance supported instance type, make sure it should be correct."
    },
    "AllocatePublicIP": {
      "Type": "Boolean",
      "Description": "The public ip for ecs instance, if properties is true, will allocate public ip. If property InternetMaxBandwidthOut set to 0, it will not assign public ip.",
      "AllowedValues": [
        "True",
        "true",
        "False",
        "false"
      ],
      "Default": true
    },
    "Tags": {
      "Type": "Json",
      "Description": "Tags to attach to instance. Max support 20 tags to add during create instance. Each tag with two properties Key and Value, and Key is required.",
      "MaxLength": 20
    },
    "HostName": {
      "Type": "String",
      "Description": "Host name of created ecs instance. at least 2 characters, and '.' '-' Is not the first and last characters as hostname, not continuous use. Windows platform can be up to 15 characters, allowing letters (without limiting case), numbers and '-', and does not support the number of points, not all is digital ('.').Other (Linux, etc.) platform up to 30 characters, allowing support number multiple points for the period between the points, each permit letters (without limiting case), numbers and '-' components."
    },
    "SpotStrategy": {
      "Type": "String",
      "Description": "The spot strategy of a Pay-As-You-Go instance, and it takes effect only when parameter InstanceChargeType is PostPaid. Value range: \"NoSpot: A regular Pay-As-You-Go instance\", \"SpotWithPriceLimit: A price threshold for a spot instance, \"\"SpotAsPriceGo: A price that is based on the highest Pay-As-You-Go instance. \"Default value: NoSpot.",
      "AllowedValues": [
        "NoSpot",
        "SpotWithPriceLimit",
        "SpotAsPriceGo"
      ]
    },
    "PasswordInherit": {
      "Type": "Boolean",
      "Description": "Specifies whether to use the password preset in the image. To use the PasswordInherit parameter, the Password parameter must be empty and you must make sure that the selected image has a password configured.",
      "AllowedValues": [
        "True",
        "true",
        "False",
        "false"
      ]
    },
    "Password": {
      "Type": "String",
      "Description": "Password of created ecs instance. Must contain at least 3 types of special character, lower character, upper character, number."
    },
    "AutoRenewPeriod": {
      "Type": "Number",
      "Description": "The time period of auto renew. When the parameter InstanceChargeType is PrePaid, it will take effect. It could be 1, 2, 3, 6, 12. Default value is 1.",
      "AllowedValues": [
        1,
        2,
        3,
        6,
        12
      ],
      "Default": 1
    },
    "KeyPairName": {
      "Type": "String",
      "Description": "SSH key pair name."
    },
    "IoOptimized": {
      "Type": "String",
      "Description": "The 'optimized' instance can provide better IO performance. Support 'none' and 'optimized' only, default is 'optimized'.",
      "AllowedValues": [
        "none",
        "optimized"
      ],
      "Default": "optimized"
    },
    "ZoneId": {
      "Type": "String",
      "Description": "The ID of the zone to which the instance belongs. For more information, \ncall the DescribeZones operation to query the most recent zone list. \nDefault value is empty, which means random selection."
    },
    "HpcClusterId": {
      "Type": "String",
      "Description": "The HPC cluster ID to which the instance belongs."
    },
    "VSwitchId": {
      "Type": "String",
      "Description": "The vSwitch Id to create ecs instance."
    },
    "SecurityGroupId": {
      "Type": "String",
      "Description": "Security group to create ecs instance. For classic instance need the security group not belong to VPC, for VPC instance, please make sure the security group belong to specified VPC."
    },
    "Period": {
      "Type": "Number",
      "Description": "Prepaid time period. Unit is month, it could be from 1 to 9 or 12, 24, 36, 48, 60. Default value is 1.",
      "AllowedValues": [
        1,
        2,
        3,
        4,
        5,
        6,
        7,
        8,
        9,
        12,
        24,
        36,
        48,
        60
      ],
      "Default": 1
    },
    "DeletionProtection": {
      "Type": "Boolean",
      "Description": "Whether an instance can be released manually through the console or API, deletion protection only support postPaid instance",
      "AllowedValues": [
        "True",
        "true",
        "False",
        "false"
      ]
    },
    "SecurityGroupIds": {
      "Type": "Json",
      "Description": "The ID list of security group to which to assign the instance. The max length is based on the maximum number of security groups to which an instance can belong. For more information, see the \"Security group limits\" section in Limits.",
      "MinLength": 1,
      "MaxLength": 16
    },
    "InternetChargeType": {
      "Type": "String",
      "Description": "Instance internet access charge type.Support 'PayByBandwidth' and 'PayByTraffic' only. Default is PayByTraffic",
      "AllowedValues": [
        "paybytraffic",
        "PayByTraffic",
        "paybybandwidth",
        "PayByBandwidth"
      ],
      "Default": "PayByTraffic"
    },
    "SystemDiskCategory": {
      "Type": "String",
      "Description": "Category of system disk. Default is cloud_efficiency. support cloud|cloud_efficiency|cloud_ssd|cloud_essd|ephemeral_ssd",
      "AllowedValues": [
        "cloud",
        "cloud_efficiency",
        "cloud_ssd",
        "cloud_essd",
        "ephemeral_ssd"
      ],
      "Default": "cloud_efficiency"
    },
    "InstanceName": {
      "Type": "String",
      "Description": "Display name of the instance, [2, 128] English or Chinese characters, must start with a letter or Chinese in size, can contain numbers, '_' or '.', '-'"
    },
    "DeploymentSetId": {
      "Type": "String",
      "Description": "Deployment set ID."
    },
    "InternetMaxBandwidthOut": {
      "Type": "Number",
      "Description": "Set internet output bandwidth of instance. Unit is Mbps(Mega bit per second). Range is [0,200]. Default is 1.While the property is not 0, public ip will be assigned for instance.",
      "MinValue": 0,
      "MaxValue": 200,
      "Default": 1
    },
    "VpcId": {
      "Type": "String",
      "Description": "The VPC id to create ecs instance."
    },
    "SecurityEnhancementStrategy": {
      "Type": "String",
      "Description": "",
      "AllowedValues": [
        "Active",
        "Deactive"
      ]
    },
    "PeriodUnit": {
      "Type": "String",
      "Description": "Unit of prepaid time period, it could be Week/Month/Year. Default value is Month.",
      "AllowedValues": [
        "Week",
        "Month",
        "Year"
      ],
      "Default": "Month"
    }
  },
  "Resources": {
    "Instance": {
      "Type": "ALIYUN::ECS::Instance",
      "Properties": {
        "DedicatedHostId": {
          "Ref": "DedicatedHostId"
        },
        "PrivateIpAddress": {
          "Ref": "PrivateIpAddress"
        },
        "Description": {
          "Ref": "Description"
        },
        "ResourceGroupId": {
          "Ref": "ResourceGroupId"
        },
        "DiskMappings": {
          "Ref": "DiskMappings"
        },
        "UserData": {
          "Ref": "UserData"
        },
        "SystemDiskSize": {
          "Ref": "SystemDiskSize"
        },
        "SystemDiskDescription": {
          "Ref": "SystemDiskDescription"
        },
        "InstanceChargeType": {
          "Ref": "InstanceChargeType"
        },
        "AutoRenew": {
          "Ref": "AutoRenew"
        },
        "RamRoleName": {
          "Ref": "RamRoleName"
        },
        "SystemDiskPerformanceLevel": {
          "Ref": "SystemDiskPerformanceLevel"
        },
        "ImageId": {
          "Ref": "ImageId"
        },
        "SystemDiskDiskName": {
          "Ref": "SystemDiskDiskName"
        },
        "SpotPriceLimit": {
          "Ref": "SpotPriceLimit"
        },
        "InstanceType": {
          "Ref": "InstanceType"
        },
        "AllocatePublicIP": {
          "Ref": "AllocatePublicIP"
        },
        "Tags": {
          "Ref": "Tags"
        },
        "HostName": {
          "Ref": "HostName"
        },
        "SpotStrategy": {
          "Ref": "SpotStrategy"
        },
        "PasswordInherit": {
          "Ref": "PasswordInherit"
        },
        "Password": {
          "Ref": "Password"
        },
        "AutoRenewPeriod": {
          "Ref": "AutoRenewPeriod"
        },
        "KeyPairName": {
          "Ref": "KeyPairName"
        },
        "IoOptimized": {
          "Ref": "IoOptimized"
        },
        "ZoneId": {
          "Ref": "ZoneId"
        },
        "HpcClusterId": {
          "Ref": "HpcClusterId"
        },
        "VSwitchId": {
          "Ref": "VSwitchId"
        },
        "SecurityGroupId": {
          "Ref": "SecurityGroupId"
        },
        "Period": {
          "Ref": "Period"
        },
        "DeletionProtection": {
          "Ref": "DeletionProtection"
        },
        "SecurityGroupIds": {
          "Ref": "SecurityGroupIds"
        },
        "InternetChargeType": {
          "Ref": "InternetChargeType"
        },
        "SystemDiskCategory": {
          "Ref": "SystemDiskCategory"
        },
        "InstanceName": {
          "Ref": "InstanceName"
        },
        "DeploymentSetId": {
          "Ref": "DeploymentSetId"
        },
        "InternetMaxBandwidthOut": {
          "Ref": "InternetMaxBandwidthOut"
        },
        "VpcId": {
          "Ref": "VpcId"
        },
        "SecurityEnhancementStrategy": {
          "Ref": "SecurityEnhancementStrategy"
        },
        "PeriodUnit": {
          "Ref": "PeriodUnit"
        }
      }
    }
  },
  "Outputs": {
    "PrimaryNetworkInterfaceId": {
      "Description": "Primary network interface ID of created instance.",
      "Value": {
        "Fn::GetAtt": [
          "Instance",
          "PrimaryNetworkInterfaceId"
        ]
      }
    },
    "InnerIp": {
      "Description": "Inner IP address of the specified instance. Only for classical instance.",
      "Value": {
        "Fn::GetAtt": [
          "Instance",
          "InnerIp"
        ]
      }
    },
    "ZoneId": {
      "Description": "Zone ID of created instance.",
      "Value": {
        "Fn::GetAtt": [
          "Instance",
          "ZoneId"
        ]
      }
    },
    "PrivateIp": {
      "Description": "Private IP address of created ecs instance. Only for VPC instance.",
      "Value": {
        "Fn::GetAtt": [
          "Instance",
          "PrivateIp"
        ]
      }
    },
    "InstanceId": {
      "Description": "The instance ID of created ecs instance",
      "Value": {
        "Fn::GetAtt": [
          "Instance",
          "InstanceId"
        ]
      }
    },
    "PublicIp": {
      "Description": "Public IP address of created ecs instance.",
      "Value": {
        "Fn::GetAtt": [
          "Instance",
          "PublicIp"
        ]
      }
    },
    "SecurityGroupIds": {
      "Description": "Security group ID list of created instance.",
      "Value": {
        "Fn::GetAtt": [
          "Instance",
          "SecurityGroupIds"
        ]
      }
    },
    "HostName": {
      "Description": "Host name of created instance.",
      "Value": {
        "Fn::GetAtt": [
          "Instance",
          "HostName"
        ]
      }
    }
  }
}

YAML format

ROSTemplateFormatVersion: '2015-09-01'
Parameters:
  AllocatePublicIP:
    AllowedValues:
    - 'True'
    - 'true'
    - 'False'
    - 'false'
    Default: true
    Description: The public ip for ecs instance, if properties is true, will allocate
      public ip. If property InternetMaxBandwidthOut set to 0, it will not assign
      public ip.
    Type: Boolean
  AutoRenew:
    AllowedValues:
    - 'True'
    - 'False'
    Default: 'False'
    Description: 'Whether renew the fee automatically? When the parameter InstanceChargeType
      is PrePaid, it will take effect. Range of value:True: automatic renewal.False:
      no automatic renewal. Default value is False.'
    Type: String
  AutoRenewPeriod:
    AllowedValues:
    - 1
    - 2
    - 3
    - 6
    - 12
    Default: 1
    Description: The time period of auto renew. When the parameter InstanceChargeType
      is PrePaid, it will take effect. It could be 1, 2, 3, 6, 12. Default value is
      1.
    Type: Number
  DedicatedHostId:
    Description: which dedicated host will be deployed
    Type: String
  DeletionProtection:
    AllowedValues:
    - 'True'
    - 'true'
    - 'False'
    - 'false'
    Description: Whether an instance can be released manually through the console
      or API, deletion protection only support postPaid instance
    Type: Boolean
  DeploymentSetId:
    Description: Deployment set ID.
    Type: String
  Description:
    Description: Description of the instance, [2, 256] characters. Do not fill or
      empty, the default is empty.
    Type: String
  DiskMappings:
    Description: 'Disk mappings to attach to instance. Max support 16 disks.

      If the image contains a data disk, you can specify other parameters of the data
      disk via the same value of parameter "Device". If parameter "Category" is not
      specified, it will be cloud_efficiency instead of "Category" of data disk in
      the image.'
    MaxLength: 16
    Type: Json
  HostName:
    Description: Host name of created ecs instance. at least 2 characters, and '.'
      '-' Is not the first and last characters as hostname, not continuous use. Windows
      platform can be up to 15 characters, allowing letters (without limiting case),
      numbers and '-', and does not support the number of points, not all is digital
      ('.').Other (Linux, etc.) platform up to 30 characters, allowing support number
      multiple points for the period between the points, each permit letters (without
      limiting case), numbers and '-' components.
    Type: String
  HpcClusterId:
    Description: The HPC cluster ID to which the instance belongs.
    Type: String
  ImageId:
    Description: Image ID to create ecs instance.
    Type: String
  InstanceChargeType:
    AllowedValues:
    - Subscription
    - PrePaid
    - PrePay
    - Prepaid
    - PayAsYouGo
    - PostPaid
    - PayOnDemand
    - Postpaid
    Default: PostPaid
    Description: 'Instance Charge type, allowed value: Prepaid and Postpaid. If specified
      Prepaid, please ensure you have sufficient balance in your account. Or instance
      creation will be failure. Default value is Postpaid.'
    Type: String
  InstanceName:
    Description: Display name of the instance, [2, 128] English or Chinese characters,
      must start with a letter or Chinese in size, can contain numbers, '_' or '.',
      '-'
    Type: String
  InstanceType:
    Description: Ecs instance supported instance type, make sure it should be correct.
    Type: String
  InternetChargeType:
    AllowedValues:
    - paybytraffic
    - PayByTraffic
    - paybybandwidth
    - PayByBandwidth
    Default: PayByTraffic
    Description: Instance internet access charge type.Support 'PayByBandwidth' and
      'PayByTraffic' only. Default is PayByTraffic
    Type: String
  InternetMaxBandwidthOut:
    Default: 1
    Description: Set internet output bandwidth of instance. Unit is Mbps(Mega bit
      per second). Range is [0,200]. Default is 1.While the property is not 0, public
      ip will be assigned for instance.
    MaxValue: 200
    MinValue: 0
    Type: Number
  IoOptimized:
    AllowedValues:
    - none
    - optimized
    Default: optimized
    Description: The 'optimized' instance can provide better IO performance. Support
      'none' and 'optimized' only, default is 'optimized'.
    Type: String
  KeyPairName:
    Description: SSH key pair name.
    Type: String
  Password:
    Description: Password of created ecs instance. Must contain at least 3 types of
      special character, lower character, upper character, number.
    Type: String
  PasswordInherit:
    AllowedValues:
    - 'True'
    - 'true'
    - 'False'
    - 'false'
    Description: Specifies whether to use the password preset in the image. To use
      the PasswordInherit parameter, the Password parameter must be empty and you
      must make sure that the selected image has a password configured.
    Type: Boolean
  Period:
    AllowedValues:
    - 1
    - 2
    - 3
    - 4
    - 5
    - 6
    - 7
    - 8
    - 9
    - 12
    - 24
    - 36
    - 48
    - 60
    Default: 1
    Description: Prepaid time period. Unit is month, it could be from 1 to 9 or 12,
      24, 36, 48, 60. Default value is 1.
    Type: Number
  PeriodUnit:
    AllowedValues:
    - Week
    - Month
    - Year
    Default: Month
    Description: Unit of prepaid time period, it could be Week/Month/Year. Default
      value is Month.
    Type: String
  PrivateIpAddress:
    Description: Private IP for the instance created. Only works for VPC instance
      and cannot duplicated with existing instance.
    Type: String
  RamRoleName:
    Description: Instance RAM role name. The name is provided and maintained by Resource
      Access Management (RAM) and can be queried using ListRoles. For more information,
      see RAM API CreateRole and ListRoles.
    Type: String
  ResourceGroupId:
    Description: Resource group id.
    Type: String
  SecurityEnhancementStrategy:
    AllowedValues:
    - Active
    - Deactive
    Description: ''
    Type: String
  SecurityGroupId:
    Description: Security group to create ecs instance. For classic instance need
      the security group not belong to VPC, for VPC instance, please make sure the
      security group belong to specified VPC.
    Type: String
  SecurityGroupIds:
    Description: The ID list of security group to which to assign the instance. The
      max length is based on the maximum number of security groups to which an instance
      can belong. For more information, see the "Security group limits" section in
      Limits.
    MaxLength: 16
    MinLength: 1
    Type: Json
  SpotPriceLimit:
    Description: 'The hourly price threshold of a instance, and it takes effect only
      when parameter InstanceChargeType is PostPaid. Three decimals is allowed at
      most. '
    Type: String
  SpotStrategy:
    AllowedValues:
    - NoSpot
    - SpotWithPriceLimit
    - SpotAsPriceGo
    Description: 'The spot strategy of a Pay-As-You-Go instance, and it takes effect
      only when parameter InstanceChargeType is PostPaid. Value range: "NoSpot: A
      regular Pay-As-You-Go instance", "SpotWithPriceLimit: A price threshold for
      a spot instance, ""SpotAsPriceGo: A price that is based on the highest Pay-As-You-Go
      instance. "Default value: NoSpot.'
    Type: String
  SystemDiskCategory:
    AllowedValues:
    - cloud
    - cloud_efficiency
    - cloud_ssd
    - cloud_essd
    - ephemeral_ssd
    Default: cloud_efficiency
    Description: Category of system disk. Default is cloud_efficiency. support cloud|cloud_efficiency|cloud_ssd|cloud_essd|ephemeral_ssd
    Type: String
  SystemDiskDescription:
    Description: Description of created system disk.
    Type: String
  SystemDiskDiskName:
    Description: Name of created system disk.
    Type: String
  SystemDiskPerformanceLevel:
    Description: 'The performance level of the enhanced SSD used as the system disk.Default
      value: PL1. Valid values:PL0: A single enhanced SSD delivers up to 10,000 random
      read/write IOPS.PL1: A single enhanced SSD delivers up to 50,000 random read/write
      IOPS.PL2: A single enhanced SSD delivers up to 100,000 random read/write IOPS.PL3:
      A single enhanced SSD delivers up to 1,000,000 random read/write IOPS.'
    Type: String
  SystemDiskSize:
    Description: 'Disk size of the system disk, range from 20 to 500 GB. If you specify
      with your own image, make sure the system disk size bigger than image size. '
    MinValue: 20
    Type: Number
  Tags:
    Description: Tags to attach to instance. Max support 20 tags to add during create
      instance. Each tag with two properties Key and Value, and Key is required.
    MaxLength: 20
    Type: Json
  UserData:
    Description: User data to pass to instance. [1, 16KB] characters.User data should
      not be base64 encoded. If you want to pass base64 encoded string to the property,
      use function Fn::Base64Decode to decode the base64 string first.
    Type: String
  VSwitchId:
    Description: The vSwitch Id to create ecs instance.
    Type: String
  VpcId:
    Description: The VPC id to create ecs instance.
    Type: String
  ZoneId:
    Description: "The ID of the zone to which the instance belongs. For more information,\
      \ \ncall the DescribeZones operation to query the most recent zone list. \n\
      Default value is empty, which means random selection."
    Type: String
Resources:
  Instance:
    Properties:
      AllocatePublicIP:
        Ref: AllocatePublicIP
      AutoRenew:
        Ref: AutoRenew
      AutoRenewPeriod:
        Ref: AutoRenewPeriod
      DedicatedHostId:
        Ref: DedicatedHostId
      DeletionProtection:
        Ref: DeletionProtection
      DeploymentSetId:
        Ref: DeploymentSetId
      Description:
        Ref: Description
      DiskMappings:
        Ref: DiskMappings
      HostName:
        Ref: HostName
      HpcClusterId:
        Ref: HpcClusterId
      ImageId:
        Ref: ImageId
      InstanceChargeType:
        Ref: InstanceChargeType
      InstanceName:
        Ref: InstanceName
      InstanceType:
        Ref: InstanceType
      InternetChargeType:
        Ref: InternetChargeType
      InternetMaxBandwidthOut:
        Ref: InternetMaxBandwidthOut
      IoOptimized:
        Ref: IoOptimized
      KeyPairName:
        Ref: KeyPairName
      Password:
        Ref: Password
      PasswordInherit:
        Ref: PasswordInherit
      Period:
        Ref: Period
      PeriodUnit:
        Ref: PeriodUnit
      PrivateIpAddress:
        Ref: PrivateIpAddress
      RamRoleName:
        Ref: RamRoleName
      ResourceGroupId:
        Ref: ResourceGroupId
      SecurityEnhancementStrategy:
        Ref: SecurityEnhancementStrategy
      SecurityGroupId:
        Ref: SecurityGroupId
      SecurityGroupIds:
        Ref: SecurityGroupIds
      SpotPriceLimit:
        Ref: SpotPriceLimit
      SpotStrategy:
        Ref: SpotStrategy
      SystemDiskCategory:
        Ref: SystemDiskCategory
      SystemDiskDescription:
        Ref: SystemDiskDescription
      SystemDiskDiskName:
        Ref: SystemDiskDiskName
      SystemDiskPerformanceLevel:
        Ref: SystemDiskPerformanceLevel
      SystemDiskSize:
        Ref: SystemDiskSize
      Tags:
        Ref: Tags
      UserData:
        Ref: UserData
      VSwitchId:
        Ref: VSwitchId
      VpcId:
        Ref: VpcId
      ZoneId:
        Ref: ZoneId
    Type: ALIYUN::ECS::Instance
Outputs:
  HostName:
    Description: Host name of created instance.
    Value:
      Fn::GetAtt:
      - Instance
      - HostName
  InnerIp:
    Description: Inner IP address of the specified instance. Only for classical instance.
    Value:
      Fn::GetAtt:
      - Instance
      - InnerIp
  InstanceId:
    Description: The instance ID of created ecs instance
    Value:
      Fn::GetAtt:
      - Instance
      - InstanceId
  PrimaryNetworkInterfaceId:
    Description: Primary network interface ID of created instance.
    Value:
      Fn::GetAtt:
      - Instance
      - PrimaryNetworkInterfaceId
  PrivateIp:
    Description: Private IP address of created ecs instance. Only for VPC instance.
    Value:
      Fn::GetAtt:
      - Instance
      - PrivateIp
  PublicIp:
    Description: Public IP address of created ecs instance.
    Value:
      Fn::GetAtt:
      - Instance
      - PublicIp
  SecurityGroupIds:
    Description: Security group ID list of created instance.
    Value:
      Fn::GetAtt:
      - Instance
      - SecurityGroupIds
  ZoneId:
    Description: Zone ID of created instance.
    Value:
      Fn::GetAtt:
      - Instance
      - ZoneId

To view more examples, visit Instance.json and Instance.yml. In the examples, the ALIYUN::ECS::Instance, ALIYUN::ECS::SSHKeyPair, and ALIYUN::ECS::SSHKeyPairAttachment resource types are used.