Delete a stack set using the AWS Management Console or AWS CLI - AWS CloudFormation

Delete a stack set using the AWS Management Console or AWS CLI

When you are finished with the AWS CloudFormation StackSets Getting Started walkthrough, you can follow procedures in this section to delete stack sets and other resources that you have created as part of this walkthrough. To delete a stack set, you must first delete all stack instances in the stack set. For information about how to delete all stack instances, see Delete stack instances using the AWS Management Console or AWS CLI.

Delete a stack set using the AWS Management Console

  1. On the StackSets page, select the stack set that you created in Create a stack set using the AWS Management Console or AWS CLI. In this walkthrough, we created a stack set named my-awsconfig-stackset.

  2. With the stack set selected, choose Delete StackSet from the Actions menu.

  3. When you are prompted to confirm that you want to delete the stack set, choose Delete StackSet.

Delete a stack set using the AWS CLI

When acting as a delegated administrator, you must set the --call-as parameter to DELEGATED_ADMIN each time you run a StackSets command.

--call-as DELEGATED_ADMIN
  1. Run the following command. When you are prompted to confirm, type y, and then press Enter.

    aws cloudformation delete-stack-set --stack-set-name my-awsconfig-stackset
  2. Verify that the stack set was deleted by running the list-stack-sets command. The results of the list-stack-sets command should show your stack with a status of DELETED.

    aws cloudformation list-stack-sets

Delete service roles (optional)

Delete the service roles that StackSets required for stack set creation.

For self-managed stack sets, the roles you created as part of the Region and permission requirements for stack set operations for the walkthrough in this guide are named AWSCloudFormationStackSetAdministrationRole in the administrator account, and AwsCloudFormationStackSetExecutionRole in each target account.

For service-managed stack sets, the roles that were automatically created by StackSets as part of the Region and permission requirements for stack set operations for the walkthrough in this guide have the suffix CloudFormationStackSetsOrgAdmin in the organization management account, and CloudFormationStackSetsOrgMember in each target account.

For more information about deleting roles, see Deleting roles and instance profiles in the IAM User Guide.

To delete a service role by using the AWS Management Console
  1. Sign in to the AWS Management Console and open the IAM console at https://console.aws.amazon.com/iam/.

  2. In the navigation pane, choose Roles, and then fill the check box next to the role that you want to delete.

  3. In the Role actions menu at the top of the page, choose Delete role.

  4. In the confirmation dialog box, choose Yes, Delete. If you are sure, you can proceed with the deletion even if the service last accessed data is still loading.

To delete a service role by using the AWS CLI
  • Run the following command. When you are prompted to confirm, type y, and then press Enter.

    aws iam delete-role --role-name role name