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

Syntax

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

Properties

Name Type Required Editable Description Validity
HpcClusterId String No No The ID of the E-HPC cluster to which the instance belongs. None
PeriodType String Yes No The type of billing cycle for the instance. Valid values: Monthly and 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 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 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 key pair.
  • For Windows-based instances, this parameter is ignored. This parameter is empty by default. For Linux-based instances, the Password parameter still takes effect if this parameter is specified.
  • However, logon by password is disabled, and the KeyPairName value 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 instance.

When the PeriodUnit parameter is set to Week:

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

The description of the instance.

The description must be 2 to 256 characters in length. This parameter is empty by default.

None
Tags List No No The custom tags of the instance. A maximum of 20 tags can be specified.
MinAmount Integer Yes No

The minimum number of instances that can be created.

Default value: 1.

Valid values: 1 to 100.
HostName String No No The hostname of the instance.
  • The hostname cannot start or end with a period (.) or hyphen (-). It cannot contain consecutive periods (.) or hyphens (-).
  • For Windows-based 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-based 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.
None
AutoRenewPeriod Number No No The automatic 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 used to create the instance.

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

For 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 automatic renewal for the instance. This parameter takes effect only when the InstanceChargeType parameter is set to PrePaid. Valid values:
  • True: enables automatic renewal for the instance.
  • False: disables automatic renewal for the instance.
Default value: false.
None
InstanceChargeType String No No The billing method of the instance. Valid values:
  • PrePaid: specifies 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: specifies the pay-as-you-go billing method, in which services are billed by the amount of resources that you actually use.
VSwitchId String No No The ID of the VSwitch. This parameter is required when you create an instance in a VPC. None
Password String No Yes The password used to log on to the 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 ( ) ` ~ ! @ # $ % ^ & * - _ + = | { } [ ] : ; ' < > , . ? /

The password of a Windows-based instance cannot start with a forward slash (/).

None
InstanceType String Yes No The type of the instance. For more information, see Instance families. You can also 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.

The value of this parameter must be at least 20 GiB 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.

Valid values: 20 to 500.
ZoneId String No No The ID of the zone to which the 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 automatically 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. If you choose to use the PayByTraffic mode, you must specify this parameter.

VpcId String No No The ID of the VPC. None
InstanceName String No No The name of the instance. The name can be up to 128 characters in length and 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 use Base64 for transcoding. You must use the backslash (\) to escape special characters.
SecurityGroupId String No No The ID of the security group to which the instance belongs. Instances in the same security group can access each other. None
Period Number Yes No The billing cycle for the 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 shorter than that of the dedicated host. Valid values:
  • Valid values for the Period parameter in the case of PeriodUnit=Week: 1, 2, 3, and 4.
  • Valid values for the Period parameter in the case of PeriodUnit=Month: 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 instance. If the InternetMaxBandwidthOut parameter is set to 0, no public IP addresses will be allocated. Default value: True. None
SystemDiskDescription String No No The description of the system disk. None
DiskMappings List No No The data disks to be attached to the instance. A maximum of 16 data disks can be attached.
DeploymentSetId String No No The ID of the deployment set. None

Tags syntax

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

Tags properties

Name Type Required Editable Description Validity
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,
    "Size": String
  }
]

DiskMappings properties

Name Type Required Editable Description Validity
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. The description must be 2 to 256 characters in length. 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 automatically allocates a device name in alphabetical order from /dev/xvdb to /dev/xvdz.
SnapshotId String No No The ID of the snapshot used to create the data disk. None
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 private IP addresses of instances in a classic network. This parameter takes effect only when the NetworkType parameter is set to Classic.
  • PrivateIps: the private IP addresses of instances in a VPC. This parameter takes effect only when the NetworkType parameter is set to VPC.
  • ZoneIds: the IDs of zones.
  • PublicIps: the public IP addresses of instances in a 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"
        ]
      }
    }
  }
}