Parameters

The parameters you can specify when creating a resource stack.
  • When you create a stack template, you can use parameters to improve the flexibility and reusability of the stack template.
  • When you create a resource stack, you can specify parameter values as needed.

Syntax

Each parameter consists of a name and properties.
  • The parameter name can only contain letters and digits and must be unique in the template.
  • You can use the Label field to define user-friendly parameter names.
The properties of Parameters are as follows.
Property Description Required Example
Type The parameter type. Options:
  • String
  • Number (An integer or floating-point number)
  • CommaDelimitedList (List<String> in Java equivalently)
  • Boolean
Yes "Type": "String"
Label The alias of the parameter. When forms are previewed or generated using templates, labels can be mapped to parameter names. No "Label": "The password of the VM instance"
Description The string that describes the parameter. No "Description": "The login password of the VM instance"
NoEcho Specifies whether to mask a parameter value as asterisks (*****). If you set this property to true, CloudFormation returns the parameter value masked as asterisks (*****). No "NoEcho": true
Note: This property cannot be configured currently.
DefaultValue The default value of the parameter. No "DefaultValue": "password"
CloudFormation also provides some pseudo parameters.
  • Pseudo parameters are parameters that are predefined by CloudFormation. They can be referenced directly. You do not need to declare them in Parameters. (You are actually not allowed to declare them.)
  • The values of the pseudo parameters are determined when CloudFormation is running.
Supported pseudo parameters are as follows.
Pseudo Parameter Name Description
ZStack::StackName The name of the current resource stack
ZStack::StackUuid The UUID of the current resource stack
ZStack::AccountUuid The AccountUuid of the current resource stack
ZStack::AccountName The AccountName of the current resource stack

Example

The following example shows the Parameters syntax.
"Parameters" : {
  "username" : {
    "Label": "Login name",
    "Description" : "Login name",
    "DefaultValue": "root",
    "Type" : "String"
  },
  "password" : {
    "Label": "Password",
    "NoEcho" : "true",
    "Description" : "Login password",
    "Type" : "String",
  }
}
In this example, two parameters are declared in Parameters.
  • username
    • A string type parameter with a default value of root.
    • The username must contain 2 to 12 characters.
    Note: The default value of username must also meet the length and valid values requirements.
  • password
    • A string type parameter with no default value.
    • If you set NoEcho to true, CloudFormation returns the parameter value masked as asterisks (*****).
      Note: The NoEcho property cannot be configured currently.
    • The password must contain 6 to 41 characters.
    • The password can contain uppercase/lowercase letters and digits.