The Parameters section improves the flexibility and reusability of a template. When creating a stack, you can specify parameter values as needed.

For example, a web application requires a stack that contains one Server Load Balancer (SLB) instance, two Elastic Compute Service (ECS) instances, and one ApsaraDB for RDS instance. If the web application has a heavy workload, you can select an ECS instance with a higher specification when creating the stack. Otherwise, you can select an ECS instance with a lower specification. The following example shows how to define the ECS instance type parameter:

"Parameters" : {
  "InstanceType" : {
    "Type" : "String",
    "AllowedValues":["ecs.t1.small","ecs.s1.medium", "ecs.m1.medium", "ecs.c1.large"],
    "Default": "ecs.t1.small",
    "Label": "The ECS instance type",
    "Description" : "The type of the ECS instance you want to create. Default value: ecs.t1.small. Valid values: ecs.t1.small, ecs.s1.medium, ecs.m1.medium, and ecs.c1.large."

The value of the InstanceType parameter can be specified when you create stacks based on templates. If this parameter is not specified, the default value ecs.t1.small is used.

The following example shows how to reference the InstanceType parameter when you define a resource:

"Webserver" : {
  "Type" : "ALIYUN::ECS::Instance",
  "InstanceType": {
    "Ref": "InstanceType"


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.

Parameter properties

Property Required Description
Type Yes

The data type of the parameter.


A string value. Example: "ecs.s1.medium".


An integer or floating-point number. Example: 3.14.


A group of strings or numbers separated with commas (,), which can be indexed using Fn::Select. Example: "80, foo, bar".


A JSON string. Example: { "foo": "bar" }.


A Boolean value. Example: true or false.

Default No If you do not specify a value when creating a stack, ROS checks whether a default value is defined in the template. If a default value is found, it is used. Otherwise, an error is returned.
AllowedValues No The list of valid parameter values.
AllowedPattern No The regular expression that is used to check whether the value of a parameter is a string. If the input is not a string, an error is returned.
MaxLength No The integer that specifies the maximum length of a parameter value that is of the string type.
MinLength No The integer that specifies the minimum length of a parameter value that is of the string type.
MaxValue No The integer that specifies the maximum length of a parameter value that is of the number type.
MinValue No The integer that specifies the minimum length of a parameter value that is of the number type.
NoEcho No Specifies whether to return parameter values when the GetStack operation is called. If this parameter is set to true, only asterisks (**) are provided.
Description No The string that describes the parameter.
ConstraintDescription No The description of the parameter constraints.
Label No The alias name of the parameter, encoded in UTF-8. When web forms are generated using templates, labels can be mapped to parameter names.
AssociationProperty No Specifies that the validity of a parameter value is automatically verified and valid values for the parameter are provided. This parameter must be specified in the "ROS resource type:property" format (spaces are not allowed). For example, "ALIYUN::ECS::Instance:ImageId" indicates that the parameter can be referenced by the ImageId property of the ALIYUN::ECS::Instance resource type. The ROS console verifies whether the specified image ID is available and lists other values in a drop-down list. Only ImageId verification is supported.
Confirm No Specifies whether to enter the parameter value for a second time when the NoEcho parameter is set to true. Default value: false. Note that this parameter can be set to true only when you use it with string type parameters and the NoEcho parameter is set to true.


In the following example, two parameters are defined.

  • username: a string type parameter with a default value of anonymous. Valid values: anonymous, user-one, and user-two. The username must contain 6 to 12 characters in length.
    Notice The default value must also meet the length and valid values requirements.
  • password: a string type parameter with no default value. If you set the NoEcho parameter to true, the GetStack operation does not return any parameter values. The password must contain 1 to 41 characters in length and can contain letters and digits.
"Parameters" : {
"username" : {
"Label": "Username",
"Description" : "Enter the username",
"Default": "anonymous",
"Type" : "String",
"MinLength" : "6",
"MaxLength" : "12",
"AllowedValues": ["anonymous", "user-one", "user-two"]
"password" : {
"Label": "Password",
"NoEcho" : "True",
"Description" : "Enter the password",
"Type" : "String",
"MinLength" : "1",
"MaxLength" : "41",
"AllowedPattern" : "[a-zA-Z0-9]*"

Pseudo parameters

Pseudo parameters are internal parameters provided by the ROS engine. They can be referenced like user-defined parameters and their values are determined while ROS is running. Supported pseudo parameters are as follows:

  • ALIYUN::StackName: the name of the stack.
  • ALIYUN::StackId: the ID of the stack.
  • ALIYUN::Region: the region where the stack resides.
  • ALIYUN::AccountId: the user ID of the stack.
  • ALIYUN::NoValue: specifies that a specific resource property is deleted when the resource is created or updated.