You need to enable JavaScript to run this app.
Auto Scaling

Auto Scaling

Copy page
Download PDF
Best Practices
Configuring sequential and unique instance names or hostnames
Copy page
Download PDF
Configuring sequential and unique instance names or hostnames
When you use Auto Scaling to automatically scale out instances, you can specify sequential and unique instance names or hostnames for each instance. This enables quick identification of instances corresponding to different services and improving the manageability of instances. This topic describes the rules and methods for configuring sequential names.​
Background​
Auto Scaling supports two scaling configuration sources: launch template and scaling configuration. The methods for configuring sequential names differ between the two sources:​
​
Scaling configuration source​
Instance name/hostname configuration rules​
Configuration method for instance name or hostname​
Related documents​
Instance launch template​
When a scaling group is associated with the same launch template, the instance names are sequential and unique only for a single scaling-out activity. However, instance names may repeat across different scaling-out activities.​
You can configure sequential instance names or hostnames for ECS instances only in the instance launch template console. The configuration method is the same as that for purchasing ECS instances. For more information, see Batch configuring sequential instance names or hostnames.​
Scaling configurations​
When a scaling group is associated with the same scaling configuration, the starting number of instance names for different scaling-out activities will increment based on the maximum sequential number among existing names. All instance names within the scaling group are sequential and unique.​
You can configure sequential instance names or hostnames for ECS instances in the console or by using OpenAPI. For more information, see Configuration rules.​
​
Configuration rules​
Naming rules​
The naming rules for instance names and hostnames are listed below:​
​
Type​
Naming rules​
Instance name​
  • Start with a letter or Chinese.​
  • It can contain only Chinese characters, letters, digits, underscores (_), and hyphens (-).​
  • It must be 1 to 128 characters in length.​
  • Special characters are currently not supported.​
Host name​
  • Linux instances:​
  • Letters, numbers, periods ".", and hyphens "-" are allowed.​
  • Can not start or end with a hyphen or period. Hyphens and periods can not be used consecutively.​
  • The length limit is 2 to 63 characters.​
  • Windows instances:​
  • Letters, numbers, or hyphens "-" are allowed. But the name can not be comprised of numbers only.​
  • Can not start or end with a hyphen. Hyphens can not be used consecutively.​
  • The length limit is 2 to 15 characters.​
​
Naming format​
Auto Scaling provides the following two naming formats:​
  • Dynamic extension sequencing (recommended): In addition to the 4-digit base, 3 extended digits are added to the sequential numeric value of a name, greatly expanding the value range.​
  • Fixed incremental sequencing: The sequential numeric value of a name supports up to 4 digits, with the upper limit of 9999.​
Format 1 (recommended): Dynamic extension sequencing​
Format​
The parameter format is name_prefix(as_extend_begin,as_extend_bits)[begin_number,bits]name_suffix.​
​
Field name​
Required​
Configuration instructions​
Example​
name_prefix​
Yes​
The prefix of the instance name or hostname. The prefix is required and must comply with the naming rules.​
name​
(as_extend_begin,as_extend_bits)​
Yes​
The extended sequential value of the instance name or hostname. When the base sequential numeric value in existing names of the scaling group reaches the upper limit, this parameter automatically increments by one digit. The base sequential value then restarts incrementing from 0, cycling until the new upper limit is reached.​
  • as_extend_begin: The start value of the extended sequential value.​
  • Valid range: [0,ZZZ]. Each digit can be 0–9, a–z, or A–Z. For example, 9 increments to a, and z increments to A.​
  • Default value: 0.​
  • as_extend_bits: The number of digits occupied by the extended sequential value.​
  • Valid range: [1,3].​
  • The default value is 3.​
tip​
  • The separator in (as_extend_begin, as_extend_bits) only supports an English comma (,) and must not include spaces.​
  • If you specify [] or [,], as_extend_begin starts from 0, and bits defaults to 3.​
  • When the digit count of the value specified for as_extend_begin exceeds the value of as_extend_bits, bits defaults to 3.​
(0,3)​
[begin_number,bits]​
Yes​
The base sequential value of the instance name or hostname. When this parameter increments to its maximum value, subsequent scale-out operations will automatically increase the extended sequential numeric value by one digit. The parameter then restarts incrementing from 0, cycling until the new upper limit is reached.​
  • begin_number: The start value of the base sequential value.​
  • Valid range: [0,9999].​
  • Default value: 0.​
  • bits: The number of digits occupied by the base sequential value.​
  • Valid range: [2,4].​
  • Default value: 4.​
tip​
  • Only English commas (,) are supported to separate values of "begin_number" and "bits", and no spaces are allowed between.​
  • If [begin_number,bits] is specified as [] or [,], the value of "begin_number" starts from 0, and "bits" takes the default value 4.​
  • When the digit count of the value specified for begin_number exceeds the value of bits, bits defaults to 4.​
​
name_suffix​
No​
Indicates the suffix of instance names or hostnames.​
-ecshost​
​
Description​
  • By default, the numeric value of a name increases sequentially. If a scaled-out instance fails to start, it is removed from the scaling group and a new instance is scaled out. As a result, instance names within the scaling group may not be consecutive.​
  • When the extended sequential numeric value and base sequential numeric value of instance names reach their upper limits, further scale-out requests will trigger an error and stop scaling activities. You must reconfigure the name format.​
  • Calculate the sum of the base sequential numeric value of the maximum sequential value among existing instance names in the scaling group and the number of instances to be scaled out. If this sum is greater than or equal to the maximum value of the base sequential numeric value, instance names may not increase consecutively (that is, discontinuously).​
Example​
The following table describes the naming parameter examples and final naming results.​
​
Description​
Input parameter​
Instance names (3 instances)​
Standard format​
name(0,3)[1,3]ecs​
name000001ecs, name000002ecs, name000003ecs​
Value not specified​
name()[]ecs or name(,)[,]ecs​
name0000000ecs, name0000001ecs, name0000002ecs​
Standard format. The instance with the maximum numeric value in the current scaling group is nameZ99ecs.​
name(0,1)[0,2]ecs​
Further scale-out requests will trigger an error and halt scaling activities.​
Standard format. The digit count of the value specified for begin_number exceeds the value of bits.​
name(0,1)[999,2]ecs​
name00999ecs, name01000ecs, name01001ecs​
Standard format. The instance with the maximum numeric value in the current scaling group is name0009ecs and there are instances that failed to scale out.​
name(0,2)[0,2]ecs​
name0010ecs, name0011ecs, name0013ecs​
Standard format. The instance with the maximum numeric value in the current scaling group is name0098ecs. The sum of the base sequential numeric value (from the maximum sequential value of existing instances) and the number of instances to be scaled out exceeds the maximum value of the base sequential numeric value.​
name(0,2)[0,2]ecs​
name0100ecs, name0101ecs, name0102ecs​
​
Format 2: Fixed incremental sequencing​
Format​
The parameter format is name_prefix(AUTO_INCREMENT)[begin_number,bits]name_suffix.​
​
Field name​
Required​
Configuration instructions​
Example​
name_prefix​
Yes​
Indicates the prefix of instance names or hostnames. You are required to specify this field based on the naming rules.​
name​
(AUTO_INCREMENT)​
Yes​
Fixed value, used to identify this sequencing method.​
(AUTO_INCREMENT)​
[begin_number,bits]​
Yes​
The sequential value of the instance name or hostname. The sequential value of the instance names or hostnames will increase based on this rule.​
  • begin_number: The start value of the sequential value.​
  • Valid range: [0,9999].​
  • Default value: 0.​
  • bits: The number of digits occupied by the sequential value.​
  • Valid range: [2,4].​
  • Default value: 4.​
tip​
  • Only English commas (,) are supported to separate values of "begin_number" and "bits", and no spaces are allowed between.​
  • If [begin_number,bits] is specified as [] or [,], the value of "begin_number" starts from 0, and "bits" takes the default value 4.​
  • When the digit count of the value specified for begin_number exceeds the value of bits, bits defaults to 4.​
[0,4]​
name_suffix​
No​
Indicates the suffix of instance names or hostnames.​
ecs​
​
Description​
  • By default, the numeric value of a name increases sequentially. If a scaled-out instance fails to start, it is removed from the scaling group and a new instance is scaled out. As a result, instance names within the scaling group may not be consecutive.​
  • When the numeric value of an instance name reaches the upper limit, further scale-out requests will trigger an error and halt scaling activities. You must reconfigure the name creation format.​
Example​
The following table describes the naming parameter examples and final naming results.​
​
Description​
Input parameter​
Instance names (3 instances)​
Standard format​
name(AUTO_INCREMENT)[1,3]ecs​
name001ecs, name002ecs, name003ecs​
Value not specified​
name(AUTO_INCREMENT)[]ecs or name(AUTO_INCREMENT)[,]ecs​
name0000ecs, name0001ecs, name0002ecs​
Standard format. The digit count of the value specified for begin_number exceeds the value of bits.​
name(AUTO_INCREMENT)[999,2]ecs​
name1000ecs, name1001ecs, name1002ecs​
Standard format. The instance with the maximum numeric value in the current scaling group is name99ecs.​
name(AUTO_INCREMENT)[99,2]ecs​
Further scale-out requests will trigger an error and halt scaling activities.​
Standard format. The instance with the maximum numeric value in the current scaling group is name99ecs and there are instances that failed to scale out.​
name(AUTO_INCREMENT)[99,3]ecs​
name100ecs, name102ecs, name103ecs​
​
​
Last updated: 2026.06.24 17:08:56