tencent cloud

Feedback

Batch Sequential Naming or Pattern String-Based Naming

Last updated: 2024-01-08 09:32:02

    Overview

    To allow you to name batch created instances/hosts according to a rule during creation, the features of automatically incrementing suffixed numbers and specifying pattern strings are provided.
    When you need to purchase n instances and generate instance/host names in specific forms, such as "CVM+Sequence number" (for example, CVM 1, CVM 2, and CVM 3), you can use the feature of Automatically Ascending Suffixed Numbers.
    When you need to create n instances and name specific instances/hosts with ascending numbers starting from x, you can use the feature of Specifying a Single Pattern String.
    When you need to create n instances/hosts with multiple prefixes in their names, each of which contains a specified serial number, you can use the feature of Specifying Multiple Pattern Strings.

    Application Scope

    This document applies to setting instance name and setting host name.

    Directions

    Note:
    This document uses setting instance name as an example. The procedure may vary slightly according to the name type.

    Automatically incrementing suffixed numbers

    This feature allows you to name batch purchased instances with the same prefix and automatically ascending suffixed numbers.
    Note:
    The created instances are suffixed with numbers starting from 1 by default. You cannot specify the starting number.
    The following example assumes that you have purchased three instances and want to name these instances in the form of "CVM+Sequence number" (for example, CVM 1, CVM 2, and CVM 3).
    Purchase page
    API
    1. Purchase three instances by referring to Creating Instances via CVM Purchase Page. On the Configure network and host tab page, enter the instance name in the form of Prefix+Sequence number. In this case, enter CVM as the instance name.
    
    
    2. Follow the prompts on the page and complete payment.
    In the RunInstances API, set the relevant fields:
    Instance name: set InstanceName to CVM.
    Host name: set HostName to CVM.

    Specifying pattern string

    This feature allows you to name batch purchased instances in a complex form with specified serial numbers. You can use one or more pattern strings in instance names as required.
    The instance name with a specified pattern string is in the form of {R:x}, where x indicates the starting number in generated instance names.

    Specifying one pattern string

    The following example assumes that you want to create three instances and name them with ascending numbers starting from 3.
    Purchase page
    API
    1. Purchase three instances by referring to Creating Instances via CVM Purchase Page. On the Configure network and host tab page, enter the instance name in the form of Prefix+Specified pattern string {R:x}. In this case, enter CVM{R:3} as the instance name.
    
    
    2. Follow the prompts on the page and complete payment.
    In the RunInstances API, set the relevant fields:
    Instance name: set InstanceName to CVM{R:3}.
    Host name: set HostName to CVM{R:3}.

    Specifying multiple pattern strings

    The following example assumes that you want to create three instances and name them with the cvm, Big, and test prefixes, where cvm and Big are followed by ascending numbers starting from 13 and 2, respectively. For example, their names are cvm13-Big2-test, cvm14-Big3-test, and cvm15-Big4-test, respectively.
    Purchase page
    API
    1. Purchase three instances by referring to Creating Instances via CVM Purchase Page. On the Configure network and host tab page, enter the instance name in the form of Prefix+Specified pattern string {R:x}-Prefix+Specified pattern string {R:x}-Prefix. In this case, enter cvm{R:13}-Big{R:2}-test as the instance name.
    
    
    2. Follow the prompts on the page and complete payment.
    In the RunInstances API, set the relevant fields:
    Instance name: set InstanceName to cvm{R:13}-Big{R:2}-test.
    Host name: set HostName to cvm{R:13}-Big{R:2}-test.

    Feature Verification

    After you batch create instances through automatically incrementing suffixed numbers or specifying pattern string, you can verify the feature as follows:

    Verifying instance name

    Log in to the CVM console and view the newly created instances. You can see that the batch purchased instances are named according to the rule you set as shown below:
    
    

    Verifying host name

    1. 
    Restart and log in to the CVM instance.
    
    2. Select different steps according to the instance's operating system:
    Linux instance
    Windows instance
    On the operating system UI, run the following commands:
    hostname
    Open the command line tool and run the following command:
    hostname
    3. 
    View the returned result of the hostname command.
    If the returned result is similar to the following, the setting is successful.
    cvm13-Big2-test
    4. Repeat step 1step 3 to verify other batch purchased instances.
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support