The ALIYUN::ECS::InstanceGroup resource creates a group of Elastic Compute Service (ECS) instances with 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 property 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. |
AllocatePublicIP | Boolean | No | No | Specifies 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. Example: |
AutoRenew | String | No | Yes | Specifies whether to enable auto-renewal. | This property takes effect only when InstanceChargeType is PrePaid. Valid values:
Note Changes to this parameter apply only to newly created ECS instances. |
AutoRenewPeriod | Number | No | Yes | Duration of each auto-renewal period. | This property is required when AutoRenew is True. Valid values:
Note Updating this parameter affects only newly created ECS instances. |
DedicatedHostId | String | No | No | ID of the Dedicated Host. | None |
DeletionProtection | Boolean | No | Yes | Specifies whether to protect the instance against deletion in the console or by calling the DeleteInstance API operation. | Valid values:
|
DeploymentSetId | String | No | Yes | ID of the deployment set. | Changes to this parameter take effect only for new ECS instances. |
Description | String | No | Yes | Description. | Maximum length: 256 characters. Note This property updates only new ECS instances. |
DiskMappings | List | No | Yes | Data disks for the ECS instances. | You can create up to 16 data disks. Changes to this property do not affect existing instances. New instances use the updated value. For more information, see DiskMappings properties. Note This parameter update affects only newly created ECS instances. |
EniMappings | List | No | Yes | Elastic network interfaces (ENIs) attached to the instance. | You can attach up to one ENI to an 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. |
HpcClusterId | String | No | Yes | ID of the HPC cluster that the instance belongs to. | This parameter update applies only to newly created ECS instances. |
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 a fuzzy match instead of the full ID. Examples:
For more information, see request parameters. Note This property updates existing instances only when UpdatePolicy is set to ForAllInstances. Otherwise, the update applies only to new instances. |
InstanceChargeType | String | No | Yes | Billing method for the instance. | Valid values:
Note This property updates only new ECS instances. |
InstanceName | String | No | Yes | Instance name. | Maximum length: 128 characters. Valid characters include letters, Chinese characters, digits, underscores (_), periods (.), and hyphens (-). Use the format |
InternetChargeType | String | No | Yes | Billing method for outbound public bandwidth. | Valid values:
Note This property 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 property updates existing instances only when UpdatePolicy is set to ForAllInstances. Otherwise, the update applies only to new instances. |
IoOptimized | String | No | No | Specifies whether to create I/O optimized instances. | Valid values:
|
Ipv6AddressCount | Integer | No | Yes | Number of randomly generated IPv6 addresses for the ENI. | You cannot specify both Ipv6Addresses and Ipv6AddressCount. Note This property 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 Updates to this parameter apply only to newly created ECS instances. |
KeyPairName | String | No | Yes | Name of the key pair bound to the ECS instance. | This property is ignored for Windows ECS instances. Default value: empty. If KeyPairName is specified, the password is still set on the instance, but password-based logon is disabled for Linux systems. Note Updates to this parameter affect only new 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. |
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 property updates existing instances only when UpdatePolicy is set to ForAllInstances. Otherwise, the update applies only to new instances. |
PasswordInherit | Boolean | No | No | Specifies whether to use the password preconfigured in the image. | Valid values:
Note When you use this property, Password must be empty. Also ensure the image has a password configured. |
Period | Number | No | Yes | Purchase duration for the resource. | This property 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 property updates only new ECS instances. |
PeriodUnit | String | No | Yes | Time unit for the purchase duration. | Valid values:
Note Changes to this parameter affect only newly created ECS instances. |
PrivateIpAddress | String | No | No | Private IP address of the instance. | For VPC-type ECS instances, select the private IP address from available addresses in the vSwitch CIDR block. Note If PrivateIpAddress is specified, MaxAmount must be 1. |
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 |
SecurityEnhancementStrategy | String | No | No | Specifies whether to enable security hardening. | Valid values:
|
SecurityGroupId | String | No | No | ID of the security group for the new instances. 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 instances. | You cannot specify both SecurityGroupId and SecurityGroupIds. For more information, see security groups. |
SpotDuration | Integer | No | No | Retention period for spot instances. | Valid values: 0 to 6. Unit: hours. Valid values:
|
SpotInterruptionBehavior | String | No | No | Interruption mode for spot instances. | Currently, only Terminate (default) is supported. This releases the instance immediately. |
SpotPriceLimit | String | No | No | Maximum hourly price for the instance. | Maximum precision: three decimal places. This property takes effect only when SpotStrategy is SpotWithPriceLimit. |
SpotStrategy | String | No | Yes | Bidding strategy for pay-as-you-go instances. | This property takes effect only when InstanceChargeType is PostPaid. Valid values:
|
SystemDiskAutoSnapshotPolicyId | String | No | Yes | ID of the automatic snapshot policy for the system disk. | None |
SystemDiskBurstingEnabled | Boolean | No | Yes | Specifies whether to enable bursting for the system disk. | Valid values:
|
SystemDiskCategory | String | No | Yes | System disk category. | Valid values:
Note This property 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. | Updates to this parameter take effect only on new ECS instances. |
SystemDiskDiskName | String | No | Yes | Name of the system disk. | This property updates only new ECS instances. |
SystemDiskPerformanceLevel | String | No | Yes | Performance level of the enterprise SSD (ESSD) used as the system disk. | Valid values:
To learn how to choose 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, ensure the system disk size is larger than the image size. Note This property updates existing instances only when UpdatePolicy is set to ForAllInstances. Otherwise, the update applies only to new instances. |
Tags | List | No | Yes | Custom tags. | Maximum: 20 tags. Format: For more information, see Tags properties. |
UpdatePolicy | String | No | Yes | Update policy. | Valid values:
|
UserData | String | No | Yes | User data passed when creating the ECS instance. | Maximum size: 16 KiB. Do not Base64-encode the content. Escape special characters. Note This property updates existing instances only when UpdatePolicy is set to ForAllInstances. Otherwise, the update applies only to new instances. |
VSwitchId | String | No | No | ID of the vSwitch. | None |
VpcId | String | No | No | ID of the virtual private cloud (VPC). | None |
ZoneId | String | No | No | ID of the zone. | None |
ZoneIds | List | No | No | List of 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 | Allow updates | 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 | Specifies whether the data disk is encrypted. | Valid values:
|
KMSKeyId | String | No | No | ID of the KMS key for the data disk. | None |
AutoSnapshotPolicyId | String | No | No | ID of the automatic snapshot policy. | None |
PerformanceLevel | String | No | No | Performance level of the enterprise SSD (ESSD) used as the data disk. | Valid values:
To learn how to choose an ESSD performance level, see Enterprise SSD. |
ProvisionedIops | Integer | No | No | Provisioned IOPS. | None |
BurstingEnabled | Boolean | No | No | Specifies whether to enable bursting. | 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 | ID of the vSwitch. | None |
Description | String | No | Yes | Description of the elastic network interface (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 IP address must be an available address in the vSwitch CIDR block. If no IP address is specified, the system assigns an available address from the vSwitch. |
InstanceType | String | No | No | Type of the ENI. | You can configure up to two ENIs. If you configure one ENI, it can be either a primary or secondary ENI. If you configure two ENIs, one must be primary and the other secondary. 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 | Traffic mode of the ENI. | 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 property applies only to secondary ENIs. After you specify an existing secondary ENI, you cannot configure other ENI creation parameters. |
DeleteOnRelease | Boolean | No | No | Specifies whether to retain the ENI when releasing the instance. | Valid values:
|
NetworkCardIndex | Integer | No | No | Physical network card index for the ENI. |
|
QueuePairNumber | Integer | No | No | Number of RDMA queues. | This field is of type Long. Precision loss may occur during serialization or 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 the Elastic Assurance service or Capacity Reservation service. | None |
MatchCriteria | String | No | No | After the Elastic Assurance service or Capacity Reservation service becomes effective, it generates private pool capacity for launching instances. | 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 | Specifies whether to enable jumbo frames for the instance. | Valid values:
Default value: true. Note Jumbo frames are supported only on certain instance families launched after Generation 8. 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. | You cannot customize this value. Use the default value. Default value: See Change CPU options. |
ImageOptions syntax
"ImageOptions": {
"LoginAsNonRoot": Boolean
}ImageOptions properties
Property name | Type | Required | Updatable | Description | Constraint |
LoginAsNonRoot | Boolean | No | No | Specifies whether instances created from this image support login as the ecs-user user. | Valid values:
|
SecurityOptions syntax
"SecurityOptions": {
"TrustedSystemMode": String
}SecurityOptions properties
Property Name | Type | Required | Updatable | Description | Constraint |
TrustedSystemMode | String | No | No | Trusted system mode. | Value: vTPM. Currently, trusted system mode supports the following instance families: g7, c7, r7. Security-enhanced instance families: g7t, c7t, r7t. When creating an ECS instance from these instance families, set this parameter. Details are as follows: If you use Alibaba Cloud Trusted System, set this parameter to vTPM. The instance will then complete trusted verification through Alibaba Cloud Trusted System upon startup. If you do not use Alibaba Cloud Trusted System, you can leave this parameter unset. However, note that if the ECS instance you create uses Enclave confidential computing mode (SecurityOptions.ConfidentialComputingMode=Enclave), the ECS instance will also enable the trusted system. When creating a trusted system ECS instance using OpenAPI, invoke RunInstances. CreateInstance does not currently support setting the SecurityOptions.TrustedSystemMode parameter. Note If you specify an instance as a trusted instance during creation, you can only use images that support trusted systems when replacing the system disk. For more information about trusted systems, 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 for the ECS instance. The system automatically selects a dedicated host from the cluster to deploy the ECS instance. | Note This property takes effect only when If you specify both a dedicated host (
You can call DescribeDedicatedHostClusters to query the list of dedicated host cluster IDs. |
ManagedPrivateSpaceId | String | No | No | ID of the managed private resource pool. | None |
Return values
Fn::GetAtt
InstanceIds: The IDs of the instances. These are system-generated, globally unique identifiers.
PrivateIps: The list of private IP addresses for VPC-type instances. This property is valid only when NetworkType is set to
vpc. Example: a JSON array formatted as["172.16.XX.XX", "172.16.XX.XX", … "172.16.XX.XX"]. Maximum: 100 IP addresses, separated by commas (,).InnerIps: The list of private IP addresses for classic network-type instances. This property is valid only when NetworkType is set to
classic. Example: a JSON array formatted as["10.1.XX.XX", "10.1.XX.XX", …, "10.1.XX.XX"]. Maximum: 100 IP addresses, separated by commas (,).PublicIps: The list of public IP addresses for classic network-type instances. This property is valid only when NetworkType is set to
classic. Example: a JSON array formatted as["42.1.XX.XX", "42.1.XX.XX", … "42.1.XX.XX"]. Maximum: 100 IP addresses, separated by commas (,).HostNames: The list of hostnames for all instances.
OrderId: The list of order IDs for the instances.
ZoneIds: The IDs of the zones.
RelatedOrderIds: The list of related order IDs for the created ECS instances.
Ipv6AddressIds: The list of IPv6 address IDs for the created ECS instances.
NoteThe return value is a two-dimensional list. If an instance does not have an IPv6 address, the corresponding element in the list is empty. If no instances have IPv6 addresses, the return value is null.
Ipv6Addresses: The list of IPv6 addresses for the created ECS instances.
NoteThe return value is a two-layer list. If an instance has no IPv6 addresses, its corresponding element in the list is empty. If no instances have IP addresses, null is returned.
Examples
Scenario 1: Create two ECS instances and enable passwordless logon.
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: ID of the existing VPC
Label:
en: VPC ID
zh-cn: VPC 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: ID of the existing vSwitch
Label:
en: VSwitch ID
zh-cn: vSwitch 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: ID of the existing security group
Label:
en: Business Security Group ID
zh-cn: Security group ID
InstanceType:
Type: String
Description:
zh-cn: Enter the instance types 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": "ID of the existing VPC"
},
"Label": {
"en": "VPC ID",
"zh-cn": "VPC 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": "ID of the existing vSwitch"
},
"Label": {
"en": "VSwitch ID",
"zh-cn": "vSwitch 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": "ID of the existing security group"
},
"Label": {
"en": "Business Security Group ID",
"zh-cn": "Security group ID"
}
},
"InstanceType": {
"Type": "String",
"Description": {
"zh-cn": "Enter the instance types 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: Create ECS instances in batches and update their configurations
Introduction to UpdatePolicy
After you create a group of ECS instances using ALIYUN::ECS::InstanceGroup, you can use the UpdatePolicy property to control the update policy for batch configuration updates. For more information about the syntax of the UpdatePolicy property, see the following section.
UpdatePolicy syntax
"UpdatePolicy": {
"RollingUpdateForOrigInstances": Map
}UpdatePolicy properties
Property name | Type | Required | Updatable | Description | Constraint |
RollingUpdateForOrigInstances | Map | No | Yes | Controls the update policy for 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 name | Type | Required | Updatable | Description | Constraint |
MaxBatchSize | Integer | Yes | Yes | Number of ECS instances to update in each batch. | Valid values: 1 to 1000. |
PauseTime | Integer | No | Yes | Pause time between update batches (in seconds). Default: 0. | Valid values: 0 to 3600. |
You can use the following template to create a group of five ECS instances with identical configurations.
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 created, you can update the configurations of the existing ECS instances. You can configure the UpdatePolicy property during the update.
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
}
}
}
}Set MaxBatchSize to 2. Before the update, MaxAmount is 5. After the update, MaxAmount is 10. During the stack update, the original five instances are updated in three batches (2, 2, and 1), and the five new instances are created at once.
Scenario 3: Create two ECS instances and attach them to a Classic Load Balancer (CLB) service group.
ROSTemplateFormatVersion: '2015-09-01'
Description:
zh-cn: Create a Server Load Balancer (SLB) and two ECS instances, configure the network and security groups, 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: Network type of the SLB instance. 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: Billing method for public network access.
en: The charge type of public internet ECS instance.
Default: PayByTraffic
Label:
zh-cn: Public network 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'>1. Before selecting an instance type, confirm that it is available in the current zone. Some instance types require prior application.</font>
<font color='blue'><b>2. Available instance types</font><br></font>[ecs.n1.large <font color='green'>2vCPU 4GiB</font>]
[ecs.n1.xlarge <font color='green'>8vCPU 16GiB</font>]
[ecs.n1.3xlarge <font color='green'>16vCPU 32GiB</font>]
en: <font color='blue'>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</font>
<font color='blue'><b>2.List of optional models</font><br></font>[ecs.n1.large <font color='green'>2vCPU 4GiB</font>]
[ecs.n1.xlarge <font color='green'>8vCPU 16GiB</font>]
[ecs.n1.3xlarge <font color='green'>16vCPU 32GiB</font>]
Label:
zh-cn: Instance type
en: Instance Type
Password:
ConstraintDescription:
zh-cn: Length: 8 to 30 characters. Must contain at least three of the following: uppercase letters, lowercase letters, digits, and special characters. Special characters include the following: ()`~!@#$%^&*_-+=|{}[]:;' <>,.?/
en: 'Length 8-30, must contain upper case letters, lower case letters, Numbers, special symbols three; special characters include the following: ()`~!@#$%^&*_-+=|{}[]:;''<>,.?/'
Description:
zh-cn: Length: 8 to 30 characters. Must contain at least three of the following: uppercase letters, lowercase letters, digits, and special characters.
Special characters include the following: ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/
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: Peak bandwidth for a pay-by-bandwidth public network instance.
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: Billing method for a public network SLB instance.
en: The charge type of public internet SLB instance.
Default: paybytraffic
Label:
zh-cn: Public network 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 <a href='https://www.alibabacloud.com/help/document_detail/85939.html' target='_blank'><font color='blue'>High-performance</font></a>
en: Instance specifications, see detail: </b><a href='https://www.alibabacloud.com/help/doc-detail/85939.html' target='_blank'><font color='blue'>Performance support type</font></a>
Label:
zh-cn: Instance type
en: Instance Specification
ZoneId:
AssociationProperty: ALIYUN::ECS::Instance::ZoneId
Type: String
Description:
zh-cn: Zone ID. Confirm that the selected zone supports resources such as ECS, VPC, and vSwitch.
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: Instance IDs of the created EcsInstanceGroup
en: The instance IDs of create EcsInstanceGroup
Value:
Fn::GetAtt:
- EcsInstanceGroup
- InstanceIds
BackendServerPublicIp:
Description:
zh-cn: Public IP addresses of the created EcsInstanceGroup.
en: The instance public IPs of create EcsInstanceGroup.
Value:
Fn::GetAtt:
- EcsInstanceGroup
- PublicIps
SlbIpAddress:
Description:
zh-cn: IP address of the load balancer.
en: The IP address of the load balancer.
Value:
Fn::GetAtt:
- LoadBalancer
- IpAddress
LoadBalancerId:
Description:
zh-cn: 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: SLB
en: SLB
{
"ROSTemplateFormatVersion": "2015-09-01",
"Description": {
"zh-cn": "Create a Server Load Balancer (SLB) and two ECS instances, configure the network and security groups, 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": "Network type of the SLB instance. 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": "Billing method for public network access.",
"en": "The charge type of public internet ECS instance."
},
"Default": "PayByTraffic",
"Label": {
"zh-cn": "Public network 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'>1. Before selecting an instance type, confirm that it is available in the current zone. Some instance types require prior application.</font>
<font color='blue'><b>2. Available instance types</font><br></font>[ecs.n1.large <font color='green'>2vCPU 4GiB</font>]
[ecs.n1.xlarge <font color='green'>8vCPU 16GiB</font>]
[ecs.n1.3xlarge <font color='green'>16vCPU 32GiB</font>]",
"en": "<font color='blue'>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</font>
<font color='blue'><b>2.List of optional models</font><br></font>[ecs.n1.large <font color='green'>2vCPU 4GiB</font>]
[ecs.n1.xlarge <font color='green'>8vCPU 16GiB</font>]
[ecs.n1.3xlarge <font color='green'>16vCPU 32GiB</font>]"
},
"Label": {
"zh-cn": "Instance type",
"en": "Instance Type"
}
},
"Password": {
"ConstraintDescription": {
"zh-cn": "Length: 8 to 30 characters. Must contain at least three of the following: uppercase letters, lowercase letters, digits, and special characters. Special characters include the following: ()`~!@#$%^&*_-+=|{}[]:;' <>,.?/",
"en": "Length 8-30, must contain upper case letters, lower case letters, Numbers, special symbols three; special characters include the following: ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/"
},
"Description": {
"zh-cn": "Length: 8 to 30 characters. Must contain at least three of the following: uppercase letters, lowercase letters, digits, and special characters.
Special characters include the following: ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/",
"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": "Peak bandwidth for a pay-by-bandwidth public network instance.",
"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": "Billing method for a public network SLB instance.",
"en": "The charge type of public internet SLB instance."
},
"Default": "paybytraffic",
"Label": {
"zh-cn": "Public network 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 <a href='https://www.alibabacloud.com/help/document_detail/85939.html' target='_blank'><font color='blue'>High-performance</font></a>",
"en": "Instance specifications, see detail: </b><a href='https://www.alibabacloud.com/help/doc-detail/85939.html' target='_blank'><font color='blue'>Performance support type</font></a>"
},
"Label": {
"zh-cn": "Instance type",
"en": "Instance Specification"
}
},
"ZoneId": {
"AssociationProperty": "ALIYUN::ECS::Instance::ZoneId",
"Type": "String",
"Description": {
"zh-cn": "Zone ID. Confirm that the selected zone supports resources such as ECS, VPC, and vSwitch.",
"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": "Instance IDs of the created EcsInstanceGroup",
"en": "The instance IDs of create EcsInstanceGroup"
},
"Value": {
"Fn::GetAtt": [
"EcsInstanceGroup",
"InstanceIds"
]
}
},
"BackendServerPublicIp": {
"Description": {
"zh-cn": "Public IP addresses of the created EcsInstanceGroup.",
"en": "The instance public IPs of create EcsInstanceGroup."
},
"Value": {
"Fn::GetAtt": [
"EcsInstanceGroup",
"PublicIps"
]
}
},
"SlbIpAddress": {
"Description": {
"zh-cn": "IP address of the load balancer.",
"en": "The IP address of the load balancer."
},
"Value": {
"Fn::GetAtt": [
"LoadBalancer",
"IpAddress"
]
}
},
"LoadBalancerId": {
"Description": {
"zh-cn": "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": "SLB",
"en": "SLB"
}
}
}
]
}
}
}For more examples, see public templates that include this resource.