edit-icon download-icon

Preview a stack

Last Updated: May 18, 2018

Call /stacks/preview by POST to preview the stack information of the specified template.

Request parameters

Name Location Type Required Description
x-acs-region-id header String Yes Region where the stack is to be created. See ROS 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 is 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 time for stack creation, in minutes. The default value is 60.

Returned parameters

Name Parameter type Description
Description String Stack description.
Updated String Update time, which follows the ISO8601 standard and uses UTC time. The format is YYYY-MM-DDThh:mm:ssZ.
Parameters JSON Stack parameter set in JSON format.
Created String Stack creation time, which follows the ISO8601 standard and uses UTC time. The format is YYYY-MM-DDThh:mm:ssZ.
Region String Region where the stack is located.
TemplateDescription String Template description.
Webhook String Custom callback function.
Id String Stack ID.
Resources JSON Detailed information about stack resources, which is a resource set in JSON format.
Name String Stack name.
DisableRollback Boolean 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 Integer Timeout time for stack creation, in minutes.

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/preview 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. "Updated":null,
  14. "Description":"No description",
  15. "Parameters":{
  16. "ALIYUN::StackId":"None",
  17. "ALIYUN::StackName":"update_test_0040",
  18. "ALIYUN::Region":"cn-beijing"
  19. },
  20. "Created":"2017-01-17T07:01:10.437639",
  21. "Region":"cn-beijing",
  22. "TemplateDescription":"No description",
  23. "Webhook":null,
  24. "Id":"None",
  25. "DisableRollback":false,
  26. "TimeoutMins":120,
  27. "Resources":[
  28. {
  29. "UpdatedTime":null,
  30. "StackIdentity":{
  31. "StackName":"update_test_0040",
  32. "StackId":"None",
  33. "Region":"cn-beijing",
  34. "Tenant":"1754580903499898",
  35. "Path":""
  36. },
  37. "ResourceStatus":"COMPLETE",
  38. "Description":"",
  39. "ResourceData":null,
  40. "ResourceStatusReason":"",
  41. "ResourceAction":"INIT",
  42. "PhysicalResourceId":"",
  43. "DeletedTime":null,
  44. "StackName":"update_test_0040",
  45. "ResourceType":"ALIYUN::ECS::InstanceGroupClone",
  46. "RequiredBy":[
  47. ],
  48. "Attributes":{
  49. "OrderId":null,
  50. "InnerIps":null,
  51. "PrivateIps":null,
  52. "ZoneIds":null,
  53. "PublicIps":null,
  54. "InstanceIds":null
  55. },
  56. "CreatedTime":null,
  57. "ResourceName":"WebServer",
  58. "ResourceIdentity":{
  59. "StackName":"update_test_0040",
  60. "StackId":"None",
  61. "Region":"cn-beijing",
  62. "Tenant":"1754580903499898",
  63. "Path":"/resources/WebServer"
  64. },
  65. "Properties":{
  66. "AutoReleaseTime":null,
  67. "DiskMappings":null,
  68. "LoadBalancerIdToAttach":null,
  69. "Description":null,
  70. "BackendServerWeight":100,
  71. "Tags":null,
  72. "MinAmount":1,
  73. "SecurityGroupId":null,
  74. "ZoneId":null,
  75. "InternetMaxBandwidthOut":null,
  76. "ImageId":null,
  77. "SourceInstanceId":"i-2ze5q7nkum5974w67jhr",
  78. "Password":"Test1234",
  79. "InstanceName":null,
  80. "MaxAmount":1
  81. },
  82. "Metadata":{
  83. }
  84. }
  85. ],
  86. "Name":"update_test_0040"
  87. }
Thank you! We've received your feedback.