Help Center/ Elastic Cloud Server/ User Guide (Kuala Lumpur Region)/ FAQs/ ECS Management/ Hostnames/ How Can I Set Sequential ECS Names When Creating Multiple ECSs?
Updated on 2024-04-19 GMT+08:00

How Can I Set Sequential ECS Names When Creating Multiple ECSs?

Scenarios

When creating multiple ECSs at the same time, you can use either of the following methods to sequentially name the ECSs:

  • Automatic naming: The system automatically adds a hyphen followed by a four-digit incremental number to the end of each ECS name.
  • Customizable naming: You can customize a naming rule in the format "name_prefix[begin_number,bits]name_suffix". The system will automatically name the ECSs according to naming rule you specify.

This section describes how to use the two methods to name ECSs.

Automatic Naming

You can customize the name according to the following naming rules: The name must contain 1 to 64 characters that can be only letters, digits, underscores (_), and hyphens (-).

  • Example 1: If there is no existing ECS and you enter ecs-f526, the ECSs will be named ecs-f526-0001, ecs-f526-0002, ecs-f526-0003, ....
  • Example 2: If there is an ECS named ecs-f526-0010 and you enter ecs-f526, the ECSs will be named ecs-f526-0011, ecs-f526-0012, ecs-f526-0013, ....
  • Example 3: If there is an ECS named ecs-0010 and you select Allow duplicate ECS name, all the ECSs will be named ecs-0010.

Customizable Naming

You can customize a naming rule in the format "name_prefix[begin_number,bits]name_suffix". The system will automatically name the ECSs according to naming rule you specify.

Field Description for a Customizable Naming Rule

Figure 1 shows the format of a customizable naming rule.

Figure 1 Format of a customizable naming rule

Table 1 describes these parameters.

Table 1 Parameters in a customizable naming rule

Field

Mandatory

Description

Example

name_prefix

Yes

ECS name prefix

The name prefix can contain only letters, digits, underscores (_), and hyphens (-).

ecs

[begin_number,bits]

Yes

Sequence numbers that increase in ascending order to differentiate multiple ECSs.

[0,4]

name_suffix

No

ECS name suffix

The name suffix can contain only letters, digits, underscores (_), and hyphens (-).

f526

Table 2 [begin_number,bits] parameters

Field

Mandatory

Description

Example

begin_number

No

Begin number of ECS names.

The begin number ranges from 0 to 9999. The default value is 0.

0

bits

No

Number of bits for the sequential numbers in ECS names.

The value ranges from 1 to 4. The default value is 4.

4

Notes on Using Customizable Naming
  • Customized names cannot be duplicate.
  • No space is allowed in [begin_number,bits].
  • If the bits of "Begin number + Number of ECSs to be created - 1" is greater than the specified bits, the bits of "Begin number + Number of ECSs to be created - 1" will be used.

    For example, if [begin_number,bits] is set to [8,1] and the number of ECSs to be created is 2, the bits of "Begin number + Number of ECSs to be created - 1" is the same as the specified bits (1). Then, the ECSs will be named name_prefix8name_suffix and name_prefix9name_suffix.

    If [begin_number,bits] is set to [8,1] and the number of ECSs to be created is 3, the specified bits is 1, the bits of "Begin number + Number of ECSs to be created - 1" (value 10, bits 2) is different from the specified bits (1). Therefore, the bits of "Begin number + Number of ECSs to be created - 1" will be used, which is 2.

    The ECSs will be named name_prefix08name_suffix, name_prefix09name_suffix, and name_prefix10name_suffix.

  • If the value of "Begin number + Number of ECSs to be created" is greater than the maximum value 9999, the sequential numbers that exceed 9999 will consistently to be 9999.
  • If [begin_number,bits] is set to [] or [,], the begin number starts from 0, and the number of bits is 4 by default.
  • If [begin_number,bits] is set to [99] or [99,], the begin number starts from 99, and the number of bits is 4 by default.
Customizable Naming Examples
  • Example 1: If you select customizable naming and enter name_prefix[,]name_suffix,

    The ECSs will be named name_prefix0000name_suffix, name_prefix0001name_suffix, name_prefix0002name_suffix, ....

  • Example 2: If you select customizable naming and enter name_prefix[]name_suffix,

    The ECSs will be named name_prefix0000name_suffix, name_prefix0001name_suffix, name_prefix0002name_suffix, ....

  • Example 3: If you select customizable naming and enter name_prefix[9,]name_suffix,

    The ECSs will be named name_prefix0009name_suffix, name_prefix0010name_suffix, name_prefix0011name_suffix, ....

  • Example 4: If you select customizable naming and enter name_prefix[,3]name_suffix,

    The ECSs will be named name_prefix000name_suffix, name_prefix001name_suffix, name_prefix002name_suffix, ....

  • Example 5: If you select customizable naming and enter name_prefix[8]name_suffix,

    The ECSs will be named name_prefix0008name_suffix, name_prefix0009name_suffix, name_prefix0010name_suffix, ....

  • Example 6: If you select customizable naming and enter name_prefix[9999]name_suffix,

    All the ECSs will be named name_prefix9999name_suffix.

  • Example 7: If you select customizable naming and enter name_prefix[8],

    The ECSs will be named name_prefix0008, name_prefix0009, name_prefix0010, ....