Parameters improves the flexibility and reusability of a template. When creating a resource stack, define parameter values according to your needs.

For example, a web application needs a resource stack that contains one Server Load Balancer (SLB) instance, two Elastic Cloud Service (ECS) instances, and one ApsaraDB for RDS (RDS) instance. If the web application has a high workload, you can select an ECS instance with a higher configuration when creating the resource stack. Otherwise, you can select an ECS instance with a lower configuration for the job. The following is an example of how to define the ECS instance type parameters:

"Parameters" : {
  "InstanceType": {
    "Type" : "String",
    "AllowedValues":["ecs.t1.small","ecs.s1.medium","ecs.m1.medium", "ecs.c1.large"],
    "Default": "ecs.t1.small",
    "Label": "ECS instance type",
    "Description" : "Select a type for the ECS instance. The default value is ecs.t1.small. Valid values are: ecs.t1.small, ecs.s1.medium, ecs.m1.medium, and ecs.c1.large."

In the example, InstanceType allows you to assign a value when creating a resource stack using the template. If no value is assigned, the default value ecs.t1.small is used.

You can reference InstanceType when defining a resource:

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


Each parameter consists of a parameter name and parameter attributes. The parameter name can only contain letters and numbers and must be unique within the same template. You can use the Label field to define user-friendly parameter names.

Parameter attribute list:

Attribute Required Description
Type Yes

Parameter data type


String, such as "ecs.s1.medium"


Integer or floating-point number, such as 3.14.


A group of strings or numbers separated by commas (,), which can be indexed and referenced using Fn::Select. For example: "80, foo, bar".


A JSON string, such as { "foo": "bar " }.


A Boolean value, such as true or false.

Default No If you do not specify a value when creating a resource stack, Resource Orchestration Service (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 A list of valid parameter values.
AllowedPattern No A regular expression that is used to check whether the input for a parameter is a string. If the input is not a string, an error is returned.
MaxLength No An integer that defines the maximum number of characters that the value of a String parameter can have.
MinLength No An integer that defines the minimum number of characters that the value of a String parameter can have.
MaxValue No An integer that defines the maximum value that the value of a Number parameter can have.
MinValue No An integer that defines the minimum value that the value of a Number parameter can have.
NoEcho No Whether to return the parameter value when querying the resource stack. If it is set to true, only asterisks (**) are printed.
Description No Strings that describes the parameter.
ConstraintDescription No Description of parameter constraints.
Label No Parameter alias with UTF-8 support. When generating web forms using templates, labels can be mapped to parameter names since they are more user-friendly.
AssociationProperty No Used to automatically verify the validity of the parameter value and provide a list of valid values. Format: "ROS resource type:property" (spaces are not allowed). For example, "ALIYUN::ECS::Instance:ImageId" means the parameter can be referenced by the ImageId property of the resource type ALIYUN::ECS::Instance. The ROS console verifies whether the image ID specified is available and lists other values using a drop-down list. Currently, only Image ID verification is supported.
Confirm No Whether the parameter requires verification by user input when NoEcho is set to true. Default value is false. Note: When this parameter is set to true, you can only couple it with String parameters with NoEcho set to true.


In the following example, two parameters are defined.

  • username is of the String type, with a default value of anonymous. The minimum length is 6 and the maximum length is 12, with anonymous, user-one, and user-two as allowed values.
    Notice The default value of username must also meet the length and allowed value requirements.
  • password is of the String type with no default value. NoEcho is set to true to prevent GetStack from obtaining the parameter value. The minimum length is 1, and the maximum length is 41. Uppercase and lowercase letters and numbers are allowed.
"Parameters" : {
"username": {
"Label": "Username",
"Description" : "Please enter your username",
"Default": "anonymous",
"Type" : "String",
"MinLength" : "6",
"MaxLength" : "12",
"AllowedValues": ["anonymous", "user-one", "user-two"]
"password" : {
"Label": "Password",
"NoEcho": "True",
"Description": "Please enter your 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 at resource orchestration runtime. These are the pseudo parameters currently supported:

  • ALIYUN::StackName: name of the current resource stack.
  • ALIYUN::StackId: ID of the current resource stack.
  • ALIYUN::Region: region of the current resource stack.
  • ALIYUN::AccountId: user ID of the current resource stack.
  • ALIYUN::NoValue: deletes a property of a resource when it is created or updated.