# atmos aws cloudformation stackset delete

Delete a CloudFormation StackSet. CloudFormation requires every stack
instance to be removed before the StackSet itself can be deleted, so
`stackset delete` lists the StackSet's current instances, deletes them all
(`DeleteStackInstances`, retaining no resources) if any exist, waits for
that operation to finish, and only then deletes the StackSet
(`DeleteStackSet`).

> ⚠️ Experimental

## Usage

```shell
atmos aws cloudformation stackset delete <component> --stack <stack> [options]
```

```shell
atmos aws cloudformation stackset delete vpc -s plat-ue2-dev
```

Skip the interactive confirmation prompt:

```shell
atmos aws cloudformation stackset delete vpc -s plat-ue2-dev --auto-approve
```

Delete StackSets for all or affected components in dependency order:

```shell
atmos aws cloudformation stackset delete --all -s plat-ue2-dev
atmos aws cloudformation stackset delete --affected --base origin/main
```

Deleting a StackSet that does not exist is not an error: `stackset delete`
prints `<name> does not exist; nothing to delete` and exits 0, the same as
[`delete`](/cli/commands/aws/cloudformation/delete) does for a missing stack.

## Flags

- **`--stack`, `-s` (required for a single component)**
  Atmos stack. With 
  `--all`
  , 
  `--affected`
  , 
  `--tags`
  , or 
  `--labels`
  , this is an optional stack filter; omit it to select components across stacks.
- **`--auto-approve` (optional)**
  Skip the interactive confirmation prompt. Without it, 
  `stackset delete`
   prompts for confirmation on a TTY before deleting the StackSet.

## Behavior

`stackset delete` acts directly on the StackSet whose name matches the
component's `stack_name` — it takes no `--target` flag and does not need a
`kind: aws/stackset` provision target declared. The `DeleteStackInstances`
operation is polled every 3 seconds until it reaches a terminal status
(`SUCCEEDED`/`FAILED`/`STOPPED`), and the command times out after 30 minutes
if it hasn't.

Before deletion, Atmos describes the existing StackSet to determine its
permission model. Deleting instances currently supports `SELF_MANAGED`
permissions only. A `SERVICE_MANAGED` StackSet with instances is rejected
before anything is deleted; remove those instances with AWS CloudFormation
first. Empty service-managed StackSets can still be deleted with Atmos.

:::note
`stackset delete` does not fire `before`/`after` hook events — only
[`apply`](/cli/commands/aws/cloudformation/apply),
[`diff`](/cli/commands/aws/cloudformation/diff),
[`delete`](/cli/commands/aws/cloudformation/delete),
[`drift detect`](/cli/commands/aws/cloudformation/drift/detect), and
[`drift describe`](/cli/commands/aws/cloudformation/drift/describe) do.
:::
