All Products
Document Center

Update a stack

Last Updated: May 18, 2018

Call /stacks/{StackName}/{StackId} by PUT to update a stack.


  • To update a stack, specify the stack name, stack ID, and a new template along with a parameter list.

  • The template content is submitted along with the HTTP message body.

  • The system identifies the stack to be updated based on the stack name and stack ID, compares the old and the new templates, and operates resources in the two templates one by one accordingly. If the new template has a resource that does not exist in the old template, the system adds the new resource to the stack. If the new template removes a resource that exists in the old template, the system deletes the resource from the stack. If the new template modifies a resource attribute that exists in the old template, the resource attribute is updated.

  • The system only updates the resource attributes that support update. An error is returned when a resource attribute that does not support the update gets updated.

  • The stack name cannot be updated.

  • If rollback is enabled, the stack is restored to the original status, in the case of an update failure.

  • The region where the stack is created must be specified in the format of x-acs-region-id.

Request parameters

Name Location Type Required? Description
x-acs-region-id header String Yes Region where the stack is located.
StackName URI String Yes Name of the stack, which must comply with the regular expression ^[a-zA-Z][a-zA-Z0-9_.-]*$. It can contain up to 255 characters.
StackId URI String Yes Stack ID.
Template body JSON Yes Template in JSON format. Currently, the maximum template size is 512 KB by default. The parameter value is adjustable.
Parameters body JSON Yes Parameters required for stack update. The keys must be defined in the template.
DisableRollback body Boolean No Whether to disable rollback when the stack update fails. “True” indicates that rollback is disabled. That is, rollback is not performed when the stack update fails. “False” indicates that rollback is not disabled. That is, rollback is performed when the stack update fails.
TimeoutMins body Integer Yes Timeout time for stack update, in minutes. The default value is 60.

Return parameters

Name Parameter type Description
Id String Stack ID, which is globally unique.
Name String Stack name.

Error codes

Error code Description HTTP status code Meaning
InternalError Server error. 500 Server-side unknown exception.
NotSupported %(feature)s is not supported. 404 Unsupported parameter.
InvalidTemplateVersion Template version was not provided. 400 Invalid template version.
InvalidTemplateVersion Ambiguous versions (%s). 400 Invalid template version.
InvalidTemplateSection The Parameter (%(key)s) has no attributes. 400 Incorrect template attributes.
StackValidationFailed Each Resource must contain a Type key. 400 Resources must contain the Type attribute.
StackValidationFailed Resources must contain Resource. Found a [%s] instead. 400 Resources must contain Resource.
StackValidationFailed Invalid deletion policy “%s”. 400 Invalid deletion policy.
StackValidationFailed “%s” deletion policy not supported. 400 Invalid deletion policy.
StackValidationFailed Unknown Property %s. 400 Unknown property.
InvalidSchemaError Property %(prop)s: %(ua)s and %(im)s cannot both be True. 400 Incorrect template format.


Request example

  1. PUT HTTP/1.1
  2. x-acs-signature-method: HMAC-SHA1
  3. Authorization: acs <AccessKeyId>:<signature>
  4. Date: Fri, 11 Sep 2015 05:28:47 GMT
  5. Content-MD5: 4eCVDLNDI0GRJMiZ6mLmgw==
  6. x-acs-signature-version: 1.0
  7. Accept: application/octet-stream
  8. Content-Type: application/json;charset=utf-8
  9. x-acs-version: 2015-09-01
  10. Cache-Control: no-cache
  11. Pragma: no-cache
  12. x-acs-region-id:cn-beijing
  13. Host:
  14. Connection: keep-alive
  15. Content-Length: 502
  16. {
  17. Parameters”:
  18. {
  19. key”: value
  20. },
  21. Template”:<template text>,
  22. DisableRollback”: true,
  23. TimeoutMins”: 15
  24. }

Response example

  1. HTTP/1.1 200 OK
  2. Date: Wed, 04 Jan 2017 08:13:24 GMT
  3. Content-Type: application/json
  4. Content-Length: 155
  5. Connection: close
  6. Access-Control-Allow-Origin: *
  7. Access-Control-Allow-Methods: POST, GET, OPTIONS
  8. Access-Control-Allow-Headers: X-Requested-With, X-Sequence, _aop_secret, _aop_signature
  9. Access-Control-Max-Age: 172800
  10. X-Acs-Request-Id: 14EB3BE2-B4A8-4F84-BD6E-52F222DDB66C
  11. Server: Jetty(7.2.2.v20101205)
  12. {
  13. "Id":"b44afc3c-46a4-4087-a215-c333a1218316",
  14. "Name":"myStack"
  15. }