ALIYUN::ECS::InstanceGroup
The ALIYUN::ECS::InstanceGroup type creates a group of ECS instances with the same configuration.
Syntax
{
"Type": "ALIYUN::ECS::InstanceGroup",
"Properties": {
"DedicatedHostId": String,
"ResourceGroupId": String,
"SystemDiskDescription": String,
"InstanceChargeType": String,
"RamRoleName": String,
"SystemDiskPerformanceLevel": String,
"ImageId": String,
"SystemDiskDiskName": String,
"Tags": List,
"HostName": String,
"LaunchTemplateName": String,
"VSwitchId": String,
"Period": Number,
"ZoneIds": List,
"LaunchTemplateId": String,
"DeletionProtection": Boolean,
"SecurityGroupIds": List,
"SecurityEnhancementStrategy": String,
"InternetChargeType": String,
"InstanceName": String,
"DeploymentSetId": String,
"SubscriptionDeletionForce": Boolean,
"InternetMaxBandwidthOut": Integer,
"VpcId": String,
"LaunchTemplateVersion": String,
"PeriodUnit": String,
"AutoReleaseTime": String,
"PrivateIpAddress": String,
"Description": String,
"DiskMappings": List,
"SystemDiskSize": Number,
"UserData": String,
"AutoRenew": String,
"Ipv6Addresses": List,
"MaxAmount": Integer,
"SystemDiskAutoSnapshotPolicyId": String,
"Ipv6AddressCount": Integer,
"NetworkType": String,
"SpotPriceLimit": String,
"InstanceType": String,
"AllocatePublicIP": Boolean,
"SpotStrategy": String,
"Password": String,
"PasswordInherit": Boolean,
"AutoRenewPeriod": Number,
"KeyPairName": String,
"IoOptimized": String,
"ZoneId": String,
"HpcClusterId": String,
"SecurityGroupId": String,
"SystemDiskCategory": String,
"EniMappings": List,
"SystemDiskProvisionedIops": Integer,
"SystemDiskBurstingEnabled": Boolean,
"SpotInterruptionBehavior": String,
"SpotDuration": Integer,
"UpdatePolicy": String,
"SystemDiskEncrypted": String,
"SystemDiskEncryptAlgorithm": String,
"SystemDiskStorageClusterId": String,
"SystemDiskKMSKeyId": String,
"CreditSpecification": String,
"PrivatePoolOptions": Map,
"StorageSetId": String,
"HttpTokens": String,
"HttpEndpoint": String,
"Tenancy": String,
"StorageSetPartitionNumber": Integer,
"DeploymentSetGroupNo": Integer,
"Affinity": String,
"UseAdditionalService": Boolean,
"ImageFamily": String,
"DeletionForce": Boolean,
"UniqueSuffix": Boolean,
"NetworkOptions": Map,
"CpuOptions": Map,
"NetworkInterfaceQueueNumber": Integer,
"HostNames": List,
"ImageOptions": Map,
"SecurityOptions": Map,
"SchedulerOptions": Map
}
}Properties
Property | Type | Required | Editable | Description | Constraints |
InstanceType | String | Yes | Yes | ECS instance type. | For more information, see Instance families. Note When UpdatePolicy is set to ForAllInstances, existing instances will be updated as well; otherwise, updating this parameter only takes effect for newly added instances. |
MaxAmount | Integer | Yes | Yes | Number of ECS instances to create at a time. | Valid values: 1 to 1000. Note When you update a stack, if MaxAmount increases (or decreases), the corresponding number of ECS instances is added (or removed). For example, if MaxAmount changes from 2 to 5, three new ECS instances are added. |
Affinity | String | No | No | Whether an ECS instance is associated with a Dedicated Host. | Valid values:
|
AllocatePublicIP | Boolean | No | No | Whether to assign a public IP address. | If InternetMaxBandwidthOut is 0, no public IP address is assigned. Valid values:
|
AutoReleaseTime | String | No | No | The automatic release time of the ECS instance. | The time must follow ISO 8601 format, for example |
AutoRenew | String | No | Yes | Whether to enable auto-renewal. | This parameter takes effect only when InstanceChargeType is Valid values:
Note Updating this parameter only takes effect for newly added ECS instances. |
AutoRenewPeriod | Number | No | Yes | Duration of each auto-renewal. | This parameter is required when AutoRenew is True. Valid values:
Note Updating this parameter only takes effect for newly added ECS instances. |
CpuOptions | Map | No | No | CPU-related properties. | For more information, see CpuOptions properties. |
CreditSpecification | String | No | Yes | Set the operating mode for a burstable performance instance. | Valid values:
For performance limits, see Burstable instance overview. |
DedicatedHostId | String | No | No | ID of the Dedicated Host. | None |
DeletionForce | Boolean | No | No | Whether to force delete the instance. | Default value: false. |
DeletionProtection | Boolean | No | Yes | Whether to protect the instance from release through the console or the DeleteInstance API. | Valid values: true: Enable protection. false: Disable protection. |
DeploymentSetGroupNo | Integer | No | No | If your deployment set uses the high availability policy (AvailabilityGroup), specify the group number for this instance in the deployment set. | Valid values: 1 to 7. |
DeploymentSetId | String | No | Yes | ID of the deployment set. | Updating this parameter only takes effect for newly added ECS instances. |
Description | String | No | Yes | Description. | Maximum length: 256 characters. Note Updating this parameter only takes effect for newly added ECS instances. |
DiskMappings | List | No | Yes | Data disks for the ECS instance. | You can create up to 16 data disks. Modifying this parameter does not affect existing instances. New instances use the updated value. For more information, see DiskMappings properties. Note Updating this parameter only takes effect for newly added ECS instances. |
EniMappings | List | No | Yes | Elastic Network Interfaces (ENIs) attached to the instance. | You can attach up to one ENI to the instance. For more information, see EniMappings properties. |
HostName | String | No | No | Hostname. | Minimum length: 2 characters. A period (.) or hyphen (-) cannot be the first or last character. Consecutive periods or hyphens are not allowed. For more information, see Request parameters. |
HostNames | List | No | No | Specify different hostnames for multiple instances. | None |
HpcClusterId | String | No | Yes | ID of the HPC cluster that the instance belongs to. | Updating this parameter only takes effect for newly added ECS instances. |
HttpEndpoint | String | No | Yes | Whether to enable access to instance metadata. | Valid values:
Note For metadata access modes, see Instance metadata. |
HttpTokens | String | No | Yes | Whether to enforce IMDSv2 (hardened mode) for accessing instance metadata. | Valid values:
Note For metadata access modes, see Instance metadata. |
ImageFamily | String | No | No | Name of the image family. | Use this parameter to launch instances with the latest available image in the specified image family.
Note For image family information about Alibaba Cloud official images, see Public images. |
ImageId | String | No | Yes | ID of the image used to launch the ECS instance. Valid values include public images, custom images, and Alibaba Cloud Marketplace images. | You can specify a public image ID using fuzzy matching instead of the full ID. Examples:
For more information, see Request parameters. Note When UpdatePolicy is set to ForAllInstances, existing instances will be updated as well; otherwise, updating this parameter only takes effect for newly added instances. |
ImageOptions | Map | No | No | Image-related properties. | For more information, see ImageOptions properties. |
InstanceChargeType | String | No | Yes | Billing method selected by the payer for the instance. | Valid values:
Note Updating this parameter only takes effect for newly added ECS instances. |
InstanceName | String | No | Yes | Instance name. | Maximum length: 128 characters. Valid characters include letters, digits, underscores (_), periods (.), and hyphens (-). Use the |
InternetChargeType | String | No | Yes | Billing method for public network access bandwidth. | Valid values:
Note When UpdatePolicy is set to ForAllInstances, existing instances will be updated as well; otherwise, updating this parameter only takes effect for newly added instances. |
InternetMaxBandwidthOut | Integer | No | Yes | Maximum outbound public bandwidth. | Valid values: 0 to 100. Unit: Mbit/s. Default value: 0. Note When UpdatePolicy is set to ForAllInstances, existing instances will be updated as well; otherwise, updating this parameter only takes effect for newly added instances. |
IoOptimized | String | No | No | Whether to create an I/O optimized instance. | Valid values:
|
Ipv6AddressCount | Integer | No | Yes | Number of randomly generated IPv6 addresses for the ENI. | You cannot specify both Ipv6Addresses and Ipv6AddressCount. Note Updating this parameter only takes effect for newly added ECS instances. |
Ipv6Addresses | List | No | Yes | IPv6 addresses for the ENI. | You can specify up to one IPv6 address. Changes do not affect existing instances. You cannot specify both Ipv6Addresses and Ipv6AddressCount. Note Updating this parameter only takes effect for newly added ECS instances. |
KeyPairName | String | No | Yes | Name of the key pair bound to the ECS instance. | If the instance runs Windows, this parameter is ignored. Default value: empty. If KeyPairName is specified, the password is still set on the instance, but password-based login is disabled for Linux systems. Note Updating this parameter only takes effect for newly added ECS instances. |
LaunchTemplateId | String | No | Yes | ID of the launch template. | None |
LaunchTemplateName | String | No | Yes | Name of the launch template. | None |
LaunchTemplateVersion | String | No | Yes | Version of the launch template. | If no version is specified, the default version is used. |
NetworkInterfaceQueueNumber | Integer | No | No | Number of queues for the primary ENI. | Note:
|
NetworkOptions | Map | No | No | Network-related properties. | For more information, see NetworkOptions properties. |
NetworkType | String | No | No | Network type of the ECS instance. | Valid values:
|
Password | String | No | Yes | Logon password for the ECS instance. | Length: 8 to 30 characters. Must contain at least three of the following: uppercase letters, lowercase letters, digits, and special characters. Supported special characters: If the Password parameter is specified, please use the HTTPS protocol to call the API to prevent password leakage. Note When UpdatePolicy is set to ForAllInstances, existing instances will be updated as well; otherwise, updating this parameter only takes effect for newly added instances. |
PasswordInherit | Boolean | No | No | Whether to use the password preconfigured in the image. | Valid values:
Note When using this parameter, Password must be empty. Also ensure the image has a preconfigured password. |
Period | Number | No | Yes | Subscription duration. | This parameter takes effect and must be specified only when InstanceChargeType is PrePaid. If DedicatedHostId is specified, the value cannot exceed the subscription duration of the Dedicated Host.
Note Updating this parameter only takes effect for newly added ECS instances. |
PeriodUnit | String | No | Yes | Subscription duration unit. | Valid values:
Note Updating this parameter only takes effect for newly added ECS instances. |
PrivateIpAddress | String | No | No | Private IP address of the instance. | For VPC-type instances, select the Note If PrivateIpAddress is set, the value of MaxAmount can only be 1. |
PrivatePoolOptions | Map | No | No | Private pool capacity options for launching instances. | For more information, see PrivatePoolOptions properties. |
RamRoleName | String | No | Yes | Name of the instance RAM role. | You can call ListRoles to query instance RAM role names. |
ResourceGroupId | String | No | Yes | ID of the | None |
SchedulerOptions | Map | No | No | Scheduling-related properties. | For more information, see SchedulerOptions properties. |
SecurityEnhancementStrategy | String | No | No | Whether to enable | Valid values:
|
SecurityGroupId | String | No | No | ID of the security group for the new instance. Instances in the same security group can communicate with each other. | You cannot specify both SecurityGroupId and SecurityGroupIds. |
SecurityGroupIds | List | No | No | List of security group IDs for the new instance. | You cannot specify both SecurityGroupId and SecurityGroupIds. |
SecurityOptions | Map | No | No | Trusted system-related properties. | For more information, see SecurityOptions properties. |
SpotDuration | Integer | No | No | Reservation duration for spot instances. | Valid range: 0 to 6. Unit: hours. Valid values:
|
SpotInterruptionBehavior | String | No | No |
| Only Terminate (default) is supported, which releases the instance immediately. |
SpotPriceLimit | String | No | No | Maximum hourly price for the instance. | Maximum precision: three decimal places. This parameter takes effect only when SpotStrategy is SpotWithPriceLimit. |
SpotStrategy | String | No | Yes | Bidding strategy for pay-as-you-go instances. | This parameter takes effect only when InstanceChargeType is PostPaid. Valid values:
|
StorageSetId | String | No | No | ID of the storage set. | None |
StorageSetPartitionNumber | Integer | No | No | Maximum number of partitions in the storage set. | Valid values: greater than or equal to 2. |
SubscriptionDeletionForce | Boolean | No | No | This option applies only when the resource is a | None |
SystemDiskAutoSnapshotPolicyId | String | No | Yes | ID of the automatic snapshot policy for the system disk. | None |
SystemDiskBurstingEnabled | Boolean | No | Yes | Whether bursting is enabled for the system disk. | Valid values:
|
SystemDiskCategory | String | No | Yes | System disk category. | Valid values:
Note When UpdatePolicy is set to ForAllInstances, existing instances will be updated as well; otherwise, updating this parameter only takes effect for newly added instances. |
SystemDiskDescription | String | No | Yes | Description of the system disk. | Updating this parameter only takes effect for newly added ECS instances. |
SystemDiskDiskName | String | No | Yes | Name of the system disk. | Updating this parameter only takes effect for newly added ECS instances. |
SystemDiskEncryptAlgorithm | String | No | Yes |
| Valid values:
|
SystemDiskEncrypted | String | No | Yes | Whether the system disk is encrypted. | Valid values:
|
SystemDiskKMSKeyId | String | No | Yes | KMS key ID for the system disk. | None |
SystemDiskPerformanceLevel | String | No | Yes | When creating an enterprise SSD for use as a system disk, you can set the disk's performance level. | Valid values:
For guidance on selecting an ESSD performance level, see Enterprise SSD. |
SystemDiskProvisionedIops | Integer | No | Yes | Provisioned IOPS for the system disk. | None |
SystemDiskSize | Number | No | Yes | Size of the system disk. | Valid values: 40 to 500. Unit: GiB. If you use a custom image, the system disk size must be larger than the image size. Note When UpdatePolicy is set to ForAllInstances, existing instances will be updated as well; otherwise, updating this parameter only takes effect for newly added instances. |
SystemDiskStorageClusterId | String | No | Yes | ID of the dedicated block storage cluster for the system disk. | None |
Tags | List | No | Yes | Custom tags. | Maximum: 20 tags. Format: |
Tenancy | String | No | No | Whether to create the instance on a Dedicated Host. | Valid values:
|
UniqueSuffix | Boolean | No | No | Whether to append sequential suffixes to | Sequential suffixes start at 001 and increment up to 999. Valid values:
If |
UpdatePolicy | String | No | Yes | Update strategy. | Valid values:
|
UseAdditionalService | Boolean | No | No | Whether to use Alibaba Cloud-provided | Valid values:
|
UserData | String | No | Yes | User data passed when creating the ECS instance. | Maximum size: 16 KB. Do not Base64-encode the content. Escape special characters. Valid values:
Note When UpdatePolicy is set to ForAllInstances, existing instances will be updated as well; otherwise, updating this parameter only takes effect for newly added instances. |
VpcId | String | No | No | ID of the virtual private cloud (VPC). | None |
VSwitchId | String | No | No | ID of the vSwitch. | None |
ZoneId | String | No | No | ID of the zone. | None |
ZoneIds | List | No | No | List of availability zones. | None |
DiskMappings syntax
"DiskMappings": [
{
"Category": String,
"DiskName": String,
"Description": String,
"Device": String,
"SnapshotId": String,
"Size": String,
"Encrypted": String,
"KMSKeyId": String,
"PerformanceLevel": String,
"AutoSnapshotPolicyId": String,
"ProvisionedIops": Integer,
"BurstingEnabled": Boolean,
"StorageClusterId": String
}
]DiskMappings properties
Property | Type | Required | Editable | Description | Constraints |
Size | String | Yes | No | Size of the data disk. | Unit: GiB. |
AutoSnapshotPolicyId | String | No | No | ID of the automatic snapshot policy. | None |
BurstingEnabled | Boolean | No | No | Whether bursting is enabled. | Valid values:
|
Category | String | No | No | Category of the data disk. | Valid values:
For I/O optimized instances, the default value is cloud_efficiency. For non-I/O optimized instances, the default value is cloud. |
Description | String | No | No | Description of the data disk. | Length: 2 to 256 characters. Cannot start with |
Device | String | No | No | Mount target. | None |
DiskName | String | No | No | Name of the data disk. | Length: 2 to 128 characters. Must start with a letter or Chinese character. Cannot start with |
Encrypted | String | No | No | Whether the data disk is encrypted. | Valid values:
|
KMSKeyId | String | No | No | KMS key ID for the data disk. | None |
PerformanceLevel | String | No | No | Performance level for an ESSD used as a data disk. | Valid values:
For guidance on selecting an ESSD performance level, see ESSDs. |
ProvisionedIops | Integer | No | No | Provisioned IOPS. | None |
SnapshotId | String | No | No | ID of the snapshot. | None |
StorageClusterId | String | No | No | ID of the dedicated block storage cluster. | None |
EniMappings syntax
"EniMappings": [
{
"SecurityGroupId": String,
"VSwitchId": String,
"Description": String,
"NetworkInterfaceName": String,
"PrimaryIpAddress": String,
"InstanceType": String,
"Ipv6AddressCount": Integer,
"NetworkInterfaceTrafficMode": String,
"Ipv6Addresses": List,
"QueueNumber": Integer,
"SecurityGroupIds": List,
"NetworkInterfaceId": String,
"DeleteOnRelease": Boolean,
"NetworkCardIndex": Integer,
"QueuePairNumber": Integer
}
]EniMappings properties
Property | Type | Required | Editable | Description | Constraints |
DeleteOnRelease | Boolean | No | No | Whether to retain the ENI when releasing the instance. | Valid values:
|
Description | String | No | Yes | Description of the ENI. | Length: 2 to 256 characters. Cannot start with |
InstanceType | String | No | No | Type of ENI. | You can configure up to two ENIs. When configuring one ENI, you can choose either a primary or secondary ENI. When configuring two ENIs, you must configure one primary and one secondary ENI. Valid values:
|
Ipv6AddressCount | Integer | No | No | Number of randomly generated IPv6 addresses for the primary ENI. | Valid values: 1 to 10. Notes:
|
Ipv6Addresses | List | No | No | One or more IPv6 addresses for the primary ENI. | You can specify up to 10 IPv6 addresses. Notes:
|
NetworkCardIndex | Integer | No | No | Index of the physical network card. |
|
NetworkInterfaceId | String | No | No | ID of the ENI attached to the instance. | This parameter applies only to secondary ENIs. After specifying an existing secondary ENI, you cannot configure other ENI creation parameters. |
NetworkInterfaceName | String | No | Yes | Name of the ENI. | Length: 2 to 128 characters. Must start with a letter or Chinese character. Cannot start with |
NetworkInterfaceTrafficMode | String | No | No | The network interface controller (NIC) communication mode. | Valid values:
Note The number of RDMA-enabled ENIs cannot exceed the limit for the instance family. For more information, see Instance families. |
PrimaryIpAddress | String | No | No | Primary private IP address of the ENI. | The specified IP must be an idle address in the CIDR block of the vSwitch. If no IP is specified, an idle address is assigned randomly from the vSwitch. |
QueueNumber | Integer | No | No | Number of queues for the ENI. | Notes:
|
QueuePairNumber | Integer | No | No | Number of queues for the RDMA ENI. | This field is of type Long. Precision loss may occur when you serialize or deserialize the value. Ensure the value does not exceed 9007199254740991. |
SecurityGroupId | String | No | Yes | Security group ID. | The security group must belong to the same VPC. |
SecurityGroupIds | List | No | No | One or more security group IDs for the ENI. | Notes:
|
VSwitchId | String | No | No | vSwitch ID. | None |
PrivatePoolOptions syntax
"PrivatePoolOptions": [
{
"Id": String,
"MatchCriteria": String
}
]PrivatePoolOptions properties
Property | Type | Required | Editable | Description | Constraints |
Id | String | No | No | ID of the private pool. This is the ID of an Elastic Capacity Service or Reserved Capacity Service. | None |
MatchCriteria | String | No | No | After Elastic Capacity Service or Reserved Capacity Service becomes active, it creates private pool capacity for instance launch. | Valid values:
In any of the following scenarios, the private pool capacity option for instance startup can only be set to
|
NetworkOptions syntax
"NetworkOptions": {
"EnableJumboFrame": Boolean
}NetworkOptions properties
Property | Type | Required | Editable | Description | Constraints |
EnableJumboFrame | Boolean | No | No | Whether to enable jumbo frames for the instance. | Valid values:
Default value: true. Note Only some instance types from generation 8 and later support jumbo frames. For more information, see Jumbo frames. |
CpuOptions syntax
"CpuOptions": {
"ThreadsPerCore": Integer,
"Core": Integer,
"NestedVirtualization": String
}CpuOptions properties
Property | Type | Required | Editable | Description | Constraints |
Core | Integer | No | No | Number of CPU cores. | This parameter does not support custom values. Use the default value only. Default value: See Change CPU options. |
NestedVirtualization | String | No | No | Whether nested virtualization is enabled. | Valid values:
|
ThreadsPerCore | Integer | No | No | Number of CPU threads. | vCPU count = |
ImageOptions syntax
"ImageOptions": {
"LoginAsNonRoot": Boolean
}ImageOptions properties
Property | Type | Required | Editable | Description | Constraints |
LoginAsNonRoot | Boolean | No | No | Whether instances launched with this image support login as the ecs-user user. | Valid values:
|
SecurityOptions syntax
"SecurityOptions": {
"TrustedSystemMode": String
}SecurityOptions properties
Property | Type | Required | Editable | Description | Constraints |
TrustedSystemMode | String | No | No | The trusted system mode. | Valid value: vTPM. The trusted system mode is supported by the g7, c7, and r7 instance families, and the security-enhanced instance family, including g7t, c7t, and r7t. Set this parameter when you create an ECS instance that belongs to one of these instance families. If you use the Note If you specify the instance as a For more information about the trusted system, see Overview of trusted computing capabilities. |
SchedulerOptions syntax
"SchedulerOptions": {
"ManagedPrivateSpaceId": String,
"DedicatedHostClusterId": String
}SchedulerOptions properties
Property | Type | Required | Editable | Description | Constraints |
DedicatedHostClusterId | String | No | No | ID of the dedicated host cluster where the ECS instance resides. The system automatically selects a dedicated host from this cluster to deploy the instance. | This parameter takes effect only when When you specify both a Dedicated Host (
You can query dedicated host cluster IDs using DescribeDedicatedHostClusters. |
ManagedPrivateSpaceId | String | No | No | ID of the managed private resource pool. | None |
Return values
Fn::GetAtt
InstanceIds: A list in which each ECS instance ID is a system-generated globally unique identifier for accessing an instance.PrivateIps: The private IP address list for each VPC-connected instance.NoteThis return value takes effect when
NetworkTypeisvpc. It is a formatted JSON array, such as["172.16.XX.XX", "172.16.XX.XX", … "172.16.XX.XX"], containing at most 100 IP addresses separated by commas (,).InnerIps: The private IP address list for classic network instances.NoteThis return value takes effect when
NetworkTypeisclassic. It is a formatted JSON array, such as["10.1.XX.XX", "10.1.XX.XX", …, "10.1.XX.XX"], containing at most 100 IP addresses separated by commas (,).PublicIps: The public IP address list for classic network instances.NoteThis return value takes effect when
NetworkTypeisclassic. It is a formatted JSON array, such as["42.1.XX.XX", "42.1.XX.XX", … "42.1.XX.XX"], containing at most 100 IP addresses separated by commas (,).HostNames: The hostname list for all instances.OrderId: The order ID list for instances.ZoneIds: The zone IDs.Ipv6AddressIds: The IPv6 address ID list for created ECS instances.NoteThe return type is a two-dimensional list. If an instance has no IPv6 address, the corresponding list element is empty. If all instances have no IP address,
nullis returned.Ipv6Addresses: The IPv6 address list for created ECS instances.NoteThe return type is a two-dimensional list. If an instance has no IPv6 address, the corresponding list element is empty. If all instances have no IP address,
nullis returned.
Examples
Scenario 1: Create two ECS instances with passwordless Secure Shell login
ROSTemplateFormatVersion: '2015-09-01'
Description: Creates VPC ECS instance
Parameters:
VpcId:
AssociationProperty: ALIYUN::ECS::VPC::VPCId
Type: String
Description:
en: Please search the ID starting with (vpc-xxx) from console-Virtual Private Cloud
zh-cn: Existing virtual private cloud instance ID
Label:
en: VPC ID
zh-cn: Virtual private cloud instance ID
VSwitchZoneId:
AssociationProperty: ALIYUN::ECS::Instance:ZoneId
Type: String
Description:
zh-cn: vSwitch zone
en: VSwitch Availability Zone
Label:
zh-cn: vSwitch zone
en: VSwitch Availability Zone
VSwitchId:
AssociationProperty: ALIYUN::ECS::VSwitch::VSwitchId
AssociationPropertyMetadata:
VpcId: ${VpcId}
ZoneId: ${VSwitchZoneId}
Type: String
Description:
en: Instance ID of existing business network switches, console-Virtual Private Cloud-VSwitches under query
zh-cn: Existing business network switch instance ID
Label:
en: VSwitch ID
zh-cn: Switch instance ID
SecurityGroupId:
Type: String
AssociationProperty: ALIYUN::ECS::SecurityGroup::SecurityGroupId
AssociationPropertyMetadata:
VpcId: ${VpcId}
Description:
en: Please search the business security group ID starting with(sg-xxx)from console-ECS-Network & Security
zh-cn: Existing business security group instance ID
Label:
en: Business Security Group ID
zh-cn: Business security group ID
InstanceType:
Type: String
Description:
zh-cn: Specify specifications available in the vSwitch zone.
en: Fill in the specifications that can be used under the VSwitch availability zone.
Label:
zh-cn: Instance type
en: Instance Type
AssociationProperty: ALIYUN::ECS::Instance::InstanceType
AssociationPropertyMetadata:
ZoneId: ${VSwitchZoneId}
SystemDiskCategory:
Type: String
Label:
en: System Disk Type
zh-cn: System disk type
Description:
en: System Disk Type
zh-cn: System disk type
AssociationProperty: ALIYUN::ECS::Disk::SystemDiskCategory
AssociationPropertyMetadata:
ZoneId: ${VSwitchZoneId}
InstanceType: ${InstanceType}
Resources:
OpsEcsInstance:
Type: ALIYUN::ECS::InstanceGroup
Properties:
MaxAmount: 1
HostName: OpsEcsInstance
UserData:
Fn::Sub:
- |
#!/bin/bash
RootPassword=${RootPassword}
ProdIP=${ProdIP}
SSHConfig() {
echo '[ ! -f /root/.ssh/id_rsa.pub ] && ssh-keygen -t rsa -P "" -f ~/.ssh/id_rsa &>/dev/null' >> /tmp/auto_ssh.sh
echo 'while read line;do' >> /tmp/auto_ssh.sh
echo ' ip=`echo $line | cut -d " " -f1`' >> /tmp/auto_ssh.sh
echo ' user_name=`echo $line | cut -d " " -f2`' >> /tmp/auto_ssh.sh
echo ' pass_word=`echo $line | cut -d " " -f3`' >> /tmp/auto_ssh.sh
echo 'expect <<EOF' >> /tmp/auto_ssh.sh
echo ' spawn ssh-copy-id -i /root/.ssh/id_rsa.pub $user_name@$ip' >> /tmp/auto_ssh.sh
echo ' expect {' >> /tmp/auto_ssh.sh
echo ' "yes/no" { send "yes\n";exp_continue}' >> /tmp/auto_ssh.sh
echo ' "password" { send "$pass_word\n"}' >> /tmp/auto_ssh.sh
echo ' }' >> /tmp/auto_ssh.sh
echo ' expect eof' >> /tmp/auto_ssh.sh
echo 'EOF' >> /tmp/auto_ssh.sh
echo 'done < /tmp/host_ip.txt' >> /tmp/auto_ssh.sh
}
SetHostsConfig() {
echo "`ifconfig eth0 | awk '/inet /{print $2}'` root ${RootPassword}" >> /tmp/host_ip.txt
echo "${ProdIP} root ${RootPassword}" >> /tmp/host_ip.txt
sh /tmp/auto_ssh.sh
}
main() {
yum install -y expect
SSHConfig
SetHostsConfig
rm -rf /tmp/host_ip.txt
}
main
- ProdIP:
Fn::Select:
- '0'
- Fn::GetAtt:
- ProdEcsInstance
- PrivateIps
RootPassword: Admin@123!
VpcId:
Ref: VpcId
SecurityGroupId:
Ref: SecurityGroupId
VSwitchId:
Ref: VSwitchId
ImageId: centos_7
AllocatePublicIP: false
InstanceType:
Ref: InstanceType
SystemDiskSize: 40
SystemDiskCategory:
Ref: SystemDiskCategory
Password: Admin@123!
ProdEcsInstance:
Type: ALIYUN::ECS::InstanceGroup
Properties:
MaxAmount: 1
HostName: ProdEcsInstance
SystemDiskCategory:
Ref: SystemDiskCategory
VpcId:
Ref: VpcId
SecurityGroupId:
Ref: SecurityGroupId
SystemDiskSize: 40
ImageId: centos_7
VSwitchId:
Ref: VSwitchId
Password: Admin@123!
InstanceType:
Ref: InstanceType
AllocatePublicIP: false
Outputs: {}{
"ROSTemplateFormatVersion": "2015-09-01",
"Description": "Creates VPC ECS instance",
"Parameters": {
"VpcId": {
"AssociationProperty": "ALIYUN::ECS::VPC::VPCId",
"Type": "String",
"Description": {
"en": "Please search the ID starting with (vpc-xxx) from console-Virtual Private Cloud",
"zh-cn": "Existing virtual private cloud instance ID"
},
"Label": {
"en": "VPC ID",
"zh-cn": "Virtual private cloud instance ID"
}
},
"VSwitchZoneId": {
"AssociationProperty": "ALIYUN::ECS::Instance:ZoneId",
"Type": "String",
"Description": {
"zh-cn": "vSwitch zone",
"en": "VSwitch Availability Zone"
},
"Label": {
"zh-cn": "vSwitch zone",
"en": "VSwitch Availability Zone"
}
},
"VSwitchId": {
"AssociationProperty": "ALIYUN::ECS::VSwitch::VSwitchId",
"AssociationPropertyMetadata": {
"VpcId": "${VpcId}",
"ZoneId": "${VSwitchZoneId}"
},
"Type": "String",
"Description": {
"en": "Instance ID of existing business network switches, console-Virtual Private Cloud-VSwitches under query",
"zh-cn": "Existing business network switch instance ID"
},
"Label": {
"en": "VSwitch ID",
"zh-cn": "Switch instance ID"
}
},
"SecurityGroupId": {
"Type": "String",
"AssociationProperty": "ALIYUN::ECS::SecurityGroup::SecurityGroupId",
"AssociationPropertyMetadata": {
"VpcId": "${VpcId}"
},
"Description": {
"en": "Please search the business security group ID starting with(sg-xxx)from console-ECS-Network & Security",
"zh-cn": "Existing business security group instance ID"
},
"Label": {
"en": "Business Security Group ID",
"zh-cn": "Business security group ID"
}
},
"InstanceType": {
"Type": "String",
"Description": {
"zh-cn": "Specify specifications available in the vSwitch zone.",
"en": "Fill in the specifications that can be used under the VSwitch availability zone."
},
"Label": {
"zh-cn": "Instance type",
"en": "Instance Type"
},
"AssociationProperty": "ALIYUN::ECS::Instance::InstanceType",
"AssociationPropertyMetadata": {
"ZoneId": "${VSwitchZoneId}"
}
},
"SystemDiskCategory": {
"Type": "String",
"Label": {
"en": "System Disk Type",
"zh-cn": "System disk type"
},
"Description": {
"en": "System Disk Type",
"zh-cn": "System disk type"
},
"AssociationProperty": "ALIYUN::ECS::Disk::SystemDiskCategory",
"AssociationPropertyMetadata": {
"ZoneId": "${VSwitchZoneId}",
"InstanceType": "${InstanceType}"
}
}
},
"Resources": {
"OpsEcsInstance": {
"Type": "ALIYUN::ECS::InstanceGroup",
"Properties": {
"MaxAmount": 1,
"HostName": "OpsEcsInstance",
"UserData": {
"Fn::Sub": [
"#!/bin/bash\nRootPassword=${RootPassword}\nProdIP=${ProdIP}\nSSHConfig() {\necho '[ ! -f /root/.ssh/id_rsa.pub ] && ssh-keygen -t rsa -P \"\" -f ~/.ssh/id_rsa &>/dev/null' >> /tmp/auto_ssh.sh\necho 'while read line;do' >> /tmp/auto_ssh.sh\necho ' ip=`echo $line | cut -d \" \" -f1`' >> /tmp/auto_ssh.sh\necho ' user_name=`echo $line | cut -d \" \" -f2`' >> /tmp/auto_ssh.sh\necho ' pass_word=`echo $line | cut -d \" \" -f3`' >> /tmp/auto_ssh.sh\necho 'expect <<EOF' >> /tmp/auto_ssh.sh\necho ' spawn ssh-copy-id -i /root/.ssh/id_rsa.pub $user_name@$ip' >> /tmp/auto_ssh.sh\necho ' expect {' >> /tmp/auto_ssh.sh\necho ' \"yes/no\" { send \"yes\\n\";exp_continue}' >> /tmp/auto_ssh.sh\necho ' \"password\" { send \"$pass_word\\n\"}' >> /tmp/auto_ssh.sh\necho ' }' >> /tmp/auto_ssh.sh\necho ' expect eof' >> /tmp/auto_ssh.sh\necho 'EOF' >> /tmp/auto_ssh.sh\necho 'done < /tmp/host_ip.txt' >> /tmp/auto_ssh.sh\n}\nSetHostsConfig() {\necho \"`ifconfig eth0 | awk '/inet /{print $2}'` root ${RootPassword}\" >> /tmp/host_ip.txt\necho \"${ProdIP} root ${RootPassword}\" >> /tmp/host_ip.txt\nsh /tmp/auto_ssh.sh\n}\nmain() {\nyum install -y expect\nSSHConfig\nSetHostsConfig\nrm -rf /tmp/host_ip.txt\n}\nmain\n",
{
"ProdIP": {
"Fn::Select": [
"0",
{
"Fn::GetAtt": [
"ProdEcsInstance",
"PrivateIps"
]
}
]
},
"RootPassword": "Admin@123!"
}
]
},
"VpcId": {
"Ref": "VpcId"
},
"SecurityGroupId": {
"Ref": "SecurityGroupId"
},
"VSwitchId": {
"Ref": "VSwitchId"
},
"ImageId": "centos_7",
"AllocatePublicIP": false,
"InstanceType": {
"Ref": "InstanceType"
},
"SystemDiskSize": 40,
"SystemDiskCategory": {
"Ref": "SystemDiskCategory"
},
"Password": "Admin@123!"
}
},
"ProdEcsInstance": {
"Type": "ALIYUN::ECS::InstanceGroup",
"Properties": {
"MaxAmount": 1,
"HostName": "ProdEcsInstance",
"SystemDiskCategory": {
"Ref": "SystemDiskCategory"
},
"VpcId": {
"Ref": "VpcId"
},
"SecurityGroupId": {
"Ref": "SecurityGroupId"
},
"SystemDiskSize": 40,
"ImageId": "centos_7",
"VSwitchId": {
"Ref": "VSwitchId"
},
"Password": "Admin@123!",
"InstanceType": {
"Ref": "InstanceType"
},
"AllocatePublicIP": false
}
}
},
"Outputs": {}
}Scenario 2: Batch-create ECS instances and update configurations
About UpdatePolicy
After you create a group of ECS instances using ALIYUN::ECS::InstanceGroup, use the UpdatePolicy setting to control how configuration updates are applied to existing instances.
UpdatePolicy syntax
"UpdatePolicy": {
"RollingUpdateForOrigInstances": Map
}UpdatePolicy properties
Property | Type | Required | Editable | Description | Constraints |
RollingUpdateForOrigInstances | Map | No | Yes | Control strategy for updating existing ECS instances. This policy does not apply to new ECS instances. | For more information, see RollingUpdateForOrigInstances properties. |
RollingUpdateForOrigInstances syntax
"RollingUpdateForOrigInstances": {
"MaxBatchSize": Integer,
"PauseTime": Integer
}RollingUpdateForOrigInstances properties
Property | Type | Required | Editable | Description | Constraints |
MaxBatchSize | Integer | Yes | Yes | Number of ECS instances updated per batch. | Valid values: 1 to 1000. |
PauseTime | Integer | No | Yes | Pause time between batches, in seconds. Default is 0. | Valid values: 0 to 3600. |
Create a group of five ECS instances with identical configurations using the following template.
ROSTemplateFormatVersion: '2015-09-01'
Resources:
Instance:
Type: ALIYUN::ECS::InstanceGroup
Properties:
MaxAmount: 5
InstanceType: xxxx
ImageId: centos
VpcId: vpc-2xxxx
VSwitchId: vsw-xxxx
SecurityGroupId: sg-xxxxx
Password: Ros1gregrge2345
InstanceChargeType: PostPaid
NetworkType: vpc
SystemDiskCategory: xxx
SystemDiskSize: 100
InternetMaxBandwidthOut: 5
AllocatePublicIP: true{
"ROSTemplateFormatVersion": "2015-09-01",
"Resources": {
"Instance": {
"Type": "ALIYUN::ECS::InstanceGroup",
"Properties": {
"MaxAmount": 5,
"InstanceType": "xxxx",
"ImageId": "centos",
"VpcId": "vpc-2xxxx",
"VSwitchId": "vsw-xxxx",
"SecurityGroupId": "sg-xxxxx",
"Password": "Ros1gregrge2345",
"InstanceChargeType": "PostPaid",
"NetworkType": "vpc",
"SystemDiskCategory": "xxx",
"SystemDiskSize": 100,
"InternetMaxBandwidthOut": 5,
"AllocatePublicIP": true
}
}
}
}After the stack is successfully created, update the configurations of the existing ECS instances using the UpdatePolicy setting.
ROSTemplateFormatVersion: '2015-09-01'
Resources:
Instance:
Type: ALIYUN::ECS::InstanceGroup
UpdatePolicy:
RollingUpdateForOrigInstances:
MaxBatchSize: 2
PauseTime: 0
Properties:
MaxAmount: 10
InstanceType: xxxx
ImageId: centos
VpcId: vpc-2xxxx
VSwitchId: vsw-xxxx
SecurityGroupId: sg-xxxxx
Password: Ros1gregrge2345
InstanceChargeType: PostPaid
NetworkType: vpc
SystemDiskCategory: xxx
SystemDiskSize: 100
InternetMaxBandwidthOut: 5
AllocatePublicIP: true{
"ROSTemplateFormatVersion": "2015-09-01",
"Resources": {
"Instance": {
"Type": "ALIYUN::ECS::InstanceGroup",
"UpdatePolicy": {
"RollingUpdateForOrigInstances": {
"MaxBatchSize": 2,
"PauseTime": 0
}
},
"Properties": {
"MaxAmount": 10,
"InstanceType": "xxxx",
"ImageId": "centos",
"VpcId": "vpc-2xxxx",
"VSwitchId": "vsw-xxxx",
"SecurityGroupId": "sg-xxxxx",
"Password": "Ros1gregrge2345",
"InstanceChargeType": "PostPaid",
"NetworkType": "vpc",
"SystemDiskCategory": "xxx",
"SystemDiskSize": 100,
"InternetMaxBandwidthOut": 5,
"AllocatePublicIP": true
}
}
}
}If MaxBatchSize is set to 2, and MaxAmount changes from 5 before the update to 10 after the update, then during the resource stack update, the existing 5 machines will be modified in 3 batches: 2 / 2 / 1. The newly added 5 machines will be created all at once.
Scenario 3: Create two ECS instances and attach them to an SLB Classic Load Balancer (CLB) service group for load balancing
ROSTemplateFormatVersion: '2015-09-01'
Description:
zh-cn: Create an SLB with two ECS instances, configure the network and security group, and add the ECS instances to the SLB backend.
en: Create an SLB (Server Load Balancer) with two ECS (Elastic Compute Service) instances, configure the network and security groups, then add the ECS instances to the SLB backend.
Parameters:
SystemDiskCategory:
AssociationProperty: ALIYUN::ECS::Disk::SystemDiskCategory
AssociationPropertyMetadata:
InstanceType: ${ECSInstanceType}
ZoneId: ${ZoneId}
Type: String
Label:
zh-cn: System disk category
en: System Disk Category
AddressType:
Default: internet
Label:
zh-cn: Network type
en: Address Type
Type: String
Description:
zh-cn: The network type of the load balancer. Valid values: internet (public network access) and intranet (internal network access).
en: 'Network type of LoadBalancer. Optional value: Internet: public network access, Intranet: Intranet access.'
AllowedValues:
- internet
- intranet
ECSInternetChargeType:
AssociationPropertyMetadata:
LocaleKey: InternetChargeType
Description:
zh-cn: The billing method for public network access.
en: The charge type of public internet ECS instance.
Default: PayByTraffic
Label:
zh-cn: Internet billing method
en: Internet Charge Type
AllowedValues:
- PayByBandwidth
- PayByTraffic
Type: String
ECSInstanceType:
AssociationProperty: ALIYUN::ECS::Instance::ECSInstanceType
AssociationPropertyMetadata:
ZoneId: ${ZoneId}
Type: String
Description:
zh-cn: <font color='blue'><b>1. Before selecting an instance type, confirm that it is available in the current zone. Some instance types require prior approval.</b></font><br><font color='blue'><b>2. Available instance types</font><br></b></font>[ecs.n1.large <font color='green'>2 vCPUs 4 GiB</font>]<br></b>[ecs.n1.xlarge <font color='green'>8 vCPUs 16 GiB</font>]<br></b>[ecs.n1.3xlarge <font color='green'>16 vCPUs 32 GiB</font>]
en: <font color='blue'><b>1.Before selecting the model please confirm that the current available zone under the model is in stock, some models need to be reported in advance</b></font><br><font color='blue'><b>2.List of optional models</font><br></b></font>[ecs.n1.large <font color='green'>2vCPU 4GiB</font>]<br></b>[ecs.n1.xlarge <font color='green'>8vCPU 16GiB</font>]<br></b>[ecs.n1.3xlarge <font color='green'>16vCPU 32GiB</font>]
Label:
zh-cn: Instance type
en: Instance Type
Password:
ConstraintDescription:
zh-cn: The password must be 8 to 30 characters in length and contain at least three of the following character types: uppercase letters, lowercase letters, digits, and special characters. Special characters include: ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/
en: 'Length 8-30, must contain upper case letters, lower case letters, Numbers, special symbols three; special characters include: ()`~!@#$%^&*_-+=|{}[]:;''<>,.?/'
Description:
zh-cn: The password must be 8 to 30 characters in length and contain at least three of the following character types: uppercase letters, lowercase letters, digits, and special characters.<br>Special characters include: ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/
en: The 8-30 long login password of instance, consists of the uppercase, lowercase letter and number. <br> special characters include()`~!@#$%^&*_-+=|{}[]:;'<>,.?/
MinLength: '8'
Label:
zh-cn: Instance password
en: Instance Password
AllowedPattern: '[0-9A-Za-z\_\-&:;''<>,=%`~!@#\(\)\$\^\*\+\|\{\}\[\]\.\?\/]+$'
NoEcho: true
MaxLength: '30'
Type: String
ImageId:
Default: centos_7_04_64_20G_alibase_201701015.vhd
AssociationProperty: ALIYUN::ECS::Image::ImageId
AssociationPropertyMetadata:
InstanceType: ${ECSInstanceType}
SupportedImageOwnerAlias:
- system
- self
- others
Type: String
Label:
zh-cn: Image ID
en: Image ID
Bandwidth:
Description:
zh-cn: The peak bandwidth of a public network instance billed by fixed bandwidth.
en: The bandwidth peak of a public network type instance of fixed bandwidth billing.
Default: 1
MaxValue: 1000
MinValue: 1
Label:
zh-cn: Peak bandwidth
en: The Peak Bandwidth
Type: Number
SLBInternetChargeType:
AssociationPropertyMetadata:
LocaleKey: InternetChargeType
Description:
zh-cn: The billing method for a public network instance.
en: The charge type of public internet SLB instance.
Default: paybytraffic
Label:
zh-cn: Internet billing method
en: Internet Charge Type
AllowedValues:
- paybybandwidth
- paybytraffic
Type: String
LoadBalancerSpec:
Default: slb.s1.small
Type: String
Description:
zh-cn: Instance type. For more information, see </b><a href='https://www.alibabacloud.com/help/doc-detail/85939.html' target='_blank'><b><font color='blue'>performance-guaranteed instance types</b></font></a>
en: Instance specifications, see detail:</b><a href='https://www.alibabacloud.com/help/doc-detail/85939.html' target='_blank'><b><font color='blue'>Performance support type</b></font></a>
Label:
zh-cn: Instance type
en: Instance Specification
ZoneId:
AssociationProperty: ALIYUN::ECS::Instance::ZoneId
Type: String
Description:
zh-cn: The zone ID. Make sure that ECS, VPC, and vSwitch resources are supported in the selected zone.
en: The available zone ID, you should confirm the zone support ECS, VPC, VSwitch or not.
Label:
zh-cn: Zone ID
en: Zone ID
Outputs:
BackendServerInstanceId:
Description:
zh-cn: IDs of the created ECS instances
en: The instance IDs of create EcsInstanceGroup
Value:
Fn::GetAtt:
- EcsInstanceGroup
- InstanceIds
BackendServerPublicIp:
Description:
zh-cn: Public IP addresses of the created ECS instances.
en: The instance public IPs of create EcsInstanceGroup.
Value:
Fn::GetAtt:
- EcsInstanceGroup
- PublicIps
SlbIpAddress:
Description:
zh-cn: The IP address of the load balancer.
en: The IP address of the load balancer.
Value:
Fn::GetAtt:
- LoadBalancer
- IpAddress
LoadBalancerId:
Description:
zh-cn: The ID of the created load balancer.
en: The ID of load balance created.
Value:
Fn::GetAtt:
- LoadBalancer
- LoadBalancerId
Resources:
SecurityGroup:
Type: ALIYUN::ECS::SecurityGroup
Properties:
VpcId:
Ref: Vpc
SecurityGroupName: MySecurityGroup
Attachment:
Type: ALIYUN::SLB::BackendServerAttachment
Properties:
BackendServers:
- ServerId:
Fn::Select:
- '0'
- Fn::GetAtt:
- EcsInstanceGroup
- InstanceIds
Weight: 100
- ServerId:
Fn::Select:
- '1'
- Fn::GetAtt:
- EcsInstanceGroup
- InstanceIds
Weight: 100
LoadBalancerId:
Ref: LoadBalancer
Vpc:
Type: ALIYUN::ECS::VPC
Properties:
CidrBlock: 192.168.0.0/16
EcsInstanceGroup:
Type: ALIYUN::ECS::InstanceGroup
Properties:
SystemDiskCategory:
Ref: SystemDiskCategory
VpcId:
Fn::GetAtt:
- Vpc
- VpcId
SecurityGroupId:
Fn::GetAtt:
- SecurityGroup
- SecurityGroupId
ImageId:
Ref: ImageId
IoOptimized: optimized
InternetChargeType:
Ref: ECSInternetChargeType
VSwitchId:
Ref: VSwitch
Password:
Ref: Password
InstanceType:
Ref: ECSInstanceType
MaxAmount: 2
VSwitch:
Type: ALIYUN::ECS::VSwitch
Properties:
VpcId:
Ref: Vpc
CidrBlock: 192.168.1.0/24
ZoneId:
Ref: ZoneId
LoadBalancer:
Type: ALIYUN::SLB::LoadBalancer
Properties:
InternetChargeType:
Ref: SLBInternetChargeType
Bandwidth:
Ref: Bandwidth
AddressType:
Ref: AddressType
LoadBalancerSpec:
Ref: LoadBalancerSpec
Metadata:
ALIYUN::ROS::Interface:
ParameterGroups:
- Parameters:
- ZoneId
- ECSInternetChargeType
- ECSInstanceType
- ImageId
- SystemDiskCategory
- Password
Label:
default:
zh-cn: ECS
en: ECS
- Parameters:
- LoadBalancerSpec
- AddressType
- SLBInternetChargeType
- Bandwidth
Label:
default:
zh-cn: load balancing
en: SLB{
"ROSTemplateFormatVersion": "2015-09-01",
"Description": {
"zh-cn": "Create an SLB with two ECS instances, configure the network and security group, and add the ECS instances to the SLB backend.",
"en": "Create an SLB (Server Load Balancer) with two ECS (Elastic Compute Service) instances, configure the network and security groups, then add the ECS instances to the SLB backend."
},
"Parameters": {
"SystemDiskCategory": {
"AssociationProperty": "ALIYUN::ECS::Disk::SystemDiskCategory",
"AssociationPropertyMetadata": {
"InstanceType": "${ECSInstanceType}",
"ZoneId": "${ZoneId}"
},
"Type": "String",
"Label": {
"zh-cn": "System disk category",
"en": "System Disk Category"
}
},
"AddressType": {
"Default": "internet",
"Label": {
"zh-cn": "Network type",
"en": "Address Type"
},
"Type": "String",
"Description": {
"zh-cn": "The network type of the load balancer. Valid values: internet (public network access) and intranet (internal network access).",
"en": "Network type of LoadBalancer. Optional value: Internet: public network access, Intranet: Intranet access."
},
"AllowedValues": [
"internet",
"intranet"
]
},
"ECSInternetChargeType": {
"AssociationPropertyMetadata": {
"LocaleKey": "InternetChargeType"
},
"Description": {
"zh-cn": "The billing method for public network access.",
"en": "The charge type of public internet ECS instance."
},
"Default": "PayByTraffic",
"Label": {
"zh-cn": "Internet billing method",
"en": "Internet Charge Type"
},
"AllowedValues": [
"PayByBandwidth",
"PayByTraffic"
],
"Type": "String"
},
"ECSInstanceType": {
"AssociationProperty": "ALIYUN::ECS::Instance::ECSInstanceType",
"AssociationPropertyMetadata": {
"ZoneId": "${ZoneId}"
},
"Type": "String",
"Description": {
"zh-cn": "<font color='blue'><b>1. Before selecting an instance type, confirm that it is available in the current zone. Some instance types require prior approval.</b></font><br><font color='blue'><b>2. Available instance types</font><br></b></font>[ecs.n1.large <font color='green'>2 vCPUs 4 GiB</font>]<br></b>[ecs.n1.xlarge <font color='green'>8 vCPUs 16 GiB</font>]<br></b>[ecs.n1.3xlarge <font color='green'>16 vCPUs 32 GiB</font>]",
"en": "<font color='blue'><b>1.Before selecting the model please confirm that the current available zone under the model is in stock, some models need to be reported in advance</b></font><br><font color='blue'><b>2.List of optional models</font><br></b></font>[ecs.n1.large <font color='green'>2vCPU 4GiB</font>]<br></b>[ecs.n1.xlarge <font color='green'>8vCPU 16GiB</font>]<br></b>[ecs.n1.3xlarge <font color='green'>16vCPU 32GiB</font>]"
},
"Label": {
"zh-cn": "Instance type",
"en": "Instance Type"
}
},
"Password": {
"ConstraintDescription": {
"zh-cn": "The password must be 8 to 30 characters in length and contain at least three of the following character types: uppercase letters, lowercase letters, digits, and special characters. Special characters include: ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/",
"en": "Length 8-30, must contain upper case letters, lower case letters, Numbers, special symbols three; special characters include: ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/"
},
"Description": {
"zh-cn": "The password must be 8 to 30 characters in length and contain at least three of the following character types: uppercase letters, lowercase letters, digits, and special characters.<br>Special characters include: ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/",
"en": "The 8-30 long login password of instance, consists of the uppercase, lowercase letter and number. <br> special characters include()`~!@#$%^&*_-+=|{}[]:;'<>,.?/"
},
"MinLength": "8",
"Label": {
"zh-cn": "Instance password",
"en": "Instance Password"
},
"AllowedPattern": "[0-9A-Za-z\\_\\-&:;'<>,=%`~!@#\\(\\)\\$\\^\\*\\+\\|\\{\\}\\[\\]\\.\\?\\/]+$",
"NoEcho": true,
"MaxLength": "30",
"Type": "String"
},
"ImageId": {
"Default": "centos_7_04_64_20G_alibase_201701015.vhd",
"AssociationProperty": "ALIYUN::ECS::Image::ImageId",
"AssociationPropertyMetadata": {
"InstanceType": "${ECSInstanceType}",
"SupportedImageOwnerAlias": [
"system",
"self",
"others"
]
},
"Type": "String",
"Label": {
"zh-cn": "Image ID",
"en": "Image ID"
}
},
"Bandwidth": {
"Description": {
"zh-cn": "The peak bandwidth of a public network instance billed by fixed bandwidth.",
"en": "The bandwidth peak of a public network type instance of fixed bandwidth billing."
},
"Default": 1,
"MaxValue": 1000,
"MinValue": 1,
"Label": {
"zh-cn": "Peak bandwidth",
"en": "The Peak Bandwidth"
},
"Type": "Number"
},
"SLBInternetChargeType": {
"AssociationPropertyMetadata": {
"LocaleKey": "InternetChargeType"
},
"Description": {
"zh-cn": "The billing method for a public network instance.",
"en": "The charge type of public internet SLB instance."
},
"Default": "paybytraffic",
"Label": {
"zh-cn": "Internet billing method",
"en": "Internet Charge Type"
},
"AllowedValues": [
"paybybandwidth",
"paybytraffic"
],
"Type": "String"
},
"LoadBalancerSpec": {
"Default": "slb.s1.small",
"Type": "String",
"Description": {
"zh-cn": "Instance type. For more information, see </b><a href='https://www.alibabacloud.com/help/doc-detail/85939.html' target='_blank'><b><font color='blue'>performance-guaranteed instance types</b></font></a>",
"en": "Instance specifications, see detail:</b><a href='https://www.alibabacloud.com/help/doc-detail/85939.html' target='_blank'><b><font color='blue'>Performance support type</b></font></a>"
},
"Label": {
"zh-cn": "Instance type",
"en": "Instance Specification"
}
},
"ZoneId": {
"AssociationProperty": "ALIYUN::ECS::Instance::ZoneId",
"Type": "String",
"Description": {
"zh-cn": "The zone ID. Make sure that ECS, VPC, and vSwitch resources are supported in the selected zone.",
"en": "The available zone ID, you should confirm the zone support ECS, VPC, VSwitch or not."
},
"Label": {
"zh-cn": "Zone ID",
"en": "Zone ID"
}
}
},
"Outputs": {
"BackendServerInstanceId": {
"Description": {
"zh-cn": "IDs of the created ECS instances",
"en": "The instance IDs of create EcsInstanceGroup"
},
"Value": {
"Fn::GetAtt": [
"EcsInstanceGroup",
"InstanceIds"
]
}
},
"BackendServerPublicIp": {
"Description": {
"zh-cn": "Public IP addresses of the created ECS instances.",
"en": "The instance public IPs of create EcsInstanceGroup."
},
"Value": {
"Fn::GetAtt": [
"EcsInstanceGroup",
"PublicIps"
]
}
},
"SlbIpAddress": {
"Description": {
"zh-cn": "The IP address of the load balancer.",
"en": "The IP address of the load balancer."
},
"Value": {
"Fn::GetAtt": [
"LoadBalancer",
"IpAddress"
]
}
},
"LoadBalancerId": {
"Description": {
"zh-cn": "The ID of the created load balancer.",
"en": "The ID of load balance created."
},
"Value": {
"Fn::GetAtt": [
"LoadBalancer",
"LoadBalancerId"
]
}
}
},
"Resources": {
"SecurityGroup": {
"Type": "ALIYUN::ECS::SecurityGroup",
"Properties": {
"VpcId": {
"Ref": "Vpc"
},
"SecurityGroupName": "MySecurityGroup"
}
},
"Attachment": {
"Type": "ALIYUN::SLB::BackendServerAttachment",
"Properties": {
"BackendServers": [
{
"ServerId": {
"Fn::Select": [
"0",
{
"Fn::GetAtt": [
"EcsInstanceGroup",
"InstanceIds"
]
}
]
},
"Weight": 100
},
{
"ServerId": {
"Fn::Select": [
"1",
{
"Fn::GetAtt": [
"EcsInstanceGroup",
"InstanceIds"
]
}
]
},
"Weight": 100
}
],
"LoadBalancerId": {
"Ref": "LoadBalancer"
}
}
},
"Vpc": {
"Type": "ALIYUN::ECS::VPC",
"Properties": {
"CidrBlock": "192.168.0.0/16"
}
},
"EcsInstanceGroup": {
"Type": "ALIYUN::ECS::InstanceGroup",
"Properties": {
"SystemDiskCategory": {
"Ref": "SystemDiskCategory"
},
"VpcId": {
"Fn::GetAtt": [
"Vpc",
"VpcId"
]
},
"SecurityGroupId": {
"Fn::GetAtt": [
"SecurityGroup",
"SecurityGroupId"
]
},
"ImageId": {
"Ref": "ImageId"
},
"IoOptimized": "optimized",
"InternetChargeType": {
"Ref": "ECSInternetChargeType"
},
"VSwitchId": {
"Ref": "VSwitch"
},
"Password": {
"Ref": "Password"
},
"InstanceType": {
"Ref": "ECSInstanceType"
},
"MaxAmount": 2
}
},
"VSwitch": {
"Type": "ALIYUN::ECS::VSwitch",
"Properties": {
"VpcId": {
"Ref": "Vpc"
},
"CidrBlock": "192.168.1.0/24",
"ZoneId": {
"Ref": "ZoneId"
}
}
},
"LoadBalancer": {
"Type": "ALIYUN::SLB::LoadBalancer",
"Properties": {
"InternetChargeType": {
"Ref": "SLBInternetChargeType"
},
"Bandwidth": {
"Ref": "Bandwidth"
},
"AddressType": {
"Ref": "AddressType"
},
"LoadBalancerSpec": {
"Ref": "LoadBalancerSpec"
}
}
}
},
"Metadata": {
"ALIYUN::ROS::Interface": {
"ParameterGroups": [
{
"Parameters": [
"ZoneId",
"ECSInternetChargeType",
"ECSInstanceType",
"ImageId",
"SystemDiskCategory",
"Password"
],
"Label": {
"default": {
"zh-cn": "ECS",
"en": "ECS"
}
}
},
{
"Parameters": [
"LoadBalancerSpec",
"AddressType",
"SLBInternetChargeType",
"Bandwidth"
],
"Label": {
"default": {
"zh-cn": "load balancing",
"en": "SLB"
}
}
}
]
}
}
}For more examples, see Public templates containing this resource.