Creates a stack from a ROS template to deploy a group of resources.
Operation description
A stack is the management unit for ROS resources (Overview). Limits:
-
Each Alibaba Cloud account can create up to 200 stacks.
-
Each stack can contain up to 200 resources.
The following example creates a stack named MyStack in the China (Hangzhou) region with TemplateBody set to {"ROSTemplateFormatVersion":"2015-09-01"}.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
ros:CreateStack |
create |
*Stack
Template
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| DisableRollback |
boolean |
No |
Specifies whether to disable rollback when stack creation fails. Valid values:
|
false |
| TemplateBody |
string |
No |
The template body. Length: 1 to 524,288 bytes. Use HTTP POST with Body parameters for large content to avoid URL length limits. Note
You must specify only one of the following parameters: TemplateBody, TemplateURL, TemplateId, or TemplateScratchId. |
{"ROSTemplateFormatVersion":"2015-09-01"} |
| StackPolicyURL |
string |
No |
The URL of the stack policy file. Supports HTTP, HTTPS, and OSS URLs (for example, oss://ros/stack-policy/demo or oss://ros/stack-policy/demo?RegionId=cn-hangzhou). Maximum file size: 16,384 bytes. If no OSS region is specified, the RegionId value is used. Note
You can specify only one of the following parameters: StackPolicyBody or StackPolicyURL. Maximum URL length: 1,350 bytes. |
oss://ros-stack-policy/demo |
| TimeoutInMinutes |
integer |
No |
The stack creation timeout. Unit: minutes.
|
10 |
| StackPolicyBody |
string |
No |
The stack policy body. Length: 1 to 16,384 bytes. Note
You can specify only one of the following parameters: StackPolicyBody or StackPolicyURL. |
{"Statement": [{"Action": "Update:*", "Resource": "*", "Effect": "Allow", "Principal": "*"}]} |
| StackName |
string |
Yes |
The stack name. Maximum length: 255 characters. Must start with a letter and can contain letters, digits, hyphens (-), and underscores (_). |
MyStack |
| RegionId |
string |
Yes |
The region ID of the stack. Call DescribeRegions to query available regions. |
cn-hangzhou |
| ClientToken |
string |
No |
Ensures request idempotency. Must be client-generated and globally unique. Maximum length: 64 characters. Can contain letters, digits, hyphens (-), and underscores (_). |
123e4567-e89b-12d3-a456-42665544**** |
| TemplateURL |
string |
No |
The URL of the template file. Supports HTTP, HTTPS, and OSS URLs (for example, oss://ros/stack-policy/demo or oss://ros/stack-policy/demo?RegionId=cn-hangzhou). Maximum template size: 524,288 bytes. If no OSS region is specified, the RegionId value is used. Note
You must specify only one of the following parameters: TemplateBody, TemplateURL, TemplateId, or TemplateScratchId. |
oss://ros-template/demo |
| RamRoleName |
string |
No |
The RAM role name. ROS assumes this role for all stack API calls, even when the user has direct permissions, ensuring least-privilege access. Use a stack role. If not specified, ROS uses the role associated with the stack, or a temporary credential from your account if no role exists. Maximum length: 64 characters. |
test-role |
| DeletionProtection |
string |
No |
Specifies whether to enable deletion protection on the stack. Valid values:
Note
The deletion protection of a nested stack is the same as that of its root stack. |
Enabled |
| CreateOption |
string |
No |
The post-creation behavior for the stack. Valid values:
Note
You can specify only one of the following parameters: CreateOption or CreateOptions. |
KeepStackOnCreationComplete |
| CreateOptions |
array |
No |
The creation options for the stack. |
|
|
string |
No |
Creation option N. Valid values:
Note
|
KeepStackOnCreationComplete |
|
| TemplateId |
string |
No |
The template ID. This parameter applies to shared and private templates. Note
You must specify only one of the following parameters: TemplateBody, TemplateURL, TemplateId, or TemplateScratchId. |
5ecd1e10-b0e9-4389-a565-e4c15efc**** |
| TemplateVersion |
string |
No |
The version of the template. This parameter takes effect only when you specify TemplateId. |
v1 |
| Parameters |
array<object> |
No |
The parameters that are defined in the template. |
|
|
object |
No |
|||
| ParameterKey |
string |
Yes |
The name of parameter N defined in the template. If you do not specify the name and value of a parameter, ROS uses the default value in the template. The maximum value of N is 200. The name must be 1 to 128 characters and cannot start with Note
Parameters is an optional parameter. To specify Parameters, you must specify both Parameters.N.ParameterKey and Parameters.N.ParameterValue. |
InstanceId |
| ParameterValue |
string |
Yes |
The value of parameter N defined in the template. The maximum value of N is 200. The value must be 0 to 128 characters and cannot start with Note
Parameters is an optional parameter. To specify Parameters, you must specify both Parameters.N.ParameterKey and Parameters.N.ParameterValue. |
i-xxxxxx |
| NotificationURLs |
array |
No |
The callback URL for stack events. Valid values:
Note
Supported regions: China (Hangzhou), China (Shanghai), China (Beijing), China (Hong Kong), and China (Zhangjiakou). Maximum value of N: 5. ROS sends notifications on stack status changes, except for IN_PROGRESS events. With rollback enabled, CREATE_ROLLBACK and ROLLBACK events replace CREATE_FAILED and UPDATE_FAILED notifications. Notifications always include Outputs. Example notification:
|
http://my-site.com/ros-event |
|
string |
No |
The callback URL for stack event N. Valid values:
Note
Supported regions: China (Hangzhou), China (Shanghai), China (Beijing), China (Hong Kong), and China (Zhangjiakou). Maximum value of N: 5. ROS sends notifications on stack status changes, except for IN_PROGRESS events. With rollback enabled, CREATE_ROLLBACK and ROLLBACK events replace CREATE_FAILED and UPDATE_FAILED notifications. Notifications always include Outputs. Example notification:
|
http://example.com/ros-event |
|
| Tags |
array<object> |
No |
The tags of the stack. |
|
|
object |
No |
|||
| Key |
string |
Yes |
The key of tag N of the stack. Valid values: 1 to 20. Note
|
usage |
| Value |
string |
No |
The value of tag N of the stack. Valid values: 1 to 20. Note
Stack tags propagate to taggable resources. Tag propagation. |
test |
| ResourceGroupId |
string |
No |
The ID of the resource group. If not specified, the stack is added to the default resource group. |
rg-acfmxazb4ph6aiy**** |
| Parallelism |
integer |
No |
The maximum number of concurrent operations on resources. Default: empty. Accepts integers greater than or equal to 0. Note
|
1 |
| TemplateScratchId |
string |
No |
The ID of the resource scenario. Call ListTemplateScratches to query resource scenario IDs. Note
You must specify only one of the following parameters: TemplateBody, TemplateURL, TemplateId, or TemplateScratchId. |
ts-aa9c62feab844a6b**** |
| TemplateScratchRegionId |
string |
No |
The region ID of the resource scenario. Default value: the value of RegionId. Call DescribeRegions to query available regions. |
cn-hangzhou |
This operation uses Common parameters.
Response elements
|
Element |
Type |
Description |
Example |
|
object |
|||
| RequestId |
string |
The request ID. |
B288A0BE-D927-4888-B0F7-B35EF84B6E6F |
| StackId |
string |
The stack ID. |
4a6c9851-3b0f-4f5f-b4ca-a14bf691**** |
Examples
Success response
JSON format
{
"RequestId": "B288A0BE-D927-4888-B0F7-B35EF84B6E6F",
"StackId": "4a6c9851-3b0f-4f5f-b4ca-a14bf691****"
}
Error codes
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.