All Products
Search
Document Center

Resource Orchestration Service:DeleteStack

Last Updated:Jun 03, 2026

Deletes a stack. You can specify whether to retain resources.

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:DeleteStack

delete

*stack

acs:ros:{#regionId}:{#accountId}:stack/{#stackId}

None None

Request parameters

Parameter

Type

Required

Description

Example

StackId

string

Yes

The ID of the stack.

4a6c9851-3b0f-4f5f-b4ca-a14bf691****

RetainAllResources

boolean

No

Specifies whether to retain all resources in the stack.

Valid values:

  • true

  • false (default)

false

RegionId

string

Yes

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

cn-hangzhou

RamRoleName

string

No

The name of the RAM role. Resource Orchestration Service (ROS) assumes the RAM role to create the stack and uses the credentials of the role to call the APIs of Alibaba Cloud services.
ROS assumes the role to perform operations on the stack. If you have permissions to perform operations on the stack but do not have permissions to use the RAM role, ROS still assumes the RAM role. You must make sure that the least privileges are granted to the RAM role.
If you leave this parameter empty when you call the DeleteStack operation, ROS cannot assume the existing RAM role that is associated with the stack. If you want ROS to assume a RAM role, you must specify this parameter. If no RAM roles are available, ROS uses a temporary credential that is generated from the credentials of your account.
The name of the RAM role can be up to 64 bytes in length.

test-role

RetainResources

array

No

The resources that you want to retain.

WebServer

string

No

The names of the resources that you want to retain.

my_disk

DeleteOptions

array

No

The options for deleting the stack.

string

No

The option for deleting the stack. Valid values:

  • Null (default): When you delete the stack, subscription resources are ignored.

  • ThrowErrorWithSubscriptionResources: When you delete the stack, an error is reported if subscription resources exist.

["ThrowErrorWithSubscriptionResources"]

Parallelism

integer

No

The maximum number of concurrent operations that can be performed on resources.

By default, this parameter is empty. You can set this parameter to an integer that is greater than or equal to 0.

Note
  • If you set this parameter to an integer that is greater than 0, the integer is used. If you set this parameter to 0 or leave this parameter empty, no limit is imposed on ROS stacks. However, the default value in Terraform is used for Terraform stacks. In most cases, the default value in Terraform is 10.

  • If you set this parameter to a specific value, ROS associates the value with the stack. The value affects subsequent operations on the stack, such as an update operation.

1

Response elements

Element

Type

Description

Example

object

RequestId

string

The ID of the request.

B288A0BE-D927-4888-B0F7-B35EF84B6E6F

Examples

Success response

JSON format

{
  "RequestId": "B288A0BE-D927-4888-B0F7-B35EF84B6E6F"
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.