All Products
Search
Document Center

Auto Scaling:Configure sequential and unique naming rules

Last Updated:May 04, 2026

This topic describes how to configure naming rules in a scaling configuration. These rules generate sequential and unique instance names or hostnames for ECS instances added during a scale-out, which simplifies instance management.

Background

  • A scaling group can add one or more ECS instances during a single scale-out or across multiple scale-outs. You can configure naming rules for instance names or hostnames in either a scaling configuration or a launch template.

  • The methods for setting instance name or hostname rules vary by scenario, as shown in the following table. This topic covers only Scenario 1.

    Scenario

    Solution

    References

    Scenario 1: All scaled-out ECS instances in a scaling group must have sequential and unique instance names or hostnames.

    You must configure the instance name or hostname rules in the scaling configuration. You cannot use a launch template for this configuration.

    Important

    The instance names or hostnames in a scaling group increase sequentially, but they are not guaranteed to increase consecutively. For example, if the hostnames created during a scale-out are ess-node-0999, ess-node-1000, and ess-node-1002, this indicates that the ECS instance with the hostname ess-node-1001 failed to start. The scaling group considers this instance unhealthy, removes it, and then creates a new ECS instance, assigning it the next available hostname, ess-node-1002.

    Scenario 2: The instance names or hostnames of ECS instances are unique and sequential for each scale-out event, but are not required to be unique across all instances in the scaling group.

    Use the specified sorting rule to configure the names.

    Batch-set sequential instance names or hostnames

    Scenario 3: You have no requirements for the instance names or hostnames of the scaled-out ECS instances.

    You do not need to configure naming rules as described in Scenario 1 or 2. You can set a static name.

    For example, if you set the hostname to hostname, all scaled-out ECS instances will have the hostname hostname.

    None

Method 1: By console

  1. Create a scaling group.

    For more information, see Create a scaling group.

  2. Create a scaling configuration and enable it.

    For more information, see Create a scaling configuration for ECS instances. In the Advanced Settings section, specify the naming rules for Instance Name and Host.

    For example, set Instance Name to ess-node-(AUTO_INCREMENT)[0,3], and set Host to ess-node-(AUTO_INCREMENT)[0,3]-ecshost.

    Note

    The naming rule used in this example is increment by fixed value. For more information, see (Recommended) Increment by fixed value. If you want to generate instance names or hostnames based on dynamic sorting rules, see Dynamic sorting by extended sequential value.

  3. Enable the scaling group.

    For more information, see Enable a scaling group.

  4. Create and execute a scaling rule.

    1. Create a scaling rule.

      For more information, see Create a scaling rule.

      This example uses a simple rule. When the scaling rule is executed, three ECS instances are added to the scaling group.

    2. Execute the scaling rule.

      For more information, see Execute a scaling rule.

      After the scaling activity succeeds, the instance names and hostnames of the three new ECS instances are as follows:

      • Instance names: ess-node-000, ess-node-001, ess-node-002

      • Hostnames: ess-node-000-ecshost, ess-node-001-ecshost, ess-node-002-ecshost

Method 2: By API

  1. Call the CreateScalingGroup API operation to create a scaling group.

    For more information, see CreateScalingGroup.

  2. Call the CreateScalingConfiguration API operation to create a scaling configuration.

    For more information, see CreateScalingConfiguration. In the Request Parameters, you must set the InstanceName and HostName parameters.

    For example, set InstanceName to ess-node-(AUTO_INCREMENT)[0,3] and HostName to ess-node-(AUTO_INCREMENT)[0,3]-ecshost.

    Note

    The naming rule used in this example is increment by fixed value. For more information, see (Recommended) Increment by fixed value. If you want to generate instance names or hostnames based on dynamic sorting rules, see Dynamic sorting by extended sequential value.

  3. Call the EnableScalingGroup API operation to enable the scaling group.

    For more information, see EnableScalingGroup.

  4. Create and execute a scaling rule.

    1. Call the CreateScalingRule API operation to create a scaling rule.

      For more information, see CreateScalingRule.

      This example uses a simple rule. When the scaling rule is executed, three ECS instances are added to the scaling group.

    2. Call the ExecuteScalingRule API operation to execute the scaling rule.

      For more information, see ExecuteScalingRule.

      After the rule is executed, the three new ECS instances have the following instance names and hostnames:

      • Instance names: ess-node-000, ess-node-001, ess-node-002

      • Hostnames: ess-node-000-ecshost, ess-node-001-ecshost, ess-node-002-ecshost

(Recommended) Fixed increment sorting

The parameter format is name_prefix(AUTO_INCREMENT)[begin_number,bits]name_suffix.

Note

The rules and logic for instance names and hostnames are identical. This section uses hostname rules as an example.

Table 1. Parameters

Field

Required

Description

Example

name_prefix

Yes

The prefix of the hostname.

ess-node-

(AUTO_INCREMENT)

Yes

A fixed value that identifies this sorting method.

(AUTO_INCREMENT)

[begin_number,bits]

Yes

Specifies the sequential number for the hostname. After this parameter is set, the sequential number of the hostname increments.

Important

The [begin_number,bits] field cannot contain spaces. The number increases sequentially by default. However, if a new instance fails to start, the scaling group removes it and creates a replacement. This can result in non-consecutive hostnames (intermittent increments).

  • begin_number: The starting value of the sequential number. Valid values: 0 to 999999.

    • For the first scale-out, the specified starting value is used. If you do not specify a starting value, the default is 0.

    • For subsequent scale-outs, the number increments from the maximum sequential value among the existing hostnames in the scaling group.

  • bits: The number of digits for the sequential number. Valid values: 1 to 6. If the number of digits in the specified begin_number is greater than the value of bits, bits defaults to 6.

Note

We recommend setting bits to at least 3 to avoid reaching the upper limit too quickly. If the limit is reached, scaling activities will fail until you reconfigure the naming rule.

[0,6]

name_suffix

No

The suffix of the hostname.

-ecshost

Table 2. Parameter examples

Naming example

Maximum existing value

New hostnames

Description

ess-node-(AUTO_INCREMENT)[0,3]-ecshost

None

ess-node-000-ecshost, ess-node-001-ecshost, ess-node-002-ecshost

During the first scale-out, the number of digits in the sequential number is the value of bits. The sequential number starts from the value of begin_number and increments for each ECS instance added.

  • ess-node-(AUTO_INCREMENT)[]-ecshost

  • ess-node-(AUTO_INCREMENT)[,]-ecshost

None

ess-node-000000-ecshost, ess-node-000001-ecshost, ess-node-000002-ecshost

If you do not configure begin_number or bits, begin_number defaults to 0 and bits defaults to 6.

ess-node-(AUTO_INCREMENT)[99,1]-ecshost

ess-node-000099-ecshost

ess-node-000100-ecshost, ess-node-000101-ecshost, ess-node-000102-ecshost

  • For subsequent scale-outs, the sequential number increments from the maximum sequential value of existing hostnames in the scaling group.

  • If the number of digits in the specified begin_number is greater than the value of bits, bits defaults to 6.

ess-node-(AUTO_INCREMENT)[0,2]-ecshost

ess-node-99-ecshost

The scaling activity reports an error and stops.

  • For subsequent scale-outs, the sequential number increments from the maximum sequential value of existing hostnames in the scaling group.

  • If a scale-out is still required after the upper limit of the sequential number is reached, the scaling activity reports an error and stops. In this case, you must reconfigure the naming rule.

ess-node-(AUTO_INCREMENT)[0,4]

ess-node-0998

ess-node-0999, ess-node-1000, ess-node-1002

  • For subsequent scale-outs, the sequential number increments from the maximum sequential value of existing hostnames in the scaling group.

  • The system increases the value sequentially by default. However, if a scaled-out ECS instance (in this example, ess-node-1001) fails to start, the scaling group removes it and creates a new ECS instance. As a result, hostnames in the scaling group may increase intermittently.

Dynamic extension sorting

The parameter format is name_prefix(ess_extend_begin,ess_extend_bits)[begin_number,bits]name_suffix.

Note

The rules and logic for instance names and hostnames are identical. This section uses hostname rules as an example.

Table 3. Parameters

Field

Required

Description

Example

name_prefix

Yes

The prefix of the hostname.

ess-node-

(ess_extend_begin,ess_extend_bits)

Yes

Specifies the extended sequential number for the hostname. When the base sequential number of an existing hostname in the scaling group reaches its maximum value, this parameter is incremented by one, and the base sequential number restarts from 0. This cycle continues until the upper limit is reached.

  • ess_extend_begin: The starting value of the extended sequential number. The value can range from 0 to ZZZ. Each digit can be a value from 0 to 9, a to z, or A to Z. For example, the number after 9 is 'a', and the number after 'z' is 'A'.

    • For the first scale-out, the specified starting value is used. If you do not specify a starting value, the default is 0.

    • For subsequent scale-outs, the starting value is the maximum extended sequential value among the existing hostnames in the scaling group.

  • ess_extend_bits: The number of digits for the extended sequential number. Valid values: 1 to 3. Default value: 3.

Important

If both the extended and base sequential numbers reach their upper limits, scaling activities will fail. You must then reconfigure the naming rule.

The (ess_extend_begin,ess_extend_bits) field cannot contain spaces. If the number of digits in the specified ess_extend_begin is greater than the value of bits, bits defaults to 3.

(0,3)

[begin_number,bits]

Yes

Specifies the base sequential number for the hostname. This parameter increments to its maximum value. On the next scale-out, the extended parameter is incremented by one, and this parameter restarts from 0. This cycle continues until the upper limit is reached.

Important

The system increases the value sequentially by default. However, if a scaled-out ECS instance fails to start, the scaling group removes it and then creates a new ECS instance. As a result, hostnames of ECS instances within the scaling group may increase intermittently.

  • begin_number: The starting value of the base sequential number. Valid values: 0 to 999999.

    • For the first scale-out, the specified starting value is used. If you do not specify a starting value, the default is 0.

    • For subsequent scale-outs, the number increments from the maximum base sequential value among the existing hostnames in the scaling group.

  • bits: The number of digits for the base sequential number. Valid values: 1 to 6. Default value: 6.

Important
  • If the sum of the maximum base sequential number of existing hostnames and the number of ECS instances to be scaled out is greater than or equal to the maximum value of the base sequential number, the ECS hostnames may increase non-consecutively (that is, intermittently). To avoid this, we recommend that you configure the number of digits for the base sequential number to be at least 3.

  • If a scale-out is required after both the extended and base sequential numbers have reached their upper limits, the scaling activity reports an error and stops. In this case, you must reconfigure the naming rule.

The [begin_number,bits] field cannot contain spaces. If the number of digits in the specified begin_number is greater than the value of bits, bits defaults to 6.

[0,6]

name_suffix

No

The suffix of the hostname.

-ecshost

Table 4. Parameter examples

Naming example

Maximum existing value

New hostnames

Description

ess-node-(0,3)[0,3]-ecshost

None

ess-node-000000-ecshost, ess-node-000001-ecshost, ess-node-000002-ecshost

For the first scale-out:

  • Extended sequential number: The number of digits is the value of ess_extend_bits, and the starting value is ess_extend_begin. If the base sequential number reaches its maximum value, the extended number is incremented, and the base number restarts from 0.

  • Base sequential number: The number of digits is the value of bits. The value starts from begin_number and increments for each ECS instance added. If the base number reaches its maximum value, the extended number is incremented, and the base number restarts from 0.

  • ess-node-()[]-ecshost

  • ess-node-(,)[,]-ecshost

None

ess-node-000000000-ecshost, ess-node-000000001-ecshost, ess-node-000000002-ecshost

  • Extended sequential number: If you do not configure ess_extend_begin or ess_extend_bits, ess_extend_begin defaults to 0, and ess_extend_bits defaults to 3.

  • Base sequential number: If you do not configure begin_number or bits, begin_number defaults to 0, and bits defaults to 6.

ess-node-(0,1)[0,1]-ecshost

ess-node-08-ecshost

ess-node-10-ecshost, ess-node-11-ecshost, ess-node-12-ecshost

  • For subsequent scale-outs, the base sequential number increments from the maximum base sequential value of existing hostnames in the scaling group.

  • If the sum of the maximum base sequential value of existing hostnames and the number of ECS instances to be scaled out is greater than or equal to the maximum value of the base sequential number, the ECS hostnames may increase non-consecutively (that is, intermittently). To avoid this, we recommend that you configure the number of digits for the base sequential number to be at least 3.

ess-node-(0,1)[0,1]-ecshost

ess-node-Z9-ecshost

The scaling activity reports an error and stops.

  • For subsequent scale-outs, the base sequential number increments from the maximum base sequential value of existing hostnames in the scaling group.

  • If a scale-out is required after both the extended and base sequential numbers have reached their upper limits, the scaling activity reports an error and stops. In this case, you must reconfigure the naming rule.

ess-node-(0,1)[0,3]

ess-node-0099

ess-node-0100, ess-node-0101, ess-node-0103

  • For subsequent scale-outs, the base sequential number increments from the maximum base sequential value of existing hostnames in the scaling group.

  • The system increases the value sequentially by default. However, if a scaled-out ECS instance (in this example, ess-node-0102) fails to start, the scaling group removes it and creates a new ECS instance. As a result, hostnames in the scaling group may increase intermittently.

ess-node-(0,1)[99,1]-ecshost

ess-node-0000099-ecshost

ess-node-0000100-ecshost, ess-node-0000101-ecshost, ess-node-0000102-ecshost

  • For subsequent scale-outs, the base sequential number increments from the maximum base sequential value of existing hostnames in the scaling group.

  • If begin_number has more digits than bits, bits defaults to 6.