Template structure

更新时间:
复制 MD 格式

A template is a UTF-8 encoded JSON or YAML file that defines Alibaba Cloud resources, their configurations, and dependencies. You use templates to create stacks.

ROS template structure

ROSTemplateFormatVersion: '2015-09-01'
Description: Describes the template. Use this section to explain the template's scenarios, architecture, and more.
# Metadata about the template, such as layout information for visualization.
Metadata: 
# Defines customizable parameters that users can specify when creating a stack.  
Parameters: 
# Defines a mapping table. A mapping is a multilayer map structure.
Mappings: 
# Defines conditions using intrinsic conditional functions. These conditions determine when to create associated resources.
Conditions: 
# Defines the required resources in detail, including dependencies and configuration details.
Resources: 
# Outputs useful information, such as resource properties. The output can be retrieved from the console or by calling an API.
Outputs: 
# Validates parameter values passed to the template when a stack is created or updated.
Rules: 

ROSTemplateFormatVersion (Required)

The ROS template version. Current version: 2015-09-01.

Description (Optional)

Describes the template. Use this section to explain scenarios, architecture, or other details.

Metadata (Optional)

Stores template metadata in JSON format, such as layout information for visualization.

Parameters (Optional)

Defines customizable parameters for stack creation. Parameters support default values, increasing template reusability. For example, you can parameterize ECS instance types to select different configurations per stack.

Parameters.

Mappings (Optional)

Defines a multilayer mapping table. Use the Fn::FindInMap function to look up values by key. For example, you can look up a region-to-image mapping to find the correct image for a region.

Mappings.

Conditions (Optional)

Defines conditions using functions such as Fn::And, Fn::Or, Fn::Not, and Fn::Equals. Separate multiple conditions with commas (,). During stack creation or update, ROS evaluates all conditions and only creates resources whose condition is true.

Conditions.

Resources (Optional)

Declares the resources in the stack, their dependencies, and configuration details.

Resources.

Outputs (Optional)

Declares values to return after stack creation, such as resource properties. You can retrieve outputs from the console or through API operations.

Outputs.

Rules (Optional)

Validates parameter values passed to the template during stack creation or update.

Rules.

Related operations

Write a template.