Creates a stack group.
Operation Description
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
.
Authorization information
The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action
policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:
- Operation: the value that you can use in the Action element to specify the operation on a resource.
- Access level: the access level of each operation. The levels are read, write, and list.
- Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
- The required resource types are displayed in bold characters.
- If the permissions cannot be granted at the resource level,
All Resources
is used in the Resource type column of the operation.
- Condition Key: the condition key that is defined by the cloud service.
- Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
Operation | Access level | Resource type | Condition key | Association operation |
---|---|---|---|---|
ros:CreateStackGroup | WRITE |
|
| none |
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
RegionId | string | Yes | The region ID of the stack group. You can call the DescribeRegions operation to query the most recent region list. | cn-hangzhou |
StackGroupName | string | Yes | 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. | MyStackGroup |
Description | string | No | The description of the stack group. The description must be 1 to 256 characters in length. | StackGroup Description |
TemplateBody | string | No | 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. NoteYou must specify only one of the following parameters: TemplateBody, TemplateURL, and TemplateId. | {"ROSTemplateFormatVersion":"2015-09-01"} |
TemplateURL | string | No | 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. NoteYou must specify only one of the following parameters: TemplateBody, TemplateURL, and TemplateId. | oss://ros-template/demo |
ClientToken | string | No | 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. | 123e4567-e89b-12d3-a456-42665544**** |
AdministrationRoleName | string | No | 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 (-). | AliyunROSStackGroupAdministrationRole |
ExecutionRoleName | string | No | 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 (-). | AliyunROSStackGroupExecutionRole |
TemplateId | string | No | The ID of the template. This parameter applies to shared and private templates. NoteYou must specify only one of the following parameters: TemplateBody, TemplateURL, and TemplateId. | 5ecd1e10-b0e9-4389-a565-e4c15efc**** |
TemplateVersion | string | No | The version of the template. If you do not specify this parameter, the latest version is used. NoteThis parameter takes effect only when the TemplateId parameter is specified. | v1 |
Parameters | array | No | The parameters. | |
object | No | |||
ParameterKey | string | Yes | 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. NoteThe Parameters parameter is optional. If you specify the Parameters parameter, you must specify the Parameters.N.ParameterKey parameter. | Amount |
ParameterValue | string | Yes | The value of parameter N. Maximum value of N: 200. NoteThe Parameters parameter is optional. If you specify the Parameters parameter, you must specify the Parameters.N.ParameterValue parameter. | 12 |
ResourceGroupId | string | No | 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. | rg-acfmxazb4ph6aiy**** |
PermissionModel | string | No | The permission model. Default value: SELF_MANAGED. Valid values:
NoteWhen 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. | SELF_MANAGED |
Tags | array | No | The tags. | |
object | No | |||
Key | string | Yes | The key of tag N that you want to add to the stack group. NoteThe Tags parameter is optional. If you specify the Tags parameter, you must specify the Tags.N.Key parameter. | usage |
Value | string | No | The value of tag N that you want to add to the stack group. | test |
AutoDeployment | object | No | The information about automatic deployment settings. NoteThis parameter is required only if the PermissionModel parameter is set to SERVICE_MANAGED. | |
Enabled | boolean | Yes | Specifies whether to enable automatic deployment. Valid values:
| true |
RetainStacksOnAccountRemoval | boolean | No | Specifies whether to retain stacks within a member when you remove the member from the folder. Valid values:
NoteThis parameter is required if the Enabled parameter is set to true. | true |
For more information about common request parameters, see Common parameters.
Response parameters
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. |
Examples
Sample success responses
JSON
format
{
"RequestId": "14A07460-EBE7-47CA-9757-12CC4761D47A",
"StackGroupId": "2c036e78-9e82-428e-afd6-177f5d04****"
}
Error codes
For a list of error codes, visit the Service error codes.
Change history
Change time | Summary of changes | Operation | ||||
---|---|---|---|---|---|---|
2022-10-27 | The input parameters of the API operation change. | |||||
|