delete_stack
¶
delete_stack(
*,
config_overrides: Optional[CloudFormationClientConfig] = None,
stack_name: Optional[StackName] = None,
retain_resources: Optional[RetainResources] = None,
role_arn: Optional[RoleARN] = None,
client_request_token: Optional[ClientRequestToken] = None,
deletion_mode: Optional[DeletionMode] = None,
deployment_config: Optional[DeploymentConfig] = None,
) -> None
Deletes a specified stack. Once the call completes successfully, stack deletion starts. Deleted stacks don't show up in the DescribeStacks operation if the deletion has been completed successfully.
For more information about deleting a stack, see Delete a stack from the CloudFormation console in the CloudFormation User Guide.
Parameters:
-
stack_name(Optional[StackName], default:None) –The name or the unique stack ID that's associated with the stack.
-
retain_resources(Optional[RetainResources], default:None) –For stacks in the
DELETE_FAILEDstate, a list of resource logical IDs that are associated with the resources you want to retain. During deletion, CloudFormation deletes the stack but doesn't delete the retained resources.Retaining resources is useful when you can't delete a resource, such as a non-empty S3 bucket, but you want to delete the stack.
-
role_arn(Optional[RoleARN], default:None) –The Amazon Resource Name (ARN) of an IAM role that CloudFormation assumes to delete the stack. CloudFormation uses the role's credentials to make calls on your behalf.
If you don't specify a value, CloudFormation uses the role that was previously associated with the stack. If no role is available, CloudFormation uses a temporary session that's generated from your user credentials.
-
client_request_token(Optional[ClientRequestToken], default:None) –A unique identifier for this
DeleteStackrequest. Specify this token if you plan to retry requests so that CloudFormation knows that you're not attempting to delete a stack with the same name. You might retryDeleteStackrequests to ensure that CloudFormation successfully received them.All events initiated by a given stack operation are assigned the same client request token, which you can use to track operations. For example, if you execute a
CreateStackoperation with the tokentoken1, then all theStackEventsgenerated by that operation will haveClientRequestTokenset astoken1.In the console, stack operations display the client request token on the Events tab. Stack operations that are initiated from the console use the token format Console-StackOperation-ID, which helps you easily identify the stack operation . For example, if you create a stack using the console, each stack event would be assigned the same token in the following format:
Console-CreateStack-7f59c3cf-00d2-40c7-b2ff-e75db0987002. -
deletion_mode(Optional[DeletionMode], default:None) –Specifies the deletion mode for the stack. Possible values are:
-
STANDARD- Use the standard behavior. Specifying this value is the same as not specifying this parameter. -
FORCE_DELETE_STACK- Delete the stack if it's stuck in aDELETE_FAILEDstate due to resource deletion failure.
-
-
deployment_config(Optional[DeploymentConfig], default:None) –The deployment configuration for this stack operation, including the deployment mode.
Raises:
-
TokenAlreadyExistsException–A client request token already exists.
-
UnknownServiceError–The service returned an error code this client does not model.
Source code in docs_src/capo_cloudformation/_services/cloud_formation.py
1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 | |