All Products
Search
Document Center

CloudOps Orchestration Service:GetTemplate

Last Updated:Oct 26, 2026

Retrieves a template, including its content.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

oos:GetTemplate

get

*template

acs:oos:{#regionId}:{#accountId}:template/{#templateName}

  • oos:tag
  • oos:TLSVersion
None

Request parameters

Parameter

Type

Required

Description

Example

RegionId

string

No

The region ID.

cn-hangzhou

TemplateName

string

Yes

The template name. The name can contain only letters, digits, hyphens (-), and underscores (_), and can be up to 200 characters in length.

MyTemplate

TemplateVersion

string

No

The template version. Format: "v" followed by a number. Valid values: v1 to v200.

v1

Response elements

Element

Type

Description

Example

object

Content

string

The template content.

"FormatVersion: OOS-2019-06-01\nDescription:\n en: Creates an ECS image\n zh-cn: Create an ECS image\n name-en: Create Image\n name-zh-cn: Create Image\n categories:\n - image_manage\n - application_manage\nParameters:\n regionId:\n Type: String\n Label:\n en: RegionId\n zh-cn: Region ID\n AssociationProperty: RegionId\n Default: '{{ ACS::RegionId }}'\n instanceId:\n Label:\n en: InstanceId\n zh-cn: ECS Instance ID\n Type: String\n AssociationProperty: ALIYUN::ECS::Instance::InstanceId\n AssociationPropertyMetadata:\n RegionId: regionId\n imageName:\n Label:\n en: ImageName\n zh-cn: New Image Name\n Type: String\n Description:\n en:

Note:

  • Length is 2~128 English or Chinese characters
  • must start with big or small letters or Chinese, not http:// and https://.
  • Can contain numbers, colons (:), underscores (_), or dashes (-).
\n zh-cn:

Note:

  • The name must be 2 to 128 characters in length.
  • It must start with a letter or a Chinese character, and cannot start with http:// or https://.
  • It can contain digits, colons (:), underscores (_), and hyphens (-).
\n tags:\n Label:\n en: Tags\n zh-cn: Image Tags\n Type: Json\n AssociationProperty: Tags\n AssociationPropertyMetadata:\n ShowSystem: false\n Default: []\n OOSAssumeRole:\n Label:\n en: OOSAssumeRole\n zh-cn: RAM Role Assumed by OOS\n Type: String\n Default: OOSServiceRole\nRamRole: '{{ OOSAssumeRole }}'\nTasks:\n- Name: createImage\n Action: ACS::ECS::CreateImage\n Description:\n en: Create new image with the specified image name and instance ID\n zh-cn: Create a new image by specifying the instance ID and image name\n Properties:\n regionId: '{{ regionId }}'\n imageName: '{{ imageName }}__on_{{ ACS::ExecutionId }}_at_{{ Acs::CurrentDate }}'\n instanceId: '{{ instanceId }}'\n tags: '{{tags}}'\n Outputs:\n imageId:\n ValueSelector: imageId\n Type: String\nOutputs:\n imageId:\n Type: String\n Value: '{{ createImage.imageId }}'\nMetadata:\n ALIYUN::OOS::Interface:\n ParameterGroups:\n - Parameters:\n - regionId\n - instanceId\n Label:\n default:\n zh-cn: Select Instances\n en: Select Ecs Instances\n - Parameters:\n - imageName\n - tags\n Label:\n default:\n zh-cn: Image Settings\n en: Image Configure\n - Parameters:\n - OOSAssumeRole\n Label:\n default:\n zh-cn: Advanced Options\n en: Control Options"

RequestId

string

The request ID.

5BBE2663-A18E-5261-9BBB-F4832F5294D9

Template

object

The template metadata.

Hash

string

The SHA-256 hash of the template content.

40fb5e3e08ef6c8a499ff7cd8441194f518028ad08338a84cb70c023a64576f1

UpdatedDate

string

The time when the template was updated. The time is displayed in ISO 8601 format in the UTC time zone.

2022-04-26T08:37:07Z

UpdatedBy

string

The user who updated the template.

ACS

TemplateType

string

The templatetype.

Automation

Tags

object

The tag keys and values. The number of key-value pairs is limited to 1 to 20.

{"k1":"k2","k2":"v2"}

TemplateName

string

The template name.

ACS-ECS-CreateImage

TemplateVersion

string

The template version. The format is "v" followed by a number, starting from 1.

v15

TemplateFormat

string

The template format. This is a system field and the value is JSON or YAML.

YAML

Description

string

The template description.

"{\"en\": \"Creates an ECS image\", \"zh-cn\": \"Create an ECS image\", \"name-en\": \"Create Image\", \"name-zh-cn\": \"Create Image\", \"categories\": [\"image_manage\", \"application_manage\"]}"

ResourceGroupId

string

The resource group ID.

rg-acfmxsn4m4******

CreatedBy

string

The user who created the template.

ACS

CreatedDate

string

The time when the template was created. The time is displayed in ISO 8601 format in the UTC time zone.

2019-05-16T10:26:14Z

VersionName

string

The version name.

version15

TemplateId

string

The template ID.

t-4bdb1745c171401883a2

HasTrigger

boolean

Indicates whether the template contains a trigger.

false

ShareType

string

The template share type. Currently, the share type of all user-created templates is Private.

Public

SharedAccounts

string

The accounts with which the template is shared.

["12345678"]

Examples

Success response

JSON format

{
  "Content": "\"FormatVersion: OOS-2019-06-01\\nDescription:\\n  en:  Creates an ECS image\\n  zh-cn: 创建一个ECS镜像\\n  name-en: Create Image\\n  name-zh-cn: 创建镜像\\n  categories:\\n    - image_manage\\n    - application_manage\\nParameters:\\n  regionId:\\n    Type: String\\n    Label:\\n      en: RegionId\\n      zh-cn: 地域ID\\n    AssociationProperty: RegionId\\n    Default: '{{ ACS::RegionId }}'\\n  instanceId:\\n    Label:\\n      en: InstanceId\\n      zh-cn: ECS实例ID\\n    Type: String\\n    AssociationProperty: ALIYUN::ECS::Instance::InstanceId\\n    AssociationPropertyMetadata:\\n      RegionId: regionId\\n  imageName:\\n    Label:\\n      en: ImageName\\n      zh-cn: 新镜像的名称\\n    Type: String\\n    Description:\\n      en: 
Note:  
Length is 2~128 English or Chinese characters 
must start with big or small letters or Chinese, not http:// and https://.  
Can contain numbers, colons (:), underscores (_), or dashes (-).  \\n      zh-cn: 
注意:  
长度为2~128个英文或中文字符 
必须以大小字母或中文开头,不能以http://和https://开头。 
可以包含数字、半角冒号(:)、下划线(_)或者短划线(-)。 \\n  tags:\\n    Label:\\n      en: Tags\\n      zh-cn: 镜像标签\\n    Type: Json\\n    AssociationProperty: Tags\\n    AssociationPropertyMetadata:\\n      ShowSystem: false\\n    Default: []\\n  OOSAssumeRole:\\n    Label:\\n      en: OOSAssumeRole\\n      zh-cn: OOS扮演的RAM角色\\n    Type: String\\n    Default: OOSServiceRole\\nRamRole: '{{ OOSAssumeRole }}'\\nTasks:\\n- Name: createImage\\n  Action: ACS::ECS::CreateImage\\n  Description:\\n    en: Create new image with the specified image name and instance ID\\n    zh-cn: 通过指定实例ID和镜像名称创建新的镜像\\n  Properties:\\n    regionId: '{{ regionId }}'\\n    imageName: '{{ imageName }}__on_{{ ACS::ExecutionId }}_at_{{ Acs::CurrentDate }}'\\n    instanceId: '{{ instanceId }}'\\n    tags: '{{tags}}'\\n  Outputs:\\n    imageId:\\n      ValueSelector: imageId\\n      Type: String\\nOutputs:\\n  imageId:\\n    Type: String\\n    Value: '{{ createImage.imageId }}'\\nMetadata:\\n  ALIYUN::OOS::Interface:\\n    ParameterGroups:\\n      - Parameters:\\n          - regionId\\n          - instanceId\\n        Label:\\n          default:\\n            zh-cn: 选择实例\\n            en: Select Ecs Instances\\n      - Parameters:\\n          - imageName\\n          - tags\\n        Label:\\n          default:\\n            zh-cn: 镜像设置\\n            en: Image Configure\\n      - Parameters:\\n          - OOSAssumeRole\\n        Label:\\n          default:\\n            zh-cn: 高级选项\\n            en: Control Options\"",
  "RequestId": "5BBE2663-A18E-5261-9BBB-F4832F5294D9",
  "Template": {
    "Hash": "40fb5e3e08ef6c8a499ff7cd8441194f518028ad08338a84cb70c023a64576f1",
    "UpdatedDate": "2022-04-26T08:37:07Z",
    "UpdatedBy": "ACS",
    "TemplateType": "Automation",
    "Tags": {
      "k1": "k2",
      "k2": "v2"
    },
    "TemplateName": "ACS-ECS-CreateImage",
    "TemplateVersion": "v15",
    "TemplateFormat": "YAML",
    "Description": "\"{\\\"en\\\": \\\"Creates an ECS image\\\", \\\"zh-cn\\\": \\\"创建一个ECS镜像\\\", \\\"name-en\\\": \\\"Create Image\\\", \\\"name-zh-cn\\\": \\\"创建镜像\\\", \\\"categories\\\": [\\\"image_manage\\\", \\\"application_manage\\\"]}\"",
    "ResourceGroupId": "rg-acfmxsn4m4******",
    "CreatedBy": "ACS",
    "CreatedDate": "2019-05-16T10:26:14Z",
    "VersionName": "version15",
    "TemplateId": "t-4bdb1745c171401883a2",
    "HasTrigger": false,
    "ShareType": "Public",
    "SharedAccounts": "[\"12345678\"]"
  }
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.