Stack Template Syntax
Stack template is a UTF8-encoded file.
You can quickly create a resource stack based on a stack template. With a stack template, you can define what cloud resources you need, the dependency between the resources, and the resource configuration. CloudFormation analyzes the stack template and automatically creates and configures all resources.
Stack Template Structure
The stack template structure is as
follows.
{
"ZStackTemplateFormatVersion" : "YYYY-MM-DD",
"Description" : "The description of the stack template, which is used to provide information such as application scenarios and the structure of the stack template.",
"Parameters" : {
// The parameters you can specify when creating a resource stack.
},
"Mappings" : {
// The mapping tables. Mapping tables are nested tables.
},
"Resources" : {
// The detailed information of resources, including configurations and dependencies.
},
"Outputs" : {
// The outputs that are used to provide useful information such as resource properties. You can use API to obtain this information.
}ZStackTemplateFormatVersion(Required)The version of the stack template.- Format:
YYYY-MM-DD
- Format:
Description(Optional)The description of the stack template, which is used to provide information such as application scenarios and the structure of the stack template.- A detailed description can help users better understand the content of the stack template.
Parameters(Optional)The parameters you can specify when creating a resource stack.- For example, an instance offering is often defined as a parameter.
- Parameters have default values.
- Parameters can improve the flexibility and reusability of the stack template.
- For more information about Parameters, see the Parameters topic.
Mappings(Optional)The mapping tables. Mapping tables are nested tables.- You can use
Fn::FindInMapto select values through corresponding keys. - You can use parameter values as keys.
- For example, you can search the region-image mapping table for desired images by region.
- For more information about Mappings, see the Mappings topic.
- You can use
Resources(Optional)The detailed information of resources, including configurations and dependencies.- For more information about Resources, see the Resources topic.
Outputs(Optional)The outputs that are used to provide useful information such as resource properties. You can use API to obtain this information.- For more information about Outputs, see the Outputs topic.