Creates a template for a scenario.

This topic describes how to create a template for a scenario. In this topic, the ts-aa9c62feab844a6b**** scenario of the Resource Management type in the China (Hangzhou) region is used.


OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes GenerateTemplateByScratch

The operation that you want to perform. Set the value to GenerateTemplateByScratch.

RegionId String Yes cn-hangzhou

The ID of the region in which the scenario is created.

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

TemplateScratchId String Yes ts-aa9c62feab844a6b****

The ID of the scenario.

For more information about how to query the IDs of scenarios, see ListTemplateScratches.

ProvisionRegionId String No cn-hangzhou

The ID of the region to which the new node belongs.

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

Response parameters

Parameter Type Example Description
RequestId String D22C1D13-D74E-558C-AF68-1B4C05FA6F1A

The ID of the request.

TemplateBody String {\"ROSTemplateFormatVersion\": \"2015-09-01\", \"Resources\": {\"ECSVPC_001\": {\"DeletionPolicy\": \"Retain\", \"Type\": \"ALIYUN::ECS::VPC\", \"Properties\": {\"CidrBlock\": \"\", \"VpcName\": \"MyTestVpc\", \"EnableIpv6\": false}}}}

The content of the template that is created for the scenario.

ResourcesToImport Array of ResourceToImport

The resources that you want to import to a stack in the scenario of the Resource Management type.

Note This parameter is returned only for scenarios of the Resource Management type.
ResourceType String ALIYUN::ECS::VPC

The type of the resource.

LogicalResourceId String ECSVPC_001

The ID of the logical resource.

ResourceIdentifier Map

The key-value mappings from string to string. The parameter value is a JSON string that identifies the resource that is imported.

A key is an identifier for a resource, and a value is an assignment of data to the key. For example, VpcId is a key that indicates the ID of a virtual private cloud (VPC), and vpc-bp1m6fww66xbntjyc****" is a value that is assigned to VpcId.


Sample requests

&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK

    <TemplateBody>{"ROSTemplateFormatVersion": "2015-09-01", "Resources": {"ECSVPC_001": {"DeletionPolicy": "Retain", "Type": "ALIYUN::ECS::VPC", "Properties": {"CidrBlock": "", "VpcName": "MyTestVpc", "EnableIpv6": false}}}}</TemplateBody>

JSON format

HTTP/1.1 200 OK

  "RequestId" : "D22C1D13-D74E-558C-AF68-1B4C05FA6F1A",
  "ResourcesToImport" : [ {
    "ResourceIdentifier" : {
      "VpcId" : "vpc-bp1m6fww66xbntjyc****"
    "LogicalResourceId" : "ECSVPC_001",
    "ResourceType" : "ALIYUN::ECS::VPC"
  } ],
  "TemplateBody" : "{\"ROSTemplateFormatVersion\": \"2015-09-01\", \"Resources\": {\"ECSVPC_001\": {\"DeletionPolicy\": \"Retain\", \"Type\": \"ALIYUN::ECS::VPC\", \"Properties\": {\"CidrBlock\": \"\", \"VpcName\": \"MyTestVpc\", \"EnableIpv6\": false}}}}"

Error codes

For a list of error codes, visit the API Error Center.