Updates a stack.
The values in the Parameters section vary based on the value that you specify for the UsePreviousParameters parameter in the request. If you do not add parameters that are defined in the template to the Parameters section, take note of the following items:
- UsePreviousParameters is set to false: If the template parameters have default values, the default values are used. Otherwise, you must specify values for the template parameters in the Parameters section.
- UsePreviousParameters is set to true: If you set the template parameters to specific values when you create a stack, the values are used. If you leave the template parameters empty when you create a stack but the template parameters have default values, the default values are used.
In this example, the template body of a stack whose ID is 4a6c9851-3b0f-4f5f-b4ca-a14bf691****
in the China (Beijing) region is updated to {"ROSTemplateFormatVersion": "2015-09-01"}
.
Debugging
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | UpdateStack |
The operation that you want to perform. Set the value to UpdateStack. |
StackId | String | Yes | 4a6c9851-3b0f-4f5f-b4ca-a14bf691**** |
The ID of the stack. |
ClientToken | String | No | 123e4567-e89b-12d3-a456-42665544**** |
The client token that is used to ensure the idempotence of the request. You can use the client to generate the value, but you must ensure that the value is unique among different requests. The token can be up to 64 characters in length and can contain letters, digits, hyphens (-), and underscores (_). For more information, see Ensure idempotence. |
StackPolicyDuringUpdateBody | String | No | {"Statement": [{"Effect": "Allow", "Action": "Update:*", "Principal": "*", "Resource": "*"}]} |
The structure that contains the body of the temporary overriding stack policy. The policy body must be 1 to 16,384 bytes in length. If you want to update protected resources, configure a temporary overriding stack policy during the update. If you do not configure a policy, the existing policy that is associated with the stack is used. This parameter takes effect only if you set the ChangeSetType parameter to UPDATE. You can specify only one of the following parameters:
|
TimeoutInMinutes | Long | No | 10 |
The timeout period for the update operation on the stack.
|
TemplateBody | String | No | {"ROSTemplateFormatVersion": "2015-09-01"} |
The structure that contains the template body. The template body must be 1 to 524,288 bytes in length. If the length of the template body exceeds the upper limit, we recommend that you add parameters to the HTTP POST request body to prevent request failures that are caused by excessively long URLs. Note You must specify only one of the following parameters: TemplateBody, TemplateURL,
and TemplateId.
|
StackPolicyURL | String | No | oss://ros-stack-policy/demo |
The URL of the file that contains the stack policy. The URL must point to a policy that is located on an HTTP or HTTPS web server or in an Alibaba Cloud Object Storage Service (OSS) bucket. Examples: oss://ros/stack-policy/demo and oss://ros/stack-policy/demo?RegionId=cn-hangzhou. The policy file can be up to 16,384 bytes in length. If you do not specify the region ID of the OSS bucket, the value of the RegionId parameter is used. Note You can specify the StackPolicyBody parameter or the StackPolicyURL parameter.
The URL can be up to 1,350 bytes in length. |
StackPolicyDuringUpdateURL | String | No | oss://ros-stack-policy/demo |
The URL of the file that contains the temporary overriding stack policy. The URL must point to a policy that is located on an HTTP or HTTPS web server or in an Alibaba Cloud OSS bucket. Examples: oss://ros/stack-policy/demo and oss://ros/stack-policy/demo?RegionId=cn-hangzhou. The policy file can be up to 16,384 bytes in length. Note If you do not specify the region ID of the OSS bucket, the value of the RegionId
parameter is used.
The URL can be up to 1,350 bytes in length. If you want to update protected resources, configure a temporary overriding stack policy during the update. If you do not configure a policy, the existing policy that is associated with the stack is used. This parameter takes effect only if you set the ChangeSetType parameter to UPDATE. You can specify only one of the following parameters:
|
StackPolicyBody | String | No | {"Statement": [{"Action": "Update:*", "Resource": "*", "Effect": "Allow", "Principal": "*"}]} |
The structure that contains the stack policy body. The policy body must be 1 to 16,384 bytes in length. Note You can specify the StackPolicyBody parameter or the StackPolicyURL parameter.
|
UsePreviousParameters | Boolean | No | true |
Specifies whether to use the values that you previously specified for the parameters that you do not specify in this request. Valid values:
|
RegionId | String | Yes | cn-beijing |
The region ID of the stack. You can call the DescribeRegions operation to query the most recent region list. |
DisableRollback | Boolean | No | false |
Specifies whether to roll back the update operation on the stack when the stack fails to be updated. Default value: false. Valid values:
|
TemplateURL | String | No | oss://ros-template/demo |
The URL of the file that contains the template body. The URL must point to a template that is located on an HTTP or HTTPS web server or in an Alibaba Cloud OSS bucket. The template body must be 1 to 524,288 bytes in length. Examples: oss://ros/template/demo and oss://ros/template/demo?RegionId=cn-hangzhou. If you do not specify the region ID of the OSS bucket, the value of the RegionId parameter is used. Note You must specify only one of the following parameters: TemplateBody, TemplateURL,
and TemplateId.
|
RamRoleName | String | No | test-role |
The name of the RAM role. Resource Orchestration Service (ROS) assumes the RAM role to create the stack and uses the credentials of the role to call the APIs of Alibaba Cloud services. ROS assumes the RAM role to perform operations on the stack. If you have permissions to perform operations on the stack but do not have permissions to use the role, ROS still assumes the role. Make sure that the least privileges are granted to this role. If you do not specify this parameter, ROS assumes the existing role that is associated with the stack. If no roles are available, ROS uses the temporary credentials that are generated from the credentials of your account. The name can be up to 64 bytes in length. |
ReplacementOption | String | No | Disabled |
Specifies whether to enable the replacement update feature. If you cannot change resource properties, you can enable the replacement update feature to replace the resource properties. If the replacement update feature is enabled for a resource, the resource is deleted and a new resource with a different physical ID is created. Default value: Disabled. Valid values:
Note Changes have higher priorities than replacement updates.
|
TemplateId | String | No | 5ecd1e10-b0e9-4389-a565-e4c15efc**** |
The ID of the template. This parameter applies to shared and private templates. Note You must specify only one of the following parameters: TemplateBody, TemplateURL,
and TemplateId.
|
TemplateVersion | String | No | v1 |
The version of the template. This parameter takes effect only if you specify the TemplateId parameter. |
Parameters.N.ParameterKey | String | Yes | Amount |
The name of parameter N. If you do not specify a name and a value for a parameter, ROS uses the default name and value in the template. Maximum value of N: 200. Note The Parameters parameter in Parameters.N.ParameterValue is optional. If you want to
specify Parameters, you must specify Parameters.N.ParameterKey and Parameters.N.ParameterValue.
|
Parameters.N.ParameterValue | String | Yes | 12 |
The value of parameter N. Maximum value of N: 200. Note The Parameters parameter in Parameters.N.ParameterValue is optional. If you want to
specify Parameters, you must specify Parameters.N.ParameterKey and Parameters.N.ParameterValue.
|
Tags.N.Key | String | Yes | usage |
The key of tag N that you want to add to the stack. Valid values of N: 1 to 20. Note
|
Tags.N.Value | String | No | test |
The value of tag N that you want to add to the stack. Valid values of N: 1 to 20. Note The tag of a stack is propagated to each stack resource that supports the tag feature.
For more information, see Propagate tags.
|
Parallelism | Long | No | 1 |
The maximum number of concurrent operations that can be performed on resources. This parameter takes effect only for Terraform stacks. By default, this parameter is empty. You can set this parameter to an integer greater than or equal to 0. Note
|
ResourceGroupId | String | No | rg-acfmxazb4ph6aiy**** |
The ID of the resource group. |
For more information about common request parameters, see Common parameters.
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
RequestId | String | B288A0BE-D927-4888-B0F7-B35EF84B6E6F |
The ID of the request. |
StackId | String | 4a6c9851-3b0f-4f5f-b4ca-a14bf691**** |
The ID of the stack. |
Examples
Sample requests
https://ros.aliyuncs.com/?Action=UpdateStack
&RegionId=cn-beijing
&StackId=4a6c9851-3b0f-4f5f-b4ca-a14bf691****
&TemplateBody={"ROSTemplateFormatVersion": "2015-09-01"}
&<Common request parameters>
Sample success responses
XML
format
HTTP/1.1 200 OK
Content-Type:application/xml
<UpdateStackResponse>
<StackId>4a6c9851-3b0f-4f5f-b4ca-a14bf691****</StackId>
<RequestId>B288A0BE-D927-4888-B0F7-B35EF84B6E6F</RequestId>
</UpdateStackResponse>
JSON
format
HTTP/1.1 200 OK
Content-Type:application/json
{
"StackId" : "4a6c9851-3b0f-4f5f-b4ca-a14bf691****",
"RequestId" : "B288A0BE-D927-4888-B0F7-B35EF84B6E6F"
}
Error codes
For a list of error codes, see Service error codes.
HTTP status code |
Error code |
Error message |
Description |
---|---|---|---|
400 |
CircularDependency |
Circular Dependency Found: {reason}. |
The error message returned because the template contains circular dependencies. reason indicates the cause of the error. |
400 |
InvalidSchema |
{reason}. |
The error message returned because the format of the template is invalid. reason indicates the cause of the error. |
400 |
InvalidTemplateAttribute |
The Referenced Attribute ({resource} {name}) is incorrect. |
The error message returned because the template contains an invalid reference of the resource property in the Outputs section. resource indicates the resource name, and name indicates the property name. |
400 |
InvalidTemplatePropertyType |
The specified value type of ({resource} {section}) is incorrect. |
The error message returned because the type of the resource property that is defined in a section of the template is invalid. resource indicates the resource name, and section indicates the section name. |
400 |
InvalidTemplateReference |
The specified reference "{name}" (in {referencer}) is incorrect. |
The error message returned because the template contains an invalid reference. name indicates the reference name, and referencer indicates the referrer name. |
400 |
InvalidTemplateSection |
The template section is invalid: {section}. |
The error message returned because the template contains an invalid section. section indicates the section name. |
400 |
InvalidTemplateVersion |
The template version is invalid: {reason}. |
The error message returned because the template version is invalid. reason indicates the cause of the error. |
400 |
StackPolicyValidationFailed |
Action denied by stack policy: {reason}. |
The error message returned because the stack policy fails to be validated. reason indicates the cause of the error. |
400 |
StackValidationFailed |
{reason}. |
The error message returned because the stack failed to be validated. reason indicates the cause of the error. |
400 |
UnknownUserParameter |
The Parameter ({name}) was not defined in template. |
The error message returned because the specified parameter is not defined in the template. name indicates the parameter name. |
400 |
UserParameterMissing |
The Parameter {name} was not provided. |
The error message returned because no value is specified for the parameter that is defined in the template. name indicates the parameter name. |
404 |
StackNotFound |
The Stack ({name}) could not be found. |
The error message returned because the stack does not exist. name indicates the name or ID of the stack. |
409 |
ActionInProgress |
Stack {name} already has an action ({action}) in progress. |
The error message returned because the stack has a change operation in progress. name indicates the name or ID of the stack, and action indicates the change operation. |
404 |
TemplateNotFound |
The Tempalte ({ ID }) could not be found. |
The error message returned because the template does not exist. ID indicates the ID of the template. |
404 |
TemplateNotFound |
The Template { ID } with version { version } could not be found. |
The error message returned because the template or template version does not exist. ID indicates the ID of the template, and version indicates the version of the template. |