• Resource Template Service

rts
  1. Help Center
  2. Resource Template Service
  3. User Guide
  4. Getting Started with CLIs
  5. Creating a Random String

Creating a Random String

Creating a stack that contains only a random string.

  1. Before creating a stack, create the required template.

    For example, create the following template named random_string.yaml:

    heat_template_version: 2014-10-16
    
    description: create random string
    
    resources:
      my_instance:
        type: OS::Heat::RandomString

    In the template:

    heat_template_version: specifies the version number. This field is mandatory.

    description: provides supplementary information about the template content. This field is optional.

    resources: specifies the resources to be created. Supported resource types are listed in Table 1. For details about how to configure each resource type in the template, see chapter Resource Template Types.

  2. Install Heat client.

    For details, see CLI Overview.

  3. On the Heat client, import required environment variables.

    NOTE:

    The environment variables in the following commands are for reference only. You need to import the environment variables based on your system settings.

    export OS_USERNAME="user_name" 
    export OS_USER_DOMAIN_NAME=user_domain_name 
    export OS_PASSWORD=******* 
    export TENANT_ID=********
    
    # Only change these for a different region
    export OS_TENANT_NAME=az1 
    export OS_PROJECT_NAME=az1 
    export OS_AUTH_URL=https://iam.az1.domainname.com:443/v3
    
    # No changes needed beyond this point
    export NOVA_ENDPOINT_TYPE=publicURL 
    export OS_ENDPOINT_TYPE=publicURL 
    export CINDER_ENDPOINT_TYPE=publicURL 
    export OS_VOLUME_API_VERSION=2 
    export OS_IDENTITY_API_VERSION=3 
    export OS_IMAGE_API_VERSION=2

    Table 1 lists the environment variables to be configured.

    Table 1 Environment variables

    Parameter

    Description

    OS_USERNAME

    This value is the username for logging in to the management console.

    OS_USER_DOMAIN_NAME

    The value is the enterprise account used for logging in to the management console.

    OS_PASSWORD

    The value is the password used for logging in to the management console.

    TENANT_ID

    Specifies the project ID displayed on the Project List tab on the My Credential page.

    OS_TENANT_NAME

    Specifies the project name displayed on the Project List tab on the My Credential page.

    OS_PROJECT_NAME

    The value is the same as the OS_TENANT_NAME value.

    OS_AUTH_URL

    The parameter value is in the format of https://IAM URL:Port number/API version, for example, https://iam.example.com:443/v3.

  4. Run the following command to create a resource:

    heat stack-create -f TemplateFile StackName

    • TemplateFile specifies the name of the template file to be used.
    • StackName specifies the name of the stack instance to be created. This name is customizable.

    For example, run the following command to create statck random_string using the random_string.yaml template:

    heat stack-create -f random_string.yaml random_string

  5. Perform the following operations to check whether the stack is successfully created:

    • Run the following command to query all existing stacks and check whether the new stack is displayed:

      heat stack-list

    • (Optional) Run the following command to view details of the new stack:

      heat stack-show StackName

      For example, run the following command:

      heat stack-show random_string