edit-icon download-icon

Template structure description

Last Updated: May 16, 2018

A template is a text file in the JSON format and encoded in UTF8. The template is used to create a resource stack and serves as the blueprint describing the infrastructure and architecture. The template editor defines creation and configuration details of Alibaba Cloud resources in the template and describes the dependency between resources.

The ROS template structure

  1. {
  2. "ROSTemplateFormatVersion" : "2015-09-01",
  3. "Description": "Template description, used to describe the application scenario and architecture of a template.",
  4. "Metadata" : {
  5. //Metadata of the template, such as the layout information used for visualization.
  6. },
  7. "Parameters" : {
  8. //Defines the parameter that can be customized by the template user when a resource stack is created.
  9. },
  10. "Mappings" : {
  11. //Defines the mapping table.
  12. },
  13. "Conditions": {
  14. //Uses internal condition functions to define conditions that determine when to create associated resources.
  15. },
  16. "Resources" : {
  17. //Detailed definition of the required resources, including the dependency between resources and configuration details.
  18. },
  19. "Outputs" : {
  20. //Defines some resource attributes and other useful information to be outputted. The output content can be obtained through APIs or the console.
  21. }
  22. }

ROSTemplateFormatVersion (required)

The template version supported by ROS. The current version number is 2015-09-01.

Description (optional)

Template description mainly describes the scenarios and architectures of templates. Normally, the comparative description of the template helps the template users understand the template content properly.

Metadata (optional)

The template editor can use Metadata to store the metadata information related to the template, the content of which can be in a free-form JSON format.

Parameters (optional)

Defines the parameter that can be customized by template users when they are creating stacks based on templates. For example, in many cases, the template editor designs an ECS instance type as a parameter, and sets default values for the parameter. When the template is used to create a resource stack, a proper ECS type can be selected according to the actual evaluation results.

For more information, see Parameters.

Mappings (optional)

Defines a multi-layer mapping table. With Fn::FindInMap function, the corresponding value of the key can be found. Use the input parameter values as the key to query mapping tables. For example, query the region-mirror mapping tables automatically according to the regions to find the proper images.

For more information, see Mappings.

Conditions (optional)

Uses Fn::And, Fn::Or, Fn::Not, and Fn::Equals to define conditions. Multiple conditions are separated by commas (,). When a stack is created or updated, the system calculates all the conditions in the template first, and then creates the resource. All resources associated with the TRUE condition are created, and all resources associated with the FALSE condition are ignored.

For more information, see Conditions.

Resources (optional)

Defines the resources contained in the resource stack, including the dependency between resources, configuration details, and other information about resources.

For more information, see Resources.

Outputs (optional)

Defines the resource attributes and other useful information to be outputted. the output content can be obtained through APIs or the console.

For more information, see Outputs.

Thank you! We've received your feedback.