All Products
Search
Document Center

Resource Orchestration Service:Control the length of a random string

Last Updated:Jun 17, 2026

Resource Orchestration Service (ROS) can automatically generate a random string of a specified length by using the AutoCompleteInput association property.

In the Parameters section of a template, set AssociationProperty to AutoCompleteInput and configure the Length, Prefix, and CharacterClasses properties in AssociationPropertyMetadata to control the generated string. For more information, see AssociationProperty and AssociationPropertyMetadata.

{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
    "RandomName": {
      "Type": "String",
      "Label": {
        "en": "Random Name"
      },
      "AssociationProperty": "AutoCompleteInput",
      "AssociationPropertyMetadata": {
        "Length": 5,
        "Prefix": "test-ros",
        "CharacterClasses": [
          {
            "Class": "lowercase",
            "min": 1
          }
        ]
      }
    }
  },
  "Outputs": {
    "RandomNameStr": {
      "Value": {
        "Ref": "RandomName"
      }
    }
  }
}

Console example

On the stack details page in the ROS console, click the Outputs tab to view the stack output. The output key is RandomNameStr, and its value is test-rostpfjb.