All Products
Search
Document Center

Resource Orchestration Service:UpdateTemplateScratch

Last Updated:Jun 03, 2026

Updates a scenario.

Operation description

Resource replication scenario

Resource Orchestration Service (ROS) allows you to update a resource replication scenario. The updates that you make to a resource replication scenario do not affect the stack that is generated by using the resource scenario. You can call the GenerateTemplateByScratch operation to generate a template for the resource scenario.

Resource migration scenario

  • If you want to update a resource migration scenario in which the migrated source resources are retained, you can delete the source resources to manage the updated resource migration scenario. You can also call the GenerateTemplateByScratch operation to generate a template for the resource scenario.

    **

    Note Make sure that the source resources that you want to delete from a resource migration scenario are associated only with the resource scenario. Otherwise, the source resources fail to be deleted.

  • If you want to update a resource migration scenario in which the migrated source resources are deleted, you can only call the GenerateTemplateByScratch operation to generate a template for the resource scenario.

Resource management scenario

If you want to update a resource management scenario after you use the resource scenario to manage resources, you can only call the GenerateTemplateByScratch operation to generate a template for the resource scenario.

Resource detection scenario

After you update a resource detection scenario, ROS obtains the most recent data from Resource Center and renders the architecture diagram.

This topic provides an example on how to update a resource scenario. In this example, the ID of a virtual private cloud (VPC) in a resource scenario whose ID is ts-7f7a704cf71c49a6**** is updated to vpc-bp1m6fww66xbntjyc****.

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:UpdateTemplateScratch

update

*TemplateScratch

acs:ros:{#regionId}:{#accountId}:templatescratch/{#templatescratchId}

None None

Request parameters

Parameter

Type

Required

Description

Example

RegionId

string

Yes

The region ID of the scenario.

You can call the DescribeRegions operation to query the most recent region list.

cn-hangzhou

TemplateScratchId

string

Yes

The ID of the resource scenario.

The valid values of the ParameterKey and ParameterValue request parameters vary based on the IDs of different types of resource scenarios. For more information, see the "Additional information about request parameters" section of this topic.

Note

You can call the ListTemplateScratches operation to query the ID of a resource scenario.

ts-7f7a704cf71c49a6****

Description

string

No

The description of the scenario.

Copy VPC resources.

SourceResources

array<object>

No

The source resources.

Note

You must specify only one of the following parameters: SourceResources, SourceTag, and SourceResourceGroup.

object

No

The source resource.

ResourceId

string

Yes

The resource ID.

vpc-bp1m6fww66xbntjyc****

ResourceType

string

Yes

The resource type.

ALIYUN::ECS::VPC

SourceTag

object

No

The source tag.

Note

You must specify only one of the following parameters: SourceResources, SourceTag, and SourceResourceGroup.

ResourceTags

object

Yes

The source tags. A tag contains a tag key and a tag value.

If you want to specify only the tag key, you must leave the tag value empty. Example: {"TagKey": ""}.

If you set TemplateScratchType to ArchitectureDetection, you can add up to 5 source tags. In other cases, you can add up to 10 source tags.

{"a": "b"}

ResourceTypeFilter

array

No

The resource types for filtering resources.

string

No

The resource type for filtering resources. If you specify the resource types, ROS scans only the resources that are of the specified types and have the specified tags. If you do not specify the resource types, ROS scans all resources that have the specified tags.

You can specify up to 20 resource types.

ALIYUN::ECS::VPC

SourceResourceGroup

object

No

The source resource group.

Note

You must specify only one of the following parameters: SourceResources, SourceTag, and SourceResourceGroup.

ResourceGroupId

string

Yes

The ID of the source resource group.

rg-acfmzawhxxc****

ResourceTypeFilter

array

No

The resource types for filtering resources.

string

No

The resource type for filtering resources. If you specify the resource types, ROS scans only the resources that are of the specified types and belong to the specified resource group. If you do not specify the resource types, ROS scans all resources that belong to the specified resource group.

You can specify up to 20 resource types.

ALIYUN::ECS::VPC

PreferenceParameters

array<object>

No

The preference parameters of the resource scenario.

object

No

The preference parameter of the scenario.

ParameterKey

string

Yes

The parameter name.

For more information about the valid values of ParameterKey, see the "Additional information about request parameters" section of this topic.

Note
  • PreferenceParameters is optional. If you specify PreferenceParameters, you must specify both ParameterKey and ParameterValue.

  • If you set TemplateScratchType to ResourceImport, you must set ParameterKey to DeletionPolicy.

DeletionPolicy

ParameterValue

string

Yes

The parameter value. The value of ParameterValue varies based on the value of ParameterKey.

For more information about the valid values of ParameterKey, see the "Additional information about request parameters" section of this topic.

Note

PreferenceParameters is optional. If you specify PreferenceParameters, you must specify both ParameterKey and ParameterValue.

Retain

LogicalIdStrategy

string

No

The policy based on which the logical ID is generated. Valid values:

  • LongTypePrefixAndIndexSuffix: long-type prefix + index-type suffix

  • LongTypePrefixAndHashSuffix: long-type prefix + hash-type suffix

  • ShortTypePrefixAndHashSuffix: short-type prefix + hash-type suffix

Note

If you set TemplateScratchType to ArchitectureDetection, the default value of LogicalIdStrategy is LongTypePrefixAndHashSuffix. In other cases, the default value of LogicalIdStrategy is LongTypePrefixAndIndexSuffix.

LongTypePrefixAndIndexSuffix

ClientToken

string

No

The client token that is used to ensure the idempotence of the request. You can use the client to generate the token, but you must make sure that the token is unique among different requests. The token can contain only ASCII characters and cannot exceed 64 characters in length.

For more information, see How to ensure idempotence.

123e4567-e89b-12d3-a456-42665544****

ExecutionMode

string

No

The execution mode. Valid values:

  • Async (default)

  • Sync

Note

If you have a wide scope of resources, Sync takes longer. If you set ExecutionMode to Sync, we recommend that you specify ClientToken to prevent the execution timeout.

Sync

ResourceGroupId

string

No

The ID of the resource group.

rg-acfmxazb4ph6aiy****

Additional information about request parameters

For more information about common request parameters, see Common parameters.

The valid values of the ParameterKey and ParameterValue request parameters vary based on resource scenario types.

Resource replication scenario

The following table describes the valid values of the ParameterKey and ParameterValue request parameters when you set TemplateScratchId to the ID of a resource replication scenario.

ParameterKeyParameterValue
DeletionPolicyThe deletion policy for resources. Valid values:Retain: retains resources when you delete the stack to which the resources are replicated.Delete: deletes resources by default when you delete the stack to which the resources are replicated. If you retain specific resources when the Delete Stack dialog box appears, the resources are retained.
RegionIdThe ID of the destination region to which you want to replicate resources. If you leave this parameter empty, the region of the source resources is used for the replicated resources.Example: cn-shanghai.
ZoneIdThe ID of the destination zone to which you want to replicate resources. If you replicate resources in the same region and you leave this parameter empty, the zone of the source resources is used for the replicated resources. If you replicate resources across regions and you leave this parameter empty, the system filters the zones that are supported by all resources.Example: cn-shanghai-b.
VpcIdThe ID of the destination VPC to which you want to replicate resources. If you replicate resources in the same region and you leave this parameter empty, the VPC of the source resources is used for the replicated resources. If you replicate resources across regions and you leave this parameter empty, the system automatically creates a VPC in the destination region.Example: vpc-bp1hye0s8b69xokfu****.
VSwitchIdThe ID of the destination vSwitch to which you want to replicate resources. If you replicate resources in the same region and you leave this parameter empty, the vSwitch of the source resources is used for the replicated resources. If you replicate resources across regions and you leave this parameter empty, the system automatically creates a vSwitch in the destination region.Example: vsw-bp11ufkwqwggtm1cj****.
InstanceDataReplicationSpecifies whether to replicate Elastic Compute Service (ECS) instance data. Valid values:true: replicates ECS instance data. If you replicate the data in the same region, the system creates a custom image for the source instance and creates an instance based on the image. If you replicate the data across regions, the system creates a custom image for the source instance, replicates the image to the destination region, and then creates an instance based on the image.false: does not replicate ECS instance data.

Note If you set ParameterKey to InstanceDataReplication and ParameterValue to true, we recommend that you replicate resources after the source instance is stopped. This ensures data consistency.

Resource management scenario

The following table describes the valid values of the ParameterKey and ParameterValue request parameters when you set TemplateScratchId to the ID of a resource management scenario.

Note For a resource management scenario, you must set ParameterKey to DeletionPolicy.

ParameterKeyParameterValue
DeletionPolicyThe deletion policy for resources. Valid values:Retain: retains resources when you delete the stack that you use to manage the resources.Delete: deletes resources by default when you delete the stack that you use to manage the resources. If you retain specific resources when the Delete Stack dialog box appears, the resources are retained.

Resource detection scenario

The following table describes the valid values of the ParameterKey and ParameterValue request parameters when you set TemplateScratchId to the ID of a resource detection scenario.

ParameterKeyParameterValue
RegionIdsOne or more region IDs. Separate multiple region IDs with commas (,). If you leave this parameter empty, the region of the resource scenario is used. You cannot specify both RegionIds and SourceResources.

Response elements

Element

Type

Description

Example

object

RequestId

string

The ID of the request.

221DA822-B8CF-50DF-A9D2-BA197BF97BD5

TemplateScratchId

string

The ID of the scenario.

ts-7f7a704cf71c49a6****

Examples

Success response

JSON format

{
  "RequestId": "221DA822-B8CF-50DF-A9D2-BA197BF97BD5",
  "TemplateScratchId": "ts-7f7a704cf71c49a6****"
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.