ALIYUN::OOS::Template类型用于创建模版。

语法

{
  "Type": "ALIYUN::OOS::Template",
  "Properties": {
    "Content": String,
    "TemplateName": String,
    "Tags": Map
  }
}

属性

属性名称 类型 必须 允许更新 描述 约束
Content String 模板内容。 JSON或YAML格式,长度限制为 64 KB。
TemplateName String 模板名称。 内容限制为字母、数字、中划线、下划线,最大长度200个字符,且不能以ALIYUN、ACS、ALIBABA、ALICLOUD开头。
Tags Map 标签,由键值对组成。例如:{“k1”:”v1”,”k2”:”v2”}。 最多支持20个键值对。

返回值

Fn::GetAtt

  • TemplateId:模板ID。
  • TemplateName:模板名称。
  • ExecutionPolicy:执行策略。

示例

JSON格式:
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Resources": {
    "Template": {
      "Type": "ALIYUN::OOS::Template",
      "Properties": {
        "Content": {
          "Ref": "Content"
        },
        "Tags": {
          "Ref": "Tags"
        },
        "TemplateName": {
          "Ref": "TemplateName"
        }
      }
    }
  },
  "Parameters": {
    "Content": {
      "Type": "String",
      "Description": "The content of the template. The template must be in the JSON or YAML format. Maximum size: 64 KB.",
      "MaxLength": 65536
    },
    "Tags": {
      "Type": "Json",
      "Description": "Tag value and the key mapping, the label of the key number can be up to 20.",
      "MaxLength": 20
    },
    "TemplateName": {
      "Type": "String",
      "Description": "The name of the template. The template name can be up to 200 characters in length. The name can contain letters, digits, hyphens (-), and underscores (_). It cannot start with ALIYUN, ACS, ALIBABA, or ALICLOUD.",
      "MaxLength": 200
    }
  },
  "Outputs": {
    "ExecutionPolicy": {
      "Description": "Execution Policy",
      "Value": {
        "Fn::GetAtt": [
          "Template",
          "ExecutionPolicy"
        ]
      }
    },
    "TemplateName": {
      "Description": "Template Name",
      "Value": {
        "Fn::GetAtt": [
          "Template",
          "TemplateName"
        ]
      }
    },
    "TemplateId": {
      "Description": "Template ID",
      "Value": {
        "Fn::GetAtt": [
          "Template",
          "TemplateId"
        ]
      }
    }
  }
}
YAML格式:
ROSTemplateFormatVersion: '2015-09-01'
Resources:
  Template:
    Type: ALIYUN::OOS::Template
    Properties:
      Content:
        Ref: Content
      Tags:
        Ref: Tags
      TemplateName:
        Ref: TemplateName
Parameters:
  Content:
    Type: String
    Description: 'The content of the template. The template must be in the JSON or
      YAML format. Maximum size: 64 KB.'
    MaxLength: 65536
  Tags:
    Type: Json
    Description: Tag value and the key mapping, the label of the key number can be
      up to 20.
    MaxLength: 20
  TemplateName:
    Type: String
    Description: The name of the template. The template name can be up to 200 characters
      in length. The name can contain letters, digits, hyphens (-), and underscores
      (_). It cannot start with ALIYUN, ACS, ALIBABA, or ALICLOUD.
    MaxLength: 200
Outputs:
  ExecutionPolicy:
    Description: Execution Policy
    Value:
      Fn::GetAtt:
      - Template
      - ExecutionPolicy
  TemplateName:
    Description: Template Name
    Value:
      Fn::GetAtt:
      - Template
      - TemplateName
  TemplateId:
    Description: Template ID
    Value:
      Fn::GetAtt:
      - Template
      - TemplateId