Creates a stack group.
A stack group is a collection of Resource Orchestration Service (ROS) stacks that you can manage as a unit. You can use an ROS template of a stack group to create stacks within Alibaba Cloud accounts in multiple regions.
You can create a stack group that is granted self-managed or service-managed permissions:
- If you use an Alibaba Cloud account to create a self-managed stack group, the administrator account and the execution account are Alibaba Cloud accounts.
- If you enable a resource directory and use the management account or a delegated administrator account of the resource directory to create a service-managed stack group, the administrator account is the management account or delegated administrator account, and the execution account is a member of the resource directory.
For more information about stack groups, see Overview.
This topic provides an example on how to create a self-managed stack group named MyStackGroup
by using a template. In this example, the template ID is 5ecd1e10-b0e9-4389-a565-e4c15efc****
. The region ID of the stack group is cn-hangzhou
.
Debugging
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | CreateStackGroup |
The operation that you want to perform. Set the value to CreateStackGroup. |
RegionId | String | Yes | cn-hangzhou |
The region ID of the stack group. You can call the DescribeRegions operation to query the most recent region list. |
StackGroupName | String | Yes | MyStackGroup |
The name of the stack group. The name must be unique within a region. The name can be up to 255 characters in length, and can contain digits, letters, hyphens (-), and underscores (_). The name must start with a digit or letter. |
Description | String | No | StackGroup Description |
The description of the stack group. The description must be 1 to 256 characters in length. |
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 caused by excessively long URLs. Note You must specify only one of the following parameters: TemplateBody, TemplateURL,
and TemplateId.
|
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 Object Storage Service (OSS) bucket, such as oss://ros/template/demo or oss://ros/template/demo?RegionId=cn-hangzhou. The template body must be 1 to 524,288 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 must specify only one of the following parameters: TemplateBody, TemplateURL,
and TemplateId.
|
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 make sure 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. |
AdministrationRoleName | String | No | AliyunROSStackGroupAdministrationRole |
The name of the RAM role that you specify for the administrator account when you create a self-managed stack group. ROS assumes the administrator role to perform operations. If you do not specify this parameter, the default value AliyunROSStackGroupAdministrationRole is used. ROS uses the administrator role to assume the execution role AliyunROSStackGroupExecutionRole to perform operations on the stacks in the stack group. The name must be 1 to 64 characters in length, and can contain letters, digits, and hyphens (-). |
ExecutionRoleName | String | No | AliyunROSStackGroupExecutionRole |
The name of the RAM role that you specify for the execution account when you create a self-managed stack group. The administrator role AliyunROSStackGroupAdministrationRole assumes the execution role to perform operations. If you do not specify this parameter, the default value AliyunROSStackGroupExecutionRole is used. ROS assumes the execution role to perform operations on the stacks in the stack group. The name must be 1 to 64 characters in length, and can contain letters, digits, and hyphens (-). |
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. If you do not specify this parameter, the latest version is used. Note This parameter takes effect only when the TemplateId parameter is specified.
|
Parameters.N.ParameterKey | String | Yes | Amount |
The name of parameter N. If you do not specify the name and value of a parameter, ROS uses the default name and value that are defined in the template. Maximum value of N: 200. Note The Parameters parameter is optional. If you specify the Parameters parameter, you
must specify the Parameters.N.ParameterKey parameter.
|
Parameters.N.ParameterValue | String | Yes | 12 |
The value of parameter N. Maximum value of N: 200. Note The Parameters parameter is optional. If you specify the Parameters parameter, you
must specify the Parameters.N.ParameterValue parameter.
|
ResourceGroupId | String | No | rg-acfmxazb4ph6aiy**** |
The ID of the resource group. If you do not specify this parameter, the stack group is added to the default resource group. For more information about resource groups, see the "Resource Group" section of the What is Resource Management? topic. |
PermissionModel | String | No | SELF_MANAGED |
The permission model. Default value: SELF_MANAGED. Valid values:
Note When you use the service-managed permission model to deploy stacks, make sure that
your account is the management account or a delegated administrator account in the
resource directory and the trusted access feature is enabled for your account. For
more information, see Step 1: (Optional) Create a delegated administrator account and Step 2: Enable trusted access.
|
Tags.N.Key | String | Yes | usage |
The key of tag N that you want to add to the stack group. Note The Tags parameter is optional. If you specify the Tags parameter, you must specify
the Tags.N.Key parameter.
|
Tags.N.Value | String | No | test |
The value of tag N that you want to add to the stack group. |
AutoDeployment | Object | No |
The information about automatic deployment settings. Note This parameter is required only if the PermissionModel parameter is set to SERVICE_MANAGED.
|
|
Enabled | Boolean | Yes | true |
Specifies whether to enable automatic deployment. Valid values:
|
RetainStacksOnAccountRemoval | Boolean | No | true |
Specifies whether to retain stacks within a member when you remove the member from the folder. Valid values:
Note This parameter is required if the Enabled parameter is set to true.
|
For more information about common request parameters, see Common parameters.
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
RequestId | String | 14A07460-EBE7-47CA-9757-12CC4761D47A |
The ID of the request. |
StackGroupId | String | 2c036e78-9e82-428e-afd6-177f5d04**** |
The ID of the stack group. |
Examples
Sample requests
http(s)://ros.aliyuncs.com/?Action=CreateStackGroup
&RegionId=cn-hangzhou
&StackGroupName=MyStackGroup
&TemplateId=5ecd1e10-b0e9-4389-a565-e4c15efc****
&PermissionModel=SELF_MANAGED
&<Common request parameters>
Sample success responses
XML
format
HTTP/1.1 200 OK
Content-Type:application/xml
<CreateStackGroupResponse>
<RequestId>14A07460-EBE7-47CA-9757-12CC4761D47A</RequestId>
<StackGroupId>2c036e78-9e82-428e-afd6-177f5d04****</StackGroupId>
</CreateStackGroupResponse>
JSON
format
HTTP/1.1 200 OK
Content-Type:application/json
{
"RequestId" : "14A07460-EBE7-47CA-9757-12CC4761D47A",
"StackGroupId" : "2c036e78-9e82-428e-afd6-177f5d04****"
}
Error codes
For a list of error codes, visit the API Error Center.
Error code |
Error message |
HTTP status code |
Description |
---|---|---|---|
CircularDependency |
Circular Dependency Found: {reason}. |
400 |
The error message returned because the template contains circular dependencies. reason indicates the cause of the error. |
InvalidSchema |
{reason}. |
400 |
The error message returned because the template format is invalid. reason indicates the cause of the error. |
InvalidTemplateAttribute |
The Referenced Attribute ({resource} {name}) is incorrect. |
400 |
The error message returned because the resource property that is referenced in the Outputs section of the template is invalid. resource indicates the resource name. name indicates the property name. |
InvalidTemplatePropertyType |
The specified value type of ({resource} {section}) is incorrect. |
400 |
The error message returned because the type of the resource property that is defined in a template section is invalid. resource indicates the resource name. section indicates the section 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. referencer indicates the referencer name. |
InvalidTemplateSection |
The template section is invalid: {section}. |
400 |
The error message returned because the template contains an invalid section. section indicates the section name. |
InvalidTemplateVersion |
The template version is invalid: {reason}. |
400 |
The error message returned because the template version is invalid. reason indicates the cause of the error. |
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 specified for a parameter in the template. name indicates the parameter name. |
StackGroupExists |
The StackGroup ({name}) already exists. |
409 |
The error message returned because a stack group that has the same name already exists. name indicates the name of the stack group. |
TemplateNotFound |
The Tempalte ({ ID }) could not be found. |
404 |
The error message returned because the template does not exist. ID indicates the ID of the template. |
TemplateNotFound |
The Template { ID } with version { version } could not be found. |
404 |
The error message returned because the specified template or template version does not exist. ID indicates the ID of the template. version indicates the version of the template. |