CreateStackGroup

Updated at:

Creates a stack group from an ROS template to create stacks across multiple Alibaba Cloud accounts and regions.

Operation description

A stack group manages multiple ROS stacks as a unit, enabling you to create stacks across Alibaba Cloud accounts and regions.

Stack groups support two permission models:

  • Self-managed: Both the administrator and execution accounts are Alibaba Cloud accounts.

  • Service-managed: The administrator account is the management account or delegated administrator account of a resource directory. The execution account is a member account of that directory.

Overview.

This example creates a self-managed stack group named MyStackGroup in the China (Hangzhou) region using template 5ecd1e10-b0e9-4389-a565-e4c15efc****.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

ros:CreateStackGroup

create

*StackGroup

acs:ros:{#regionId}:{#accountId}:stackgroup/{#StackGroupName}

Template

acs:ros:{#regionId}:{#accountId}:template/{#TemplateId}

None None

Request parameters

Parameter

Type

Required

Description

Example

RegionId

string

Yes

The region ID of the stack group. Call DescribeRegions to query available regions.

cn-hangzhou

StackGroupName

string

Yes

The stack group name. Must be unique within a region. 1 to 255 characters. Can contain letters, digits, hyphens (-), and underscores (_). Must start with a letter or digit.

MyStackGroup

Description

string

No

The stack group description. 1 to 256 characters.

StackGroup Description

TemplateBody

string

No

The template body. 1 to 524,288 bytes. For large templates, pass the body in the HTTP POST request body to avoid URL length limits.

Note

Specify exactly one of TemplateBody, TemplateURL, and TemplateId.

{"ROSTemplateFormatVersion":"2015-09-01"}

TemplateURL

string

No

The URL of the template file. Supports HTTP, HTTPS, and OSS URLs. 1 to 524,288 bytes. Examples: oss://ros/template/demo, oss://ros/template/demo?RegionId=cn-hangzhou. If no region ID is specified for the OSS bucket, the RegionId value applies.

Note

Specify exactly one of TemplateBody, TemplateURL, and TemplateId.

oss://ros-template/demo

ClientToken

string

No

The client token for idempotency. Must be unique across requests. Can contain letters, digits, underscores (_), and hyphens (-), up to 64 characters. How to ensure idempotence.

123e4567-e89b-12d3-a456-42665544****

AdministrationRoleName

string

No

The RAM role for the administrator account in a self-managed stack group. ROS assumes this role to perform operations. Default: AliyunROSStackGroupAdministrationRole.

1 to 64 characters. Can contain letters, digits, and hyphens (-).

Note

This parameter is required when PermissionModel is set to SELF_MANAGED.

AliyunROSStackGroupAdministrationRole

ExecutionRoleName

string

No

The RAM role for the execution account in a self-managed stack group. The administrator role assumes this role to perform stack operations. Default: AliyunROSStackGroupExecutionRole.

1 to 64 characters. Can contain letters, digits, and hyphens (-).

Note

This parameter is required when PermissionModel is set to SELF_MANAGED.

AliyunROSStackGroupExecutionRole

TemplateId

string

No

The template ID. Applies to shared and private templates.

Note

Specify exactly one of TemplateBody, TemplateURL, and TemplateId.

5ecd1e10-b0e9-4389-a565-e4c15efc****

TemplateVersion

string

No

The template version. Defaults to the latest version.

Note

TemplateVersion takes effect only if you specify TemplateId.

v1

Parameters

array<object>

No

The parameters of the stack group.

object

No

ParameterKey

string

Yes

The key of parameter N. If not specified, ROS uses the default name and value defined in the template.

Maximum value of N: 200.

Note

Parameters is optional. If you specify Parameters, you must also specify Parameters.N.ParameterKey.

Amount

ParameterValue

string

Yes

The value of parameter N.

Maximum value of N: 200.

Note

Parameters is optional. If you specify Parameters, you must also specify Parameters.N.ParameterValue.

12

ResourceGroupId

string

No

The resource group ID. Defaults to the default resource group. Resource groups.

rg-acfmxazb4ph6aiy****

PermissionModel

string

No

The permission model of the stack group.

Valid values:

  • SELF_MANAGED (default): Create RAM roles for the administrator and execution accounts and establish a trust relationship between them.

  • SERVICE_MANAGED: ROS automatically creates service-linked roles for the administrator and execution accounts.

Note

To use SERVICE_MANAGED, your account must be the management account or a delegated administrator account of a resource directory with trusted access enabled. Manage a delegated administrator account and Enable trusted access.

SELF_MANAGED

Tags

array<object>

No

The tags of the stack group.

object

No

The tag of the stack group.

Key

string

Yes

The tag key of the stack group.

Note

Tags is optional. If you want to specify Tags, you must also specify Tags.N.Key.

usage

Value

string

No

The tag value of the stack group.

test

AutoDeployment

object

No

The automatic deployment settings.

Note

You must specify this parameter if PermissionModel is set to SERVICE_MANAGED.

{"Enabled": true, "RetainStacksOnAccountRemoval": true}

Enabled

boolean

No

Whether automatic deployment is enabled.

Valid values:

  • true: ROS automatically creates stacks for new member accounts added to the folder and deletes stacks for removed accounts.

  • false: Stacks remain unchanged when member accounts are added to or removed from the folder.

true

RetainStacksOnAccountRemoval

boolean

No

Whether to retain stacks when a member account is removed from the folder.

Valid values:

  • true

  • false

Note

You must specify RetainStacksOnAccountRemoval if Enabled is true.

true

Capabilities

array

No

The options for the stack group. Maximum: one option.

string

No

The stack group option. Valid value: ExpandModules, which expands modules within the current account.

Note
  • This parameter takes effect only when modules are used in the template.

  • By default, modules are not expanded in the current account, so they must exist in all target execution accounts. To expand modules in the current account instead, ensure the modules exist there.

Valid values:

  • ExpandModules :

    ExpandModules

ExpandModules

StackArn

string

No

The stack ARN in the format acs:ros:${RegionId}:${AccountId}:stack/${StackId}. The stack group uses the template and parameters of this stack.

Note
  • Only supported in self-managed permission mode.

  • If StackArn is specified, Parameters must not be specified.

  • You must specify only one of TemplateBody, TemplateURL, TemplateId, or StackArn.

acs:ros:cn-hangzhou:175458000000****:stack/4a65f506-c3cc-43b6-af06-3f000000****

Response elements

Element

Type

Description

Example

object

RequestId

string

The request ID.

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

StackGroupId

string

The stack group ID.

2c036e78-9e82-428e-afd6-177f5d04****

Examples

Success response

JSON format

{
  "RequestId": "14A07460-EBE7-47CA-9757-12CC4761D47A",
  "StackGroupId": "2c036e78-9e82-428e-afd6-177f5d04****"
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.