Updated on 2023-12-13 GMT+08:00

Template Structure

Sample Template

# Version of the application template
tosca_definitions_version: huaweicloud_tosca_version_1_0
# Description of the application template
description: template for deploying an Elastic Cloud Server (ECS)
# Definitions of input parameters
inputs:
  image:
    description: ID of the image used by the ECS
    type: HuaweiCloud.ECS.Image.Id
  instance:
    default: 1
    description: number of ECSs to be created
  subnet:
    description: ID of the subnet to which the ECS belongs
  vpc:
    description: ID of the Virtual Private Cloud (VPC) to which the ECS belongs
mappings:
  regionMap:
    cn-east-3:
      flavor: c2.medium
      image_id: f2003c7b-99c4-4616-be19-334beaca81b1
    cn-north-1:
      flavor: c1.medium
      image_id: 42f34d95-a538-4d17-be48-e690b48c1643
    cn-south-1:
      flavor: c1.medium
      image_id: a3934478-bfeb-4a02-b257-9089779f0380
# Definitions of element objects
node_templates:
  myecs:
    type: HuaweiCloud.ECS.CloudServer
    properties:
      availabilityZone: cn-south-1a
      flavor:
        get_in_map:
          - regionMap
          - get_input: HuaweiCloud.Region
          - flavor
      imageId:
        get_in_map:
          - regionMap
          - get_input: HuaweiCloud.Region
          - image_id
      instances:
        get_input: instance
      name: my-ecs
      nics:
        - subnetId:
            get_input: subnet
      publicIP:
        eip:
          bandwidth:
            shareType: PER
            size: 1
          ipType: 5_sbgp
      rootVolume:
        size: 40
        volumeType: SATA
      vpcId:
        get_input: vpc
# Definitions of output parameters
outputs:
  ecs-eip:
    description: elastic IP address of the ECS
    value:
      get_attribute:
        - myecs
        - publicIps
  south-flavor:
    description: VM specifications of the South China region
    value:
      get_in_map:
        - regionMap
        - cn-south-1
        - flavor

Template Composition

An Application Orchestration Service (AOS) template consists of the following sections:

  1. tosca_definitions_version: (mandatory) specifies the version of the template.

    Currently, only huaweicloud_tosca_version_1_0 is supported.

  2. node_templates: (mandatory) defines the set of objects, which are all elements, to be orchestrated in a template. For more information, see node_templates.
  3. description: (optional) describes the template. The maximum length is 1024 characters.
  4. inputs: (optional) defines the input parameters used during stack creation. For more information, see inputs.
  5. outputs: (optional) defines the output parameters during stack running. For more information, see outputs.
  6. mappings: (optional) defines a mapping table. For more information, see mappings.
  7. conditions: (optional) defines conditions. For more information, see conditions.
  8. policies: (optional) defines security, monitoring, and other policies. For more information, see policies.