All Products
Search
Document Center

Resource Orchestration Service:UpdateTemplate

Last Updated:Jun 03, 2026

Update Template

Operation description

When updating a template, please note:

  • If you specify TemplateBody or TemplateURL, the template version will be incremented by 1 after a successful update. For example, the version changes from v1 to v2.

  • If neither TemplateBody nor TemplateURL is specified, the template version remains unchanged.

  • A template can have up to 100 versions. If the version limit is reached, the template update will fail, and you need to recreate the template.

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

ros:UpdateTemplate

update

*template

acs:ros:{#regionId}:{#accountId}:template/{#templateId}

None None

Request parameters

Parameter

Type

Required

Description

Example

TemplateURL

string

No

The location of the file containing the template body. The URL must point to a template located on a web server (HTTP or HTTPS) or in an Alibaba Cloud OSS bucket (e.g., oss://ros/template/demo, oss://ros/template/demo?RegionId=cn-hangzhou), with a maximum size of 524,288 bytes.

Note

If the OSS region is not specified, it defaults to the same as the RegionId parameter in the request.

You can only specify one of TemplateBody or TemplateURL.
The maximum length of the URL is 1,024 bytes.

oss://ros/template/demo

TemplateName

string

No

The name of the template.
The length should not exceed 255 characters (utf-8 encoding), and it must start with a number, letter, or Chinese character. It can include numbers, letters, Chinese characters, hyphens (-), and underscores (_).

MyTemplate

Description

string

No

The description of the template. The maximum length is 256 characters.

It is a demo.

TemplateBody

string

No

The structure of the template body. The length should be between 1 and 524,288 bytes. If the content is long, it is recommended to use HTTP POST + Body Param to pass the parameter in the request body to avoid request failure due to an overly long URL.

Note

You must and can only specify one of TemplateBody, TemplateURL, TemplateId, or TemplateScratchId.

{"ROSTemplateFormatVersion":"2015-09-01"}

TemplateId

string

Yes

The template ID. Supports both shared and private templates.

5ecd1e10-b0e9-4389-a565-e4c15efc****

ValidationOptions

array

No

Validation options.

By default, no options are enabled, and strict validation is performed.

string

No

Validation options. Values:

  • BasicValidation: Only performs basic structural validation on the template content.

BasicValidation

RotateStrategy

string

No

Template version rotation strategy. Values:

  • None (default): No rotation. An error occurs when the version limit is reached.

  • DeleteOldestNonSharedVersionWhenLimitExceeded: Rotates and deletes non-shared template versions.

Note
  • If all versions of the template are shared, they cannot be rotated and deleted.

  • The current latest version will not be rotated and deleted.

  • Regardless of whether rotation deletion is used, the template version number cannot exceed v65000.

None

IsDraft

boolean

No

Whether to update the Draft (draft) version. Values:

  • false (default): If template content is provided, a new version is created, and the Draft version is cleared. Otherwise, the current latest version is modified.

  • true: Modifies the Draft version. The Draft version can only be retrieved via the GetTemplate interface. The ListTemplateVersions interface will not return it. The TemplateVersion parameter in other interfaces cannot specify Draft.

false

For details on common request parameters, see Common Parameters.

Response elements

Element

Type

Description

Example

object

RequestId

string

Request ID.

8C5D90E1-66B6-496C-9371-3807F8DA80A8

TemplateId

string

Template ID.

5ecd1e10-b0e9-4389-a565-e4c15efc****

TemplateVersion

string

The template version affected by this operation.

v2

Examples

Success response

JSON format

{
  "RequestId": "8C5D90E1-66B6-496C-9371-3807F8DA80A8",
  "TemplateId": "5ecd1e10-b0e9-4389-a565-e4c15efc****",
  "TemplateVersion": "v2"
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.