All Products
Search
Document Center

CloudOps Orchestration Service:GetTemplate

Last Updated:Dec 26, 2025

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 ID of the region.

cn-hangzhou

TemplateName

string

Yes

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

MyTemplate

TemplateVersion

string

No

The version of the template. The format is v followed by a number. Valid values: v1 to v200.

v1

Response elements

Element

Type

Description

Example

object

Content

string

The content of the template.

"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

string

The ID of the request.

5BBE2663-A18E-5261-9BBB-F4832F5294D9

Template

object

The metadata of the template.

Hash

string

The SHA-256 hash of the template content.

40fb5e3e08ef6c8a499ff7cd8441194f518028ad08338a84cb70c023a64576f1

UpdatedDate

string

The time when the template was updated.

2022-04-26T08:37:07Z

UpdatedBy

string

The user who updated the template.

ACS

TemplateType

string

The type of the template.

Automation

Tags

object

The tags of the template. A maximum of 20 key-value pairs are supported.

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

TemplateName

string

The name of the template.

ACS-ECS-CreateImage

TemplateVersion

string

The version of the template. The format is v followed by a number that starts from 1.

v15

TemplateFormat

string

The format of the template. This is a system field. Valid values: JSON and YAML.

YAML

Description

string

The description of the template.

"{\"en\": \"Creates an ECS image\", \"zh-cn\": \"创建一个ECS镜像\", \"name-en\": \"Create Image\", \"name-zh-cn\": \"创建镜像\", \"categories\": [\"image_manage\", \"application_manage\"]}"

ResourceGroupId

string

The ID of the resource group.

rg-acfmxsn4m4******

CreatedBy

string

The user who created the template.

ACS

CreatedDate

string

The time when the template was created.

2019-05-16T10:26:14Z

VersionName

string

The name of the version.

version15

TemplateId

string

The ID of the template.

t-4bdb1745c171401883a2

HasTrigger

boolean

Indicates whether the template contains a trigger.

false

ShareType

string

The share type of the template. The share type of a user-created template 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:  \\n      zh-cn:  \\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.