Creates a scenario.
Operation description
You can call this operation to create a scenario that allows you to specify a resource scope on a visualized interface and easily replicate and manage the resources that you specify. For more information about scenarios, see Overview .
In this example, a scenario of the Resource Replication type is created in the China (Hangzhou) region. In the scenario, the virtual private cloud (VPC) whose ID is vpc-bp1m6fww66xbntjyc****
is replicated.
Debugging
Authorization information
The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action
policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:
- Operation: the value that you can use in the Action element to specify the operation on a resource.
- Access level: the access level of each operation. The levels are read, write, and list.
- Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
- The required resource types are displayed in bold characters.
- If the permissions cannot be granted at the resource level,
All Resources
is used in the Resource type column of the operation.
- Condition Key: the condition key that is defined by the cloud service.
- Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
Operation | Access level | Resource type | Condition key | Associated operation |
---|---|---|---|---|
ros:CreateTemplateScratch | Write |
|
| 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 |
TemplateScratchType | string | Yes | The type of the scenario. Valid values:
| ArchitectureReplication |
Description | string | No | The description of the scenario. | Replicate a VPC. |
SourceResources | object [] | No | The source resources. | |
ResourceId | string | Yes | The ID of the resource. | vpc-bp1m6fww66xbntjyc**** |
ResourceType | string | Yes | The type of the resource. | ALIYUN::ECS::VPC |
RegionId | string | No | The region ID. | cn-beijing |
SourceTag | object | No | The source tag. | |
ResourceTags | object | Yes | The source tags that consist of key-value pairs. If you want to specify only the tag key, you must leave the tag value empty. Example: You can add up to 10 source tags. | {"a": "b"} |
ResourceTypeFilter | array | No | The resource types. | |
string | No | The resource type. If you specify this parameter, only the resources of the specified type and have the specified tags are scanned. If you do not specify this parameter, all resources that have the specified tags are scanned. You can specify up to 20 resource types. | ALIYUN::ECS::VPC | |
SourceResourceGroup | object | No | The source resource group. | |
ResourceGroupId | string | Yes | The ID of the source resource group. | rg-acfmzawhxxc**** |
ResourceTypeFilter | array | No | The resource types. | |
string | No | The resource type. If you specify this parameter, only the resources of the specified type and in the specified resource group are scanned. If you do not specify this parameter, all resources in the specified resource group are scanned. You can specify up to 20 resource types. | ALIYUN::ECS::VPC | |
PreferenceParameters | object [] | No | The preference parameters of the scenario. | |
ParameterKey | string | Yes | The key of the parameter. For information about the valid values of ParameterKey, see the Additional information about request parameters section of this topic. Note
| DeletionPolicy |
ParameterValue | string | Yes | The value of the parameter. The value of ParameterValue varies based on the value of ParameterKey. For information about the valid values of ParameterValue, see the Additional information about request parameters section of this topic. Note
PreferenceParameters is optional. If you want to specify PreferenceParameters, you must specify ParameterKey and ParameterValue.
| Retain |
LogicalIdStrategy | string | No | The policy based on which the logical ID is generated. Valid values:
| 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:
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 |
Tags | object [] | No | The tags of the scenario. | |
Key | string | Yes | The tag key of the scenario. Note
Tags is optional. If you want to specify Tags, you must specify Key.
| usage |
Value | string | No | The tag value of the scenario. | test |
ResourceGroupId | string | No | The ID of the resource group. | rg-acfmxazb4ph6aiy**** |
Additional description of request parameters
For more information about common request parameters, see Common parameters.
In request parameters, the values of ParameterKey and ParameterValue vary based on the scenario types.
- The following table describes the values of ParameterKey and ParameterValue in scenarios of the Resource Replication type.
ParameterKey | ParameterValue |
---|---|
DeletionPolicy | The resource deletion policy. Valid values:- Retain: If you delete a stack after you replicate resources to the stack, the resources are retained.- Delete: If you delete a stack after you replicate resources to the stack, the resources are deleted by default. If you choose to retain specific resources when the Delete Stack dialog box appears, the resources are retained. |
RegionId | The ID of the destination region to which you want to replicate resources. If you do not specify this parameter, the ID of the current region is used by default.Example: cn-shanghai. |
ZoneId | The ID of the destination zone to which you want to replicate resources. If you do not specify this parameter, the following rules apply: If you replicate resources in the same region, the replicated resources are deployed in the zone where the source resources reside. If you replicate resources across regions, the replicated resources are deployed in the zone that is available for all the resources.Example: cn-shanghai. |
VpcId | The ID of the destination VPC to which you want to replicate resources. If you do not specify this parameter, the following rules apply: If you replicate resources in the same region, the replicated resources are deployed in the VPC to which the source resources belong. If you replicate resources across regions, a new VPC is created in the destination region.Example: vpc-bp1hye0s8b69xokfu****. |
VSwitchId | The ID of the destination vSwitch to which you want to replicate resources. If you do not specify this parameter, the following rules apply: If you replicate resources in the same region, the replicated resources are associated with the vSwitch that is used by the source resources. If you replicate resources across regions, a new vSwitch is created to associate the replicated resources in the destination region.Example: vsw-bp11ufkwqwggtm1cj****. |
InstanceDataReplication | Specifies whether to replicate the data of Elastic Compute Service (ECS) instances. Valid values:- true: If you replicate the data in the same region, a custom image is created for the source instance and a new instance is created based on the custom image. If you replicate the data across regions, a custom image is created for the source instance and replicated to the destination region. A new instance is created based on the replica of the custom image.- false |
NoteIf you set ParameterKey to InstanceDataReplication and ParameterValue to true, you must stop the source instance before you replicate the instance data to ensure data consistency.
- The following table describes the values of ParameterKey and ParameterValue in a scenario of the Resource Management type. NoteIn a scenario of the Resource Management type, you must set ParameterKey to DeletionPolicy.
ParameterKey | ParameterValue |
---|---|
DeletionPolicy | The resource deletion policy. Valid values:- Retain: If you delete a stack after you use the stack to manage resources, the resources are retained.- Delete: If you delete a stack after you use the stack to manage resources, the resources are deleted by default. If you choose to retain specific resources when the Delete Stack dialog box appears, the resources are retained. |
Response parameters
Examples
Sample success responses
JSON
format
{
"RequestId": "84980977-22F0-5421-B30D-B201311D5DCF",
"TemplateScratchId": "ts-7f7a704cf71c49a6****"
}
Error codes
For a list of error codes, visit the Service error codes.
Change history
Change time | Summary of changes | Operation | ||||
---|---|---|---|---|---|---|
2024-04-24 | The internal configuration of the API is changed, but the call is not affected | see changesets | ||||
| ||||||
2023-10-19 | The internal configuration of the API is changed, but the call is not affected | see changesets | ||||
| ||||||
2023-10-10 | The request parameters of the API has changed | see changesets | ||||
|