ALIYUN::ECS::PrepayInstance is used to create a subscription ECS instance.

Syntax

{
  "Type": "ALIYUN::ECS::Instance",
  "Properties": {
    "DedicatedHostId": String,
    "AutoRenew": String,
    "RamRoleName": String,
    "IoOptimized": String,
    "InternetChargeType": String,
    "PrivateIpAddress": String,
    "KeyPairName": String,
    "SystemDiskDiskName": String,
    "PeriodUnit": String,
    "Description": String,
    "Tags": List,
    "SpotPriceLimit": String,
    "HostName": String,
    "AutoRenewPeriod": Number,
    "ImageId": String,
    "ResourceGroupId": String,
    "InstanceChargeType": String,
    "VSwitchId": String,
    "Password": String,
    "InstanceType": String,
    "SystemDiskCategory": String,
    "DeletionProtection": Boolean,
    "SystemDiskSize": Number,
    "ZoneId": String,
    "InternetMaxBandwidthOut": Integer,
    "VpcId": String,
    "SpotStrategy": String,
    "InstanceName": String,
    "InternetMaxBandwidthIn": Integer,
    "UserData": String,
    "DeploymentSetId": String,
    "SecurityGroupId": String,
    "Period": Number,
    "HpcClusterId": String,
    "AllocatePublicIP": Boolean,
    "SystemDiskDescription": String,
    "DiskMappings": List,
    "SystemDiskPerformanceLevel": String
  }
}

Properties

Property Type Required Editable Description Constraint
HpcClusterId String No No The ID of the E-HPC cluster to which the ECS instance belongs. None
PeriodType String Yes No The type of billing cycle for the created ECS instance. Valid values:
  • Monthly
  • Yearly
DedicatedHostId String No No The ID of the dedicated host for the ECS instance. None
RamRoleName String No No The RAM role name of the ECS instance. You can call the ListRoles operation to query the role name. For more information, see CreateRole and ListRoles. None
IoOptimized Boolean No No

Specifies whether the instance is I/O optimized.

For phased-out instance types, the default value is none.

For other instance types, the default value is optimized.

Valid values:
  • none: The instance is not I/O optimized.
  • optimized: The instance is I/O optimized.
InternetChargeType String No No The billing method for network usage. Default value: PayByBandwidth. Valid values:
  • PayByBandwidth
  • PayByTraffic
PrivateIpAddress String No No The private IP address of the ECS instance. The private IP address must be selected from the CIDR block of the VSwitch specified by VSwitchId. None
KeyPairName String No No The name of the SSH key pair.
  • For Windows instances, this parameter is ignored and is empty by default. The Password parameter takes effect even if this parameter is specified.
  • For Linux instances, if this parameter is specified, logon by password is disabled, and the value of this parameter is used.
None
SystemDiskDiskName String No No The name of the system disk. None
PeriodUnit String No No The unit of billing cycle for the ECS instance.

When the PeriodUnit parameter is set to Week:

  • Valid values for the Period parameter are 1, 2, 3, and 4.
  • Valid values for the AutoRenewPeriod parameter are 1, 2, and 3.
When the PeriodUnit parameter is set to Month:
  • Valid values for the Period parameter are 1, 2, 3, 4, 5, 6, 7, 8, 9, 12, 24, 36, 48, and 60.
  • Valid values for the AutoRenewPeriod parameter are 1, 2, 3, 6, and 12.
Default value: Month.
Valid values:
  • Week
  • Month
Description String No Yes

The description of the ECS instance.

  • The description must be 2 to 256 characters in length.
  • The description cannot start with http:// or https://.
Tags List No No The custom tags of the ECS instance. A maximum of 20 tags can be specified.
MinAmount Integer Yes No The minimum number of ECS instances that can be created. Valid values: 1 to 100.

Default value: 1.

HostName String No No The hostname of the ECS instance.
  • The hostname cannot start or end with a period (.) or hyphen (-). It cannot contain consecutive periods (.) or hyphens (-).
  • For Windows instances, the hostname must be 2 to 15 characters in length and can contain letters, digits, and hyphens (-). It cannot contain periods (.) or contain only digits.
  • For other instance types such as Linux instances, the hostname must be 2 to 64 characters in length and can contain letters, digits, hyphens (-), and periods (.). You can use periods (.) to separate a name into multiple segments.
AutoRenewPeriod Number No No The auto-renewal period for the instance. This parameter is required when the AutoRenew parameter is set to True. Valid values: 1, 2, 3, 6, and 12.
ImageId String Yes Yes

The ID of the image file that is used to create the instance.

You can call the DescribeImages operation to query the available image resources.

For Alibaba Cloud Marketplace images, you can view the image ID of a specific image on its Product Details page at Alibaba Cloud Marketplace.

None
AutoRenew Boolean No No Specifies whether to enable auto-renewal for the ECS instance. This parameter takes effect only when the InstanceChargeType parameter is set to PrePaid. Default value: False. Valid values:
  • True: enables auto-renewal for the instance.
  • False: disables auto-renewal for the instance.
None
InstanceChargeType String No No The billing method of the ECS instance. Default value: PostPaid. Valid values:
  • PrePaid: the subscription billing method, in which services are billed on a monthly or yearly basis. If you set this parameter to PrePaid, make sure that you have sufficient balance in your account. Otherwise, an InvalidPayMethod error is returned.
  • PostPaid: the pay-as-you-go billing method.
VSwitchId String No No The ID of the VSwitch. This parameter is required when you create an ECS instance in a VPC. None
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 and must contain uppercase letters, lowercase letters, digits, and special characters.
  • Special characters include ( ) ~ ! @ # $ % ^ & * - _ + = | { } [ ] : ; ' < > , . ? /
  • Passwords of Windows instances cannot start with a forward slash (/).
InstanceType String Yes No The instance type of the ECS instance. For more information, see Instance families. You can call the DescribeInstanceTypes operation to query the most recent instance type list. None
MaxAmount Integer Yes No The maximum number of instances that can be created. Valid values: 1 to 100.
SystemDiskCategory String No No

The type of the system disk.

For phased-out instance types that are not I/O optimized, the default value is cloud.

For other instance types, the default value is cloud_efficiency.

Valid values:
  • cloud: basic disk
  • cloud_efficiency: ultra disk
  • cloud_ssd: standard SSD
  • ephemeral_ssd: local SSD
SystemDiskSize Number No Yes The size of the system disk. Unit: GiB. Valid values: 20 to 500.

The value of this parameter must be at least 20 and greater than or equal to the size of the image.

The default value is 40 GiB or the size of the image, depending on whichever is greater.

ZoneId String No No The ID of the zone to which the ECS instance belongs. For more information, see DescribeZones. You can call this operation to obtain the available zones.

If you do not specify this parameter, the system selects a zone. This parameter is empty by default.

None
InternetMaxBandwidthOut Integer No No The maximum bandwidth of the outbound traffic to the Internet. Unit: Mbit/s.
  • Valid values for the PayByBandwidth mode: 0 to 200. Default value: 0.
  • Valid values for the PayByTraffic mode: 1 to 200. This parameter is required if the InternetChargeType parameter is set to PayByTraffic.
VpcId String No No The ID of the VPC. None
InstanceName String No No The name of the ECS instance.
  • The name can be up to 128 characters in length.
  • It can contain letters, digits, underscores (_), periods (.), and hyphens (-).
InternetMaxBandwidthIn Integer No No The maximum bandwidth of the inbound traffic from the Internet. Unit: Mbit/s. Default value: 200. Valid values: 1 to 200.
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 (\) immediately before each special character.
SecurityGroupId String No No The ID of the security group to which the ECS instance belongs. Instances within the same security group can access each other. None
Period Number Yes No The billing cycle for the ECS instance. Unit: months. This parameter takes effect and is required only when the InstanceChargeType parameter is set to PrePaid. If the DedicatedHostId parameter is specified, the billing cycle for the instances must be no longer than that of the dedicated host. Valid values:
  • When the PeriodUnit parameter is set to Week, the valid values for Period are 1, 2, 3, and 4.
  • When the PeriodUnit parameter is set to Month, the valid values for Period are 1, 2, 3, 4, 5, 6, 7, 8, 9, 12, 24, 36, 48, and 60.
AllocatePublicIP Boolean No No Specifies whether to allocate a public IP address to the ECS instance. If the InternetMaxBandwidthOut parameter is set to 0, no public IP addresses are allocated.

Default value: True.

SystemDiskDescription String No No The description of the system disk. None
DiskMappings List No No The data disks to be attached to the ECS instance. A maximum of 16 data disks can be attached.
DeploymentSetId String No No The ID of the deployment set. None
SystemDiskPerformanceLevel String No No The performance level of the enhanced SSD (ESSD) that is used as the system disk. Default value: PL1. Valid values:
  • PL1: A single ESSD delivers up to 50,000 random read/write IOPS.
  • PL2: A single ESSD delivers up to 100,000 random read/write IOPS.
  • PL3: A single ESSD delivers up to 1,000,000 random read/write IOPS.

For more information about performance levels of ESSDs, see Enhanced SSDs.

Tags syntax

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

Tags properties

Property Type Required Editable Description Constraint
Key String Yes No None None
Value String No No None None

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
Category String No No The type of the data disk.

Valid values: cloud, cloud_efficiency, cloud_ssd, and ephemeral_ssd.

Default value: cloud_efficiency.

DiskName String No No The name of the data disk. The name can be up to 128 characters in length and can contain letters, digits, underscores (_), periods (.), and hyphens (-).
Description String No No The description of the data disk. Valid values: 2 to 256.

This parameter is empty by default.

Device String No No The device name of the data disk. If you do not specify this parameter, the system allocates a device name in alphabetical order from /dev/xvdb to /dev/xvdz.
SnapshotId String No No The ID of the snapshot that is used to create 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 delivers up to 50,000 random read/write IOPS.
  • PL2: A single ESSD delivers up to 100,000 random read/write IOPS.
  • PL3: A single ESSD delivers up to 1,000,000 random read/write IOPS.

For more information about performance levels of ESSDs, see Enhanced SSDs.

Size String Yes No The size of the data disk. Unit: GB. None

Response parameters

Fn::GetAtt

  • OrderId: the ID of the order.
  • InnerIps: the internal IP addresses of the instances in the classic network. This parameter takes effect only when the NetworkType parameter is set to Classic.
  • PrivateIps: the private IP addresses of the instances in a VPC. This parameter takes effect only when the NetworkType parameter is set to VPC.
  • ZoneIds: the IDs of the zones.
  • PublicIps: the public IP addresses of the instances in the classic network. This parameter takes effect only when the NetworkType parameter is set to Classic.
  • HostNames: the list of hostnames.
  • RelatedOrderIds: the list of related order IDs.
  • InstanceIds: the IDs of instances in the ECS instance group. The instance ID is a globally unique identifier (GUID) generated by the system for the instance.

Examples

{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
    "PeriodType": {
      "Type": "String",
      "Description": "Charge period for created instances.",
      "AllowedValues": [
        "Monthly",
        "Yearly"
      ]
    },
    "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."
    },
    "DiskMappings": {
      "Type": "CommaDelimitedList",
      "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
    },
    "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,
      "MaxValue": 500
    },
    "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."
    },
    "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": [
        "PrePaid",
        "PostPaid"
      ],
      "Default": "PostPaid"
    },
    "AutoRenew": {
      "Type": "Boolean",
      "Description": "Auto renew the prepay instance. If the period type is by year, it will renew by year, else it will renew by month.",
      "AllowedValues": [
        "True",
        "true",
        "False",
        "false"
      ],
      "Default": false
    },
    "MaxAmount": {
      "Type": "Number",
      "Description": "Max number of instances to create, should be smaller than 'MaxAmount' and smaller than 100.",
      "MinValue": 1,
      "MaxValue": 100
    },
    "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."
    },
    "MinAmount": {
      "Type": "Number",
      "Description": "Max number of instances to create, should be bigger than 'MinAmount' and smaller than 100.",
      "MinValue": 1,
      "MaxValue": 100,
      "Default": 1
    },
    "ImageId": {
      "Type": "String",
      "Description": "Image ID to create ecs instance."
    },
    "SystemDiskDiskName": {
      "Type": "String",
      "Description": "Name of created system disk."
    },
    "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": "CommaDelimitedList",
      "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."
    },
    "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": "Boolean",
      "Description": "The 'optimized' instance can provide better IO performance. Support true or false, Default is true. ",
      "AllowedValues": [
        "True",
        "true",
        "False",
        "false"
      ],
      "Default": true
    },
    "ZoneId": {
      "Type": "String",
      "Description": "current zone to create the instance."
    },
    "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. While choose by pay by month, it could be from 1 to 9. While choose pay by year, it could be from 1 to 3.",
      "MinValue": 1,
      "MaxValue": 9,
      "Default": 1
    },
    "InternetChargeType": {
      "Type": "String",
      "Description": "Instance internet access charge type.Support 'PayByBandwidth' and 'PayByTraffic' only. For AfterPay instance, default is 'PayByBandwidth'.",
      "AllowedValues": [
        "PayByBandwidth",
        "PayByTraffic"
      ],
      "Default": "PayByBandwidth"
    },
    "SystemDiskCategory": {
      "Type": "String",
      "Description": "Category of system disk. Default is cloud_efficiency. support cloud|cloud_efficiency|cloud_ssd|ephemeral_ssd",
      "AllowedValues": [
        "cloud",
        "cloud_efficiency",
        "cloud_ssd",
        "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 '.', '-'"
    },
    "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."
    },
    "InternetMaxBandwidthIn": {
      "Type": "Number",
      "Description": "Max internet out band width setting, unit in Mbps(Mega bit per second). The range is [1,200], default is 200 Mbps.",
      "MinValue": 1,
      "MaxValue": 200,
      "Default": 200
    },
    "PeriodUnit": {
      "Type": "String",
      "Description": "Unit of prepaid time period, it could be Week/Month. Default value is Month.",
      "AllowedValues": [
        "Week",
        "Month"
      ],
      "Default": "Month"
    }
  },
  "Resources": {
    "PrepayInstance": {
      "Type": "ALIYUN::ECS::PrepayInstance",
      "Properties": {
        "PeriodType": {
          "Ref": "PeriodType"
        },
        "DedicatedHostId": {
          "Ref": "DedicatedHostId"
        },
        "PrivateIpAddress": {
          "Ref": "PrivateIpAddress"
        },
        "Description": {
          "Ref": "Description"
        },
        "DiskMappings": {
          "Fn::Split": [
            ",",
            {
              "Ref": "DiskMappings"
            },
            {
              "Ref": "DiskMappings"
            }
          ]
        },
        "SystemDiskSize": {
          "Ref": "SystemDiskSize"
        },
        "UserData": {
          "Ref": "UserData"
        },
        "SystemDiskDescription": {
          "Ref": "SystemDiskDescription"
        },
        "InstanceChargeType": {
          "Ref": "InstanceChargeType"
        },
        "AutoRenew": {
          "Ref": "AutoRenew"
        },
        "MaxAmount": {
          "Ref": "MaxAmount"
        },
        "RamRoleName": {
          "Ref": "RamRoleName"
        },
        "MinAmount": {
          "Ref": "MinAmount"
        },
        "ImageId": {
          "Ref": "ImageId"
        },
        "SystemDiskDiskName": {
          "Ref": "SystemDiskDiskName"
        },
        "InstanceType": {
          "Ref": "InstanceType"
        },
        "AllocatePublicIP": {
          "Ref": "AllocatePublicIP"
        },
        "Tags": {
          "Fn::Split": [
            ",",
            {
              "Ref": "Tags"
            },
            {
              "Ref": "Tags"
            }
          ]
        },
        "HostName": {
          "Ref": "HostName"
        },
        "Password": {
          "Ref": "Password"
        },
        "AutoRenewPeriod": {
          "Ref": "AutoRenewPeriod"
        },
        "KeyPairName": {
          "Ref": "KeyPairName"
        },
        "IoOptimized": {
          "Ref": "IoOptimized"
        },
        "ZoneId": {
          "Ref": "ZoneId"
        },
        "VSwitchId": {
          "Ref": "VSwitchId"
        },
        "SecurityGroupId": {
          "Ref": "SecurityGroupId"
        },
        "Period": {
          "Ref": "Period"
        },
        "InternetChargeType": {
          "Ref": "InternetChargeType"
        },
        "SystemDiskCategory": {
          "Ref": "SystemDiskCategory"
        },
        "InstanceName": {
          "Ref": "InstanceName"
        },
        "InternetMaxBandwidthOut": {
          "Ref": "InternetMaxBandwidthOut"
        },
        "VpcId": {
          "Ref": "VpcId"
        },
        "InternetMaxBandwidthIn": {
          "Ref": "InternetMaxBandwidthIn"
        },
        "PeriodUnit": {
          "Ref": "PeriodUnit"
        }
      }
    }
  },
  "Outputs": {
    "PublicIps": {
      "Description": "Public IP address list of created ecs instance.",
      "Value": {
        "Fn::GetAtt": [
          "PrepayInstance",
          "PublicIps"
        ]
      }
    },
    "RelatedOrderIds": {
      "Description": "The related order id list of created ecs instances",
      "Value": {
        "Fn::GetAtt": [
          "PrepayInstance",
          "RelatedOrderIds"
        ]
      }
    },
    "PrivateIps": {
      "Description": "Private IP address list of created ecs instance. Only for VPC instance.",
      "Value": {
        "Fn::GetAtt": [
          "PrepayInstance",
          "PrivateIps"
        ]
      }
    },
    "HostNames": {
      "Description": "Host names of created instance.",
      "Value": {
        "Fn::GetAtt": [
          "PrepayInstance",
          "HostNames"
        ]
      }
    },
    "InnerIps": {
      "Description": "Inner IP address list of the specified instance. Only for classical instance.",
      "Value": {
        "Fn::GetAtt": [
          "PrepayInstance",
          "InnerIps"
        ]
      }
    },
    "ZoneIds": {
      "Description": "Zone id of created instance.",
      "Value": {
        "Fn::GetAtt": [
          "PrepayInstance",
          "ZoneIds"
        ]
      }
    },
    "OrderId": {
      "Description": "The order id list of created instance.",
      "Value": {
        "Fn::GetAtt": [
          "PrepayInstance",
          "OrderId"
        ]
      }
    },
    "InstanceIds": {
      "Description": "The instance id list of created ecs instance",
      "Value": {
        "Fn::GetAtt": [
          "PrepayInstance",
          "InstanceIds"
        ]
      }
    }
  }
}