A template is a JSON file encoded using UTF-8. It is used to create stacks and serves as the blueprint for the underlying infrastructure and architecture. Templates define the configurations and dependencies of Alibaba Cloud resources.

ROS template structure

{
  "ROSTemplateFormatVersion" : "2015-09-01",

  "Description" : "The description of the template, which is used to provide information such as application scenarios and architecture of the template.",
  "metadata" : {
    // The template metadata that provides information such as layout for visualizations.
  },
  "Parameters" : {
    // The parameters you can specify when creating a stack.
  },

  "Mappings": {
    // The mapping tables. Mapping tables are nested tables.
  },

  "Conditions": {
    // The conditions defined using internal condition functions. These conditions determine when to create associated resources.
  },

  "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 the ROS console or API to obtain this information.
  }
}
			

ROSTemplateFormatVersion

The template versions supported by ROS. Current version: 2015-09-01.

(Optional) Description

The description of the template, which is used to provide information such as the application scenarios and architecture of the template. A detailed description can help users better understand the content of the template.

(Optional) Metadata

The metadata of the template, in JSON format.

(Optional) Parameters

The parameters you can specify when creating a stack. An ECS instance type is often defined as a parameter. Parameters have default values. Parameters can improve the flexibility and reusability of the template. When you create a stack, select a suitable specification based on your needs.

For more information, see Parameters.

(Optional) Mappings

Mappings are defined as nested mapping tables. You can use Fn::FindInMap to select values through corresponding keys. You can also use parameter values as keys. For example, you can search the region-image mapping table for desired images by region.

For more information, see Mappings.

(Optional) Condition

The conditions defined using Fn::And, Fn::Or, Fn::Not, and Fn::Equals. Separate multiple conditions with commas (,). The system evaluates all the conditions in the template before creating or updating a stack. All resources associated with true conditions are created, and all resources associated with false conditions are ignored.

For more information, see Conditions.

(Optional) Resources

The detailed information of resources in the stack that is created based on the template. This information includes resource dependencies and configurations.

For more information, see Resources.

(Optional) Outputs

The outputs that are used to provide useful information such as resource properties. You can use the ROS console or API to obtain this information.

For more information, see Outputs.