ALIYUN::ROS::Stack is used to create a nested stack. You can nest stacks up to five levels of depth.
A nested stack can contain other nested stacks. This forms a hierarchy of stacks. The root stack is the parent stack to which all the nested stacks belong. The template of the root stack is called the top-level template. You can use ALIYUN::ROS::Stack to nest a stack as a resource in a top-level template.
In the template of a nested stack, you can use an output of a stack as an input to another stack. To obtain the output of a nested stack, you can use the Fn::GetAtt function and configure the name of the nested stack and the output name in the Outputs.NestedStackOutputName format for the function. For more information, see Use nested stacks.
Syntax
{
"Type": "ALIYUN::ROS::Stack",
"Properties": {
"TemplateURL": String,
"TemplateBody": String,
"TemplateId": String,
"TemplateVersion": String,
"TimeoutMins": Number,
"Parameters": Map,
"ResourceGroupId": String,
"Tags": List
}
}
Properties
Property | Type | Required | Editable | Description | Constraint |
TemplateURL | String | No | Yes | The URL of the file that contains the template body. | The file that contains the template body can be up to 524,288 bytes in length. The URL can be up to 1,024 bytes in length. The URL must point to a template that is located on an HTTP or HTTPS web server or in an Object Storage Service (OSS) bucket, such as If you do not specify the region ID of the OSS bucket, the region ID of the stack is used. You must specify one of the |
TemplateBody | Map | No | Yes | The template content that is used to facilitate template delivery. | The content is raw data. Functions in the template content take effect only for the child templates. You must specify one of the |
TemplateId | String | No | Yes | The template ID. | You must specify one of the |
TemplateVersion | String | No | Yes | The name of the template version. | None. |
TimeoutMins | Number | No | Yes | The timeout period for creating or updating the parent stack. | Unit: minutes. Default value: 60. |
Parameters | Map | No | Yes | A set of key-value pairs that represent the parameters passed to Resource Orchestration Service (ROS) when the nested stack is created. | Each key and value in this property corresponds to a parameter name and a parameter value that are defined in the template of the nested stack. This property must be specified when the nested stack requires input parameters. |
ResourceGroupId | String | No | No | The ID of the resource group. | None. |
Tags | List | No | Yes | The tags. | You can specify up to 20 tags. For more information, see Tags properties. |
Tags syntax
"Tags": [
{
"Key": String,
"Value": String
}
]
Tags properties
Property | Type | Required | Editable | Description | Constraint |
Key | String | Yes | No | The tag key. | The tag key can be up to 128 characters in length. It cannot start with |
Value | String | No | No | The tag value. | The tag value can be up to 128 characters in length. It cannot start with |
Return values
Fn::GetAtt
You can use the following code to obtain the output of a nested stack:
{
"Fn::GetAtt": [
"<nested_stack>",
"Outputs.<nested_stack_output_name>"
]
}
If you use Ref
to reference resources of a nested stack, the Alibaba Cloud Resource Name (ARN) of the nested stack is returned. Example: arn:acs:ros::cn-hangzhou:12345****:stacks/test-nested-stack-Demo-jzkyq7mn****/e71c1e04-1a57-46fc-b9a4-cf7ce0d3****
.
Examples
The following sample code provides YAML and JSON examples on how to create a child stack. In the child stack, a virtual private cloud (VPC), a vSwitch, and a security group are created. The template of the child stack is stored in the oss://ros/template/vpc.txt directory.
The following sample code provides YAML and JSON examples on how to create a parent stack: