All Products
Search
Document Center

Resource Orchestration Service:CreateStackGroup

Last Updated:Mar 17, 2023

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.
OperationAccess levelResource typeCondition keyAssociation operation
ros:CreateStackGroupWRITE
  • ROS
    acs:ros:{#regionId}:{#accountId}:stack_group/*
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
RegionIdstringYes

The region ID of the stack group. You can call the DescribeRegions operation to query the most recent region list.

cn-hangzhou
StackGroupNamestringYes

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
DescriptionstringNo

The description of the stack group.

The description must be 1 to 256 characters in length.

StackGroup Description
TemplateBodystringNo

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"}
TemplateURLstringNo

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
ClientTokenstringNo

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****
AdministrationRoleNamestringNo

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
ExecutionRoleNamestringNo

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
TemplateIdstringNo

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****
TemplateVersionstringNo

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
ParametersarrayNo

The parameters.

objectNo
ParameterKeystringYes

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
ParameterValuestringYes

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
ResourceGroupIdstringNo

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****
PermissionModelstringNo

The permission model.

Default value: SELF_MANAGED. Valid values:

  • SELF_MANAGED: the self-managed permission model. If you create a self-managed stack group, you must create RAM roles within the administrator and execution accounts and establish a trust relationship between the accounts. Then, you can deploy stacks within the execution account.
  • SERVICE_MANAGED: the service-managed permission model. If you create a service-managed stack group, ROS creates service-linked roles for the administrator and execution accounts, and the administrator account uses its role to deploy stacks within the execution account.
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
TagsarrayNo

The tags.

objectNo
KeystringYes

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
ValuestringNo

The value of tag N that you want to add to the stack group.

test
AutoDeploymentobjectNo

The information about automatic deployment settings.

NoteThis parameter is required only if the PermissionModel parameter is set to SERVICE_MANAGED.
EnabledbooleanYes

Specifies whether to enable automatic deployment.

Valid values:

  • true: enables automatic deployment. If you add a member to the folder to which the stack group belongs after you enable automatic deployment, ROS automatically adds the stacks in the stack group to the member. If you remove a member from the folder, ROS automatically deletes the stacks from the member.
  • false: disables automatic deployment. After you disable automatic deployment, the stacks remain unchanged when you change the members in the folder.
true
RetainStacksOnAccountRemovalbooleanNo

Specifies whether to retain stacks within a member when you remove the member from the folder.

Valid values:

  • true: retains the stacks.
  • false: deletes the stacks.
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

ParameterTypeDescriptionExample
object
RequestIdstring

The ID of the request.

14A07460-EBE7-47CA-9757-12CC4761D47A
StackGroupIdstring

The ID of the stack group.

2c036e78-9e82-428e-afd6-177f5d04****
Error codeError messageHTTP status codeDescription
CircularDependencyCircular Dependency Found: {reason}.400The error message returned because the template contains circular dependencies. reason indicates the cause of the error.
InvalidSchema{reason}.400The error message returned because the template format is invalid. reason indicates the cause of the error.
InvalidTemplateAttributeThe Referenced Attribute ({resource} {name}) is incorrect.400The 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.
InvalidTemplatePropertyTypeThe specified value type of ({resource} {section}) is incorrect.400The 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.
InvalidTemplateReferenceThe specified reference "{name}" (in {referencer}) is incorrect.400The error message returned because the template contains an invalid reference. name indicates the reference name. referencer indicates the referencer name.
InvalidTemplateSectionThe template section is invalid: {section}.400The error message returned because the template contains an invalid section. section indicates the section name.
InvalidTemplateVersionThe template version is invalid: {reason}.400The error message returned because the template version is invalid. reason indicates the cause of the error.
UnknownUserParameterThe Parameter ({name}) was not defined in template.400The error message returned because the specified parameter is not defined in the template. name indicates the parameter name.
UserParameterMissingThe Parameter {name} was not provided.400The error message returned because no value is specified for a parameter in the template. name indicates the parameter name.
StackGroupExistsThe StackGroup ({name}) already exists.409The error message returned because a stack group that has the same name already exists. name indicates the name of the stack group.
TemplateNotFoundThe Tempalte ({ ID }) could not be found.404The error message returned because the template does not exist. ID indicates the ID of the template.
TemplateNotFoundThe Template { ID } with version { version } could not be found.404The 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

JSONformat

{
  "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 timeSummary of changesOperation
2022-10-27The input parameters of the API operation change.
Change itemChange content
Input ParametersThe input parameters of the API operation change.
    Added Input Parameters: Tags