Create a stack

Last Updated: Apr 25, 2017

Description

  • A stack is created based on your designated template and parameter list.
  • The template content is submitted along with the HTTP message body.
  • You must specify the stack name. After the stack is created successfully, the Resource Orchestration Service (ROS) returns an ID that uniquely identifies the stack in subsequent actions.
  • The stack is created in the namespace corresponding to your user ID. Therefore, the stacks created with the same user ID in the same region must be named differently.
  • The stack cannot be renamed once created.
  • The stack ownership cannot be transferred to another user.
  • The region where the stack is created must be specified in the format of x-acs-region-id.
  • All resources under the stack must be located in the same region as the stack.

Request parameters

Name Location Type Required? Description
x-acs-region-id header String Yes Region where a stack is to be created. For details, see the ROS regions in the region list.
Name body 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.
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 to create the stack. The keys must be specified in the template.
DisableRollback body Boolean No Whether to disable rollback when the stack fails to be created. “True” indicates that rollback is disabled. That is, rollback is not performed when the stack creation fails. “False” indicates that rollback is not disabled. That is, rollback is performed when the stack creation fails.
TimeoutMins body Integer Yes Timeout for stack creation, in minutes. The default value is 60.

Returned 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.

Example

Request example

  1. POST http://ros.aliyuncs.com/stacks 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: ros.aliyuncs.com
  14. Connection: keep-alive
  15. Content-Length: 502
  16. {
  17. Name”: “<stack name>”,
  18. Parameters”:
  19. {
  20. key”: value
  21. },
  22. Template”:<template text>,
  23. DisableRollback”: true,
  24. TimeoutMins”: 15
  25. }

Response example

  1. HTTP/1.1 201 Created
  2. Date: Fri, 11 Sep 2015 05:28:48 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. }
Thank you! We've received your feedback.