The ALIYUN::ECS::InstanceGroup resource creates a group of ECS instances that share identical configurations.
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 name | Type | Required | Updatable | Description | Constraint |
InstanceType | String | Yes | Yes | ECS instance type. | For more information, see Instance families. Note This parameter updates existing instances only when UpdatePolicy is set to ForAllInstances. Otherwise, the update applies only to new 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 | Time when the ECS instance is automatically released. | 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 PrePaid. Valid values:
Note This parameter updates only new 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 applies only to newly created ECS instances. |
CpuOptions | Map | No | No | CPU-related properties. | For more information, see CpuOptions properties. |
CreditSpecification | String | No | Yes | Operating mode for burstable instances. | Valid values:
|
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:
|
DeploymentSetGroupNo | Integer | No | No | If your deployment set uses the AvailabilityGroup policy, 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. | This parameter update applies only to newly created ECS instances. |
Description | String | No | Yes | Description. | Maximum length: 256 characters. Note Changes to this parameter apply only to newly created 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 Changes to this parameter apply only to newly created 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 affects only newly created 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 This parameter updates existing instances only when UpdatePolicy is set to ForAllInstances. Otherwise, the update applies only to new instances. |
ImageOptions | Map | No | No | Image-related properties. | For more information, see ImageOptions properties. |
InstanceChargeType | String | No | Yes | Billing method for the instance. | Valid values:
Note This parameter update applies only to new 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 bandwidth. | Valid values:
Note This parameter updates existing instances only when UpdatePolicy is set to ForAllInstances. Otherwise, the update applies only to new instances. |
InternetMaxBandwidthOut | Integer | No | Yes | Maximum outbound public bandwidth. | Valid values: 0 to 100. Unit: Mbit/s. Default value: 0. Note This parameter updates existing instances only when UpdatePolicy is set to ForAllInstances. Otherwise, the update applies only to new 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 This parameter updates only new 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 This parameter updates only new 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 Changes to this parameter affect only newly created 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 | Login 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 you specify Password, call the API over HTTPS to prevent password leaks. Note This parameter updates existing instances only when UpdatePolicy is set to ForAllInstances. Otherwise, the update applies only to new 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 is required only when InstanceChargeType is PrePaid. If DedicatedHostId is specified, the value cannot exceed the subscription duration of the Dedicated Host.
Note This parameter updates only new ECS instances. |
PeriodUnit | String | No | Yes | Subscription duration unit. | Valid values:
Note This parameter update applies only to newly created ECS instances. |
PrivateIpAddress | String | No | No | Private IP address of the instance. | For VPC-type instances, select the private IP address from the idle CIDR block of the vSwitch. Note If PrivateIpAddress is set, MaxAmount must 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 resource group where the instance resides. | None |
SchedulerOptions | Map | No | No | Scheduling-related properties. | For more information, see SchedulerOptions properties. |
SecurityEnhancementStrategy | String | No | No | Whether to enable security hardening. | 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. For more information, see Security groups. |
SecurityOptions | Map | No | No | Trusted system-related properties. | For more information, see SecurityOptions properties. |
SpotDuration | Integer | No | No | Reservation duration for spot instances. | Valid values: 0 to 6. Unit: hours. Valid values:
|
SpotInterruptionBehavior | String | No | No | Interruption behavior for spot instances. | 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 to subscription instances. If true, the instance converts to a pay-as-you-go instance before deletion. If false, forced deletion does not occur. This action incurs additional charges. Use with caution. | 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 This parameter updates existing instances only when UpdatePolicy is set to ForAllInstances. Otherwise, the update applies only to new instances. |
SystemDiskDescription | String | No | Yes | Description of the system disk. | This parameter update applies only to newly created ECS instances. |
SystemDiskDiskName | String | No | Yes | Name of the system disk. | This parameter update only applies to new ECS instances. |
SystemDiskEncryptAlgorithm | String | No | Yes | Encryption algorithm for the system disk. | 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 This parameter updates existing instances only when UpdatePolicy is set to ForAllInstances. Otherwise, the update applies only to new 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: For more information, see Tags properties. |
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 For more information, see Batch set sequential instance names or hostnames. |
UpdatePolicy | String | No | Yes | Update strategy. | Valid values:
|
UseAdditionalService | Boolean | No | No | Whether to use Alibaba Cloud-provided VM system configurations (Windows: NTP, KMS; Linux: NTP, YUM). | 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. Note This parameter updates existing instances only when UpdatePolicy is set to ForAllInstances. Otherwise, the update applies only to new 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 name | Type | Required | Updatable | Description | Constraint |
Size | String | Yes | No | Size of the data disk. | Unit: GiB. |
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. |
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 |
Description | String | No | No | Description of the data disk. | Length: 2 to 256 characters. Cannot start with |
Device | String | No | No | Mount target. | None |
SnapshotId | String | No | No | ID of the snapshot. | None |
Encrypted | String | No | No | Whether the data disk is encrypted. | Valid values:
|
KMSKeyId | String | No | No | KMS key ID for the data disk. | None |
AutoSnapshotPolicyId | String | No | No | ID of the automatic snapshot policy. | 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 Enterprise SSD. |
ProvisionedIops | Integer | No | No | Provisioned IOPS. | None |
BurstingEnabled | Boolean | No | No | Whether bursting is enabled. | Valid values:
|
StorageClusterId | String | No | No | ID of the dedicated block storage cluster. | None |
Tags syntax
"Tags": [
{
"Value": String,
"Key": String
}
]Tags properties
Property name | Type | Required | Updatable | Description | Constraint |
Key | String | Yes | No | Tag key. | Length: 1 to 128 characters. Cannot start with |
Value | String | No | No | Tag value. | Length: 0 to 128 characters. Cannot start with |
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 name | Type | Required | Updatable | Description | Constraint |
SecurityGroupId | String | No | Yes | Security group ID. | The security group must belong to the same VPC. |
VSwitchId | String | No | No | vSwitch ID. | None |
Description | String | No | Yes | Description of the ENI. | Length: 2 to 256 characters. Cannot start with |
NetworkInterfaceName | String | No | Yes | Name of the ENI. | Length: 2 to 128 characters. Must start with a letter or Chinese character. Cannot start with |
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. |
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:
|
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. |
Ipv6Addresses | List | No | No | One or more IPv6 addresses for the primary ENI. | You can specify up to 10 IPv6 addresses. Notes:
|
QueueNumber | Integer | No | No | Number of queues for the ENI. | Notes:
|
SecurityGroupIds | List | No | No | One or more security group IDs for the ENI. | Notes:
|
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. |
DeleteOnRelease | Boolean | No | No | Whether to retain the ENI when releasing the instance. | Valid values:
|
NetworkCardIndex | Integer | No | No | Index of the physical network card. |
|
QueuePairNumber | Integer | No | No | Number of queues for the RDMA ENI. | This field is of type Long. Precision loss may occur during serialization/deserialization. Ensure the value does not exceed 9007199254740991. |
PrivatePoolOptions syntax
"PrivatePoolOptions": [
{
"Id": String,
"MatchCriteria": String
}
]PrivatePoolOptions properties
Property name | Type | Required | Updatable | Description | Constraint |
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 name | Type | Required | Updatable | Description | Constraint |
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
}CpuOptions properties
Property name | Type | Required | Updatable | Description | Constraint |
ThreadsPerCore | Integer | No | No | Number of CPU threads. | vCPU count = |
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. |
ImageOptions syntax
"ImageOptions": {
"LoginAsNonRoot": Boolean
}ImageOptions properties
Property name | Type | Required | Updatable | Description | Constraint |
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 name | Type | Required | Updatable | 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 g7t, c7t, and r7t instance families. Set this parameter when you create an ECS instance that belongs to one of these instance families. If you use the Alibaba Cloud Trusted System, set this parameter to vTPM. This allows the Alibaba Cloud Trusted System to perform a trusted verification when the instance starts. You do not need to set this parameter if you do not use the Alibaba Cloud Trusted System. However, if the ECS instance that you create uses the enclave confidential computing mode (SecurityOptions.ConfidentialComputingMode=Enclave), the trusted system is also enabled for the ECS instance. To create an ECS instance with a trusted system using OpenAPI, call the RunInstances operation. The CreateInstance operation does not support the SecurityOptions.TrustedSystemMode parameter. Note If you specify the instance as a trusted instance when you create it, you can only use images that support the trusted system when you replace the system disk. For more information about the trusted system, see Overview of trusted computing capabilities. |
SchedulerOptions syntax
"SchedulerOptions": {
"ManagedPrivateSpaceId": String,
"DedicatedHostClusterId": String
}SchedulerOptions properties
Property name | Type | Required | Updatable | Description | Constraint |
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. | Note 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: The IDs of the ECS instances. These are unique identifiers for accessing the instances and are generated by the system.
PrivateIps: A list of private IP addresses assigned to VPC-type instances. This property applies only when NetworkType is
vpc. Example: A JSON array formatted as["172.16.XX.XX", "172.16.XX.XX", … "172.16.XX.XX"], containing up to 100 IP addresses separated by commas (,).InnerIps: A list of private IP addresses assigned to classic-type instances. This property applies only when NetworkType is
classic. Example: A JSON array formatted as["10.1.XX.XX", "10.1.XX.XX", …, "10.1.XX.XX"], containing up to 100 IP addresses separated by commas (,).PublicIps: A list of public IP addresses assigned to classic-type instances. This property applies only when NetworkType is
classic. Example: A JSON array formatted as["42.1.XX.XX", "42.1.XX.XX", … "42.1.XX.XX"], containing up to 100 IP addresses separated by commas (,).HostNames: A list of hostnames for all instances.
OrderId: A list of order IDs for the instances.
ZoneIds: The zone IDs where the instances are deployed.
RelatedOrderIds: A list of related order IDs for the created ECS instances.
Ipv6AddressIds: A list of IPv6 address IDs for the created ECS instances.
NoteThe return type is a two-dimensional list. If an instance has no IPv6 addresses, the corresponding element in the list is empty. If no instances have an IP address, the return value is null.
Ipv6Addresses: A list of IPv6 addresses for the created ECS instances.
NoteThe return type is a two-dimensional list. If an instance has no IPv6 addresses, the corresponding element in the list is empty. If no instances have IPv6 addresses, the return value is null.
Examples
Scenario 1: Create two ECS instances with passwordless 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 property to control how configuration updates are applied to existing instances.
UpdatePolicy syntax
"UpdatePolicy": {
"RollingUpdateForOrigInstances": Map
}UpdatePolicy properties
Property name | Type | Required | Updatable | Description | Constraint |
RollingUpdateForOrigInstances | Map | No | Yes | Control strategy for updating existing ECS instances. This policy does not apply to new ECS instances. |
RollingUpdateForOrigInstances syntax
"RollingUpdateForOrigInstances": {
"MaxBatchSize": Integer,
"PauseTime": Integer
}RollingUpdateForOrigInstances properties
Property name | Type | Required | Allow updates | Description | Constraint |
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 property.
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
}
}
}
}With MaxBatchSize set to 2, the original five instances are updated in three batches (2, 2, and 1) during the stack update. The additional five instances are created simultaneously.
Scenario 3: Create two ECS instances and attach them to a Classic Load Balancer (CLB) server group.
ROSTemplateFormatVersion: '2015-09-01'
Description:
zh-cn: 创建SLB与2个ECS实例,配置网络与安全组,将ECS实例加入SLB后端。
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: 系统盘类型
en: System Disk Category
AddressType:
Default: internet
Label:
zh-cn: 网络类型
en: Address Type
Type: String
Description:
zh-cn: 负载均衡实例的网络类型,可选值:internet:公网访问,intranet:内网访问。
en: 'Network type of LoadBalancer. Optional value: Internet: public network access, Intranet: Intranet access.'
AllowedValues:
- internet
- intranet
ECSInternetChargeType:
AssociationPropertyMetadata:
LocaleKey: InternetChargeType
Description:
zh-cn: 访问公网计费方式。
en: The charge type of public internet ECS instance.
Default: PayByTraffic
Label:
zh-cn: 公网付费方式
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.选择机型前请先确认当前可用区下该机型是否有货,部分机型需要提前报备</b></font><br><font color='blue'><b>2.可选机型列表</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>]
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: 实例规格
en: Instance Type
Password:
ConstraintDescription:
zh-cn: 长度8-30,必须包含大写字母, 小写字母, 数字, 特殊符号三种;特殊字符包括:()`~!@#$%^&*_-+=|{}[]:;' <>,.?/
en: 'Length 8-30, must contain upper case letters, lower case letters, Numbers, special symbols three; special characters include: ()`~!@#$%^&*_-+=|{}[]:;''<>,.?/'
Description:
zh-cn: 长度8-30,必须包含大写字母, 小写字母, 数字, 特殊符号三个;<br>特殊字符包括:()`~!@#$%^&*_-+=|{}[]:;'<>,.?/
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: 实例密码
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: 镜像ID
en: Image ID
Bandwidth:
Description:
zh-cn: 固定带宽计费方式的公网类型实例的带宽峰值。
en: The bandwidth peak of a public network type instance of fixed bandwidth billing.
Default: 1
MaxValue: 1000
MinValue: 1
Label:
zh-cn: 带宽峰值
en: The Peak Bandwidth
Type: Number
SLBInternetChargeType:
AssociationPropertyMetadata:
LocaleKey: InternetChargeType
Description:
zh-cn: 公网类型实例的付费方式。
en: The charge type of public internet SLB instance.
Default: paybytraffic
Label:
zh-cn: 公网付费方式
en: Internet Charge Type
AllowedValues:
- paybybandwidth
- paybytraffic
Type: String
LoadBalancerSpec:
Default: slb.s1.small
Type: String
Description:
zh-cn: 实例规格,详见:</b><a href='https://www.alibabacloud.com/help/document_detail/85939.html' target='_blank'><b><font color='blue'>性能保障型</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: 实例规格
en: Instance Specification
ZoneId:
AssociationProperty: ALIYUN::ECS::Instance::ZoneId
Type: String
Description:
zh-cn: 可用区ID,需确认所选可用区下是否支持ECS, VPC, VSwitch等资源。
en: The available zone ID, you should confirm the zone support ECS, VPC, VSwitch or not.
Label:
zh-cn: 可用区ID
en: Zone ID
Outputs:
BackendServerInstanceId:
Description:
zh-cn: 创建ECS的实例IDs
en: The instance IDs of create EcsInstanceGroup
Value:
Fn::GetAtt:
- EcsInstanceGroup
- InstanceIds
BackendServerPublicIp:
Description:
zh-cn: 创建ECS的实例公共IPs。
en: The instance public IPs of create EcsInstanceGroup.
Value:
Fn::GetAtt:
- EcsInstanceGroup
- PublicIps
SlbIpAddress:
Description:
zh-cn: 负载均衡器的IP地址。
en: The IP address of the load balancer.
Value:
Fn::GetAtt:
- LoadBalancer
- IpAddress
LoadBalancerId:
Description:
zh-cn: 已创建负载平衡的ID。
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: 云服务器
en: ECS
- Parameters:
- LoadBalancerSpec
- AddressType
- SLBInternetChargeType
- Bandwidth
Label:
default:
zh-cn: 负载均衡
en: SLB
{
"ROSTemplateFormatVersion": "2015-09-01",
"Description": {
"zh-cn": "创建SLB与2个ECS实例,配置网络与安全组,将ECS实例加入SLB后端。",
"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": "系统盘类型",
"en": "System Disk Category"
}
},
"AddressType": {
"Default": "internet",
"Label": {
"zh-cn": "网络类型",
"en": "Address Type"
},
"Type": "String",
"Description": {
"zh-cn": "负载均衡实例的网络类型,可选值:internet:公网访问,intranet:内网访问。",
"en": "Network type of LoadBalancer. Optional value: Internet: public network access, Intranet: Intranet access."
},
"AllowedValues": [
"internet",
"intranet"
]
},
"ECSInternetChargeType": {
"AssociationPropertyMetadata": {
"LocaleKey": "InternetChargeType"
},
"Description": {
"zh-cn": "访问公网计费方式。",
"en": "The charge type of public internet ECS instance."
},
"Default": "PayByTraffic",
"Label": {
"zh-cn": "公网付费方式",
"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.选择机型前请先确认当前可用区下该机型是否有货,部分机型需要提前报备</b></font><br><font color='blue'><b>2.可选机型列表</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>]",
"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": "实例规格",
"en": "Instance Type"
}
},
"Password": {
"ConstraintDescription": {
"zh-cn": "长度8-30,必须包含大写字母, 小写字母, 数字, 特殊符号三种;特殊字符包括:()`~!@#$%^&*_-+=|{}[]:;' <>,.?/",
"en": "Length 8-30, must contain upper case letters, lower case letters, Numbers, special symbols three; special characters include: ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/"
},
"Description": {
"zh-cn": "长度8-30,必须包含大写字母, 小写字母, 数字, 特殊符号三个;<br>特殊字符包括:()`~!@#$%^&*_-+=|{}[]:;'<>,.?/",
"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": "实例密码",
"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": "镜像ID",
"en": "Image ID"
}
},
"Bandwidth": {
"Description": {
"zh-cn": "固定带宽计费方式的公网类型实例的带宽峰值。",
"en": "The bandwidth peak of a public network type instance of fixed bandwidth billing."
},
"Default": 1,
"MaxValue": 1000,
"MinValue": 1,
"Label": {
"zh-cn": "带宽峰值",
"en": "The Peak Bandwidth"
},
"Type": "Number"
},
"SLBInternetChargeType": {
"AssociationPropertyMetadata": {
"LocaleKey": "InternetChargeType"
},
"Description": {
"zh-cn": "公网类型实例的付费方式。",
"en": "The charge type of public internet SLB instance."
},
"Default": "paybytraffic",
"Label": {
"zh-cn": "公网付费方式",
"en": "Internet Charge Type"
},
"AllowedValues": [
"paybybandwidth",
"paybytraffic"
],
"Type": "String"
},
"LoadBalancerSpec": {
"Default": "slb.s1.small",
"Type": "String",
"Description": {
"zh-cn": "实例规格,详见:</b><a href='https://www.alibabacloud.com/help/document_detail/85939.html' target='_blank'><b><font color='blue'>性能保障型</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": "实例规格",
"en": "Instance Specification"
}
},
"ZoneId": {
"AssociationProperty": "ALIYUN::ECS::Instance::ZoneId",
"Type": "String",
"Description": {
"zh-cn": "可用区ID,需确认所选可用区下是否支持ECS, VPC, VSwitch等资源。",
"en": "The available zone ID, you should confirm the zone support ECS, VPC, VSwitch or not."
},
"Label": {
"zh-cn": "可用区ID",
"en": "Zone ID"
}
}
},
"Outputs": {
"BackendServerInstanceId": {
"Description": {
"zh-cn": "创建ECS的实例IDs",
"en": "The instance IDs of create EcsInstanceGroup"
},
"Value": {
"Fn::GetAtt": [
"EcsInstanceGroup",
"InstanceIds"
]
}
},
"BackendServerPublicIp": {
"Description": {
"zh-cn": "创建ECS的实例公共IPs。",
"en": "The instance public IPs of create EcsInstanceGroup."
},
"Value": {
"Fn::GetAtt": [
"EcsInstanceGroup",
"PublicIps"
]
}
},
"SlbIpAddress": {
"Description": {
"zh-cn": "负载均衡器的IP地址。",
"en": "The IP address of the load balancer."
},
"Value": {
"Fn::GetAtt": [
"LoadBalancer",
"IpAddress"
]
}
},
"LoadBalancerId": {
"Description": {
"zh-cn": "已创建负载平衡的ID。",
"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": "云服务器",
"en": "ECS"
}
}
},
{
"Parameters": [
"LoadBalancerSpec",
"AddressType",
"SLBInternetChargeType",
"Bandwidth"
],
"Label": {
"default": {
"zh-cn": "负载均衡",
"en": "SLB"
}
}
}
]
}
}
}For more examples, see Public templates containing this resource.