Deletes a stack and all of its resources.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes DeleteStack

The operation that you want to perform. Set the value to DeleteStack.

StackId String Yes 4a6c9851-3b0f-4f5f-b4ca-a14bf691****

The ID of the stack.

RetainAllResources Boolean No false

Specifies whether to retain all resources in the stack.

Default value: false. Valid values:

  • true
  • false
RegionId String Yes cn-hangzhou

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

RamRoleName String No test-role

The name of the RAM role. Resource Orchestration Service (ROS) assumes the RAM role to create the stack and uses credentials of the role to call the APIs of Alibaba Cloud services.

ROS assumes the RAM 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 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 role is available for ROS to assume, 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.

RetainResources.N String No my_disk

The name of resource N that you want to retain.

Response parameters

Parameter Type Example Description
RequestId String B288A0BE-D927-4888-B0F7-B35EF84B6E6F

The ID of the request.

Examples

Sample requests

http(s)://ros.aliyuncs.com/? Action=DeleteStack
&RegionId=cn-hangzhou
&StackId=4a6c9851-3b0f-4f5f-b4ca-a14bf691****
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<?xml version='1.0' encoding='UTF-8' ?>

<DeleteStackResponse>
    <RequestId>B288A0BE-D927-4888-B0F7-B35EF84B6E6F</RequestId>
</DeleteStackResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

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

Error codes

For a list of error codes, see Service error codes.

For more information about errors common to all operations, see Common errors.

HTTP status code

Error code

Error message

Description

400

InvalidOperation.DeletionProtection

Fail to delete stack {ID}, as deletion protection is enabled.

The error message returned because deletion protection prevented the stack from being deleted. ID indicates the stack ID.

404

StackNotFound

The Stack ({name}) could not be found.

The error message returned because the stack does not exist. name indicates the name or ID of the stack.

409

ActionInProgress

Stack {name} already has an action ({action}) in progress.

The error message returned because the stack has a change operation in progress. name indicates the stack name or ID. action indicates the change operation.