You can call this operation to update a stack.

Debugging

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 UpdateStack

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

RegionId String Yes cn-beijing

The region ID of the stack. You can call the DescribeRegions operation to query the most recent region list.

StackId String Yes 4a6c9851-3b0f-4f5f-b4ca-a14bf691f2ff

The ID of the stack.

Parameters.N.ParameterKey String No InstanceId

The name of parameter N. If the name and value of the parameter are not specified, the name and value specified in the template are used.

Maximum value of N: 200.

Parameters.N.ParameterValue String No i-xxxxxx

The value of parameter N.

Maximum value of N: 200.

ClientToken String No 123e4567-e89b-12d3-a456-426655440000

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 it is unique among different requests. It can only contain letters, digits, hyphens (-), and underscores (_) and cannot exceed 64 characters in length. For more information, see How to 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.

To update protected resources, specify a temporary overriding stack policy during this update. If you do not specify a stack policy, the current policy that is associated with the stack will be used.

This parameter takes effect only when the ChangeSetType parameter is set to UPDATE. You can specify only one of the following parameters:

  • StackPolicyBody
  • StackPolicyURL
  • StackPolicyDuringUpdateBody
  • StackPolicyDuringUpdateURL
TimeoutInMinutes Long No 10

The timeout period that is specified for the stack update request. Unit: minutes.

Default value: 10.

TemplateBody String No { "ROSTemplateFormatVersion": "2015-09-01" }

The structure that contains the template body. The template body must be 1 to 51,200 bytes in length.

You must specify either the TemplateBody parameter or the TemplateURL parameter. But you cannot specify both of them.

StackPolicyURL String No oss://ros-stack-policy/demo

The URL for the file that contains the stack policy. The URL must point to a policy located in an HTTP or HTTPS web server or an Alibaba Cloud OSS bucket. Examples: oss://ros/stack-policy/demo and oss://ros/stack-policy/demo?RegionId=cn-hangzhou. If the region of the OSS bucket is not specified, the RegionId parameter value is used by default. The policy can be up to 16,384 bytes in length and the URL can be up to 1,350 bytes in length.

You can specify either the StackPolicyBody parameter or the StackPolicyURL parameter. But you cannot specify both of them.

StackPolicyDuringUpdateURL String No oss://ros-stack-policy/demo

The URL for the file that contains the temporary overriding stack policy. The URL must point to a policy located in an HTTP or HTTPS web server or an Alibaba Cloud OSS bucket. Examples: oss://ros/stack-policy/demo and oss://ros/stack-policy/demo?RegionId=cn-hangzhou. If the region of the OSS bucket is not specified, the RegionId parameter value is used by default. The policy can be up to 16,384 bytes in length and the URL can be up to 1,350 bytes in length.

To update protected resources, specify a temporary overriding stack policy during this update. If you do not specify a stack policy, the current policy that is associated with the stack will be used.

This parameter takes effect only when the ChangeSetType parameter is set to UPDATE. You can specify only one of the following parameters: StackPolicyBody, StackPolicyURL, StackPolicyDuringUpdateBody, and StackPolicyDuringUpdateURL.

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.

You can specify either the StackPolicyBody parameter or the StackPolicyURL parameter. But you cannot specify both of them.

UsePreviousParameters Boolean No true

Specifies whether to use the values that were passed last time for the parameters that you do not specify in the current request.

DisableRollback Boolean No false

Specifies whether to disable rollback on stack creation failure. Default value: false. Valid values:

  • true: disables rollback on stack creation failure.
  • false: enables rollback on stack creation failure.
TemplateURL String No oss://ros-template/demo

The URL for the file that contains the template body. The URL must point to a template located in an HTTP or HTTPS web server or an Alibaba Cloud OSS bucket. Examples: oss://ros/template/demo and oss://ros/template/demo?RegionId=cn-hangzhou. If the region of the OSS bucket is not specified, the RegionId parameter value is used by default. The template can be up to 524,288 bytes in length.

You must specify either the TemplateBody parameter or the TemplateURL parameter. But you cannot specify both of them.

Response parameters

Parameter Type Example Description
StackId String 4a6c9851-3b0f-4f5f-b4ca-a14bf691f2ff

The ID of the stack.

RequestId String B288A0BE-D927-4888-B0F7-B35EF84B6E6F

The ID of the request.

Examples

Sample requests


http(s)://ros.aliyuncs.com/? Action=UpdateStack
&RegionId=cn-beijing
&StackId=4a6c9851-3b0f-4f5f-b4ca-a14bf691f2ff
&Parameters.1.ParameterKey=InstanceId
&Parameters.1.ParameterValue=i-xxxxxx
&<Common request parameters>

Sample success responses

XML format

<UpdateStackResponse>
      <StackId>4a6c9851-3b0f-4f5f-b4ca-a14bf691f2ff</StackId>
      <RequestId>B288A0BE-D927-4888-B0F7-B35EF84B6E6F</RequestId>
</UpdateStackResponse>

JSON format

{
	"StackId":"4a6c9851-3b0f-4f5f-b4ca-a14bf691f2ff",
	"RequestId":"B288A0BE-D927-4888-B0F7-B35EF84B6E6F"
}

Error codes

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

For more information about errors common to all operations, see Common errors.

Error code

Error message

HTTP status code

Description

CircularDependency

Circular Dependency Found: {reason}.

400

The error message returned because the template contains a circular dependency. reason indicates the specific reason.

InvalidSchema

{reason}.

400

The error message returned because the template format is incorrect. reason indicates the specific reason.

InvalidTemplateAttribute

The Referenced Attribute ({resource} {name}) is incorrect.

400

The error message returned because the resource attribute referenced in the template is incorrect. resource indicates the resource name, and name indicates the attribute name.

InvalidTemplatePropertyType

The specified value type of ({resource} {section}) is incorrect.

400

The error message returned because the type of the resource property defined in the template is incorrect. resource indicates the resource name, and section indicates the property name.

InvalidTemplateReference

The specified reference "{name}" (in {referencer}) is incorrect.

400

The error message returned because the template contains an invalid reference. name indicates the reference name, and referencer indicates the referencer name.

InvalidTemplateSection

The template section is invalid: {section}.

400

The error message returned because the template contains an invalid property. section indicates the property name.

InvalidTemplateVersion

The template version is invalid: {reason}.

400

The error message returned because the template version is incorrect. reason indicates the specific reason.

StackPolicyValidationFailed

Action denied by stack policy: {reason}.

400

The error message returned because the stack policy validation failed. reason indicates the specific reason.

StackValidationFailed

{reason}.

400

The error message returned because the stack validation failed. reason indicates the specific reason.

UnknownUserParameter

The Parameter ({name}) was not defined in template.

400

The error message returned because the specified parameter is not defined in the template. name indicates the parameter name.

UserParameterMissing

The Parameter {name} was not provided.

400

The error message returned because no value is passed into the specified parameter defined in the template. name indicates the parameter name.

StackNotFound

The Stack ({name}) could not be found.

404

The error message returned because the specified stack does not exist. name indicates the name or ID of the stack.

ActionInProgress

Stack {name} already has an action ({action}) in progress.

409

The error message returned because the specified stack has a change operation in progress. name indicates the name or ID of the stack, and action indicates the change operation.