Hysen Labs
CLI tool
go-to-k/delstack avatar
go-to-k

delstack

A CLI tool for deleting AWS CloudFormation and AWS CDK stacks, from routine deletions to force deleting stacks with undeletable resources.

92 stars3 forksGoMIT
DEEP OPEN-SOURCE ANALYSIS

delstack: a CLI for force deleting AWS CloudFormation and CDK stacks

delstack removes CloudFormation stacks including resources that normally fail to delete, leaving no orphans.

Why delstack exists

delstack is a command line tool for deleting AWS CloudFormation stacks. The README positions it against the platform's own deletion behavior, noting that CloudFormation's built in FORCE_DELETE_STACK leaves failed resources behind, whereas delstack cleans them up with no orphaned resources. That distinction is the core reason the tool exists, because anyone who has torn down a large stack knows how often deletion stalls on a non empty bucket or a protected resource and leaves debris that keeps accruing cost. The tool handles routine deletions as well as the hard cases, so a user can reach for one command instead of mixing the console, the CLI, and manual cleanup scripts. The README states that delstack works with stacks produced by AWS CDK, AWS SAM, AWS Amplify, the Serverless Framework, and any infrastructure as code tool that uses CloudFormation under the hood. That breadth matters because modern AWS deployments rarely use raw CloudFormation templates, and a deletion tool that only understood one framework would miss most real stacks. By operating at the CloudFormation layer, delstack stays relevant regardless of which higher level tool generated the stack. The project's homepage links to a writeup about zero orphaned resources and force deleting any CloudFormation stack, which frames the tool as a reliability and cost control utility rather than a novelty. For platform engineers, the selling point is a predictable teardown that does not require manual babysitting of stuck resources.

Force deletion of stuck resources

A central feature of delstack is its ability to force delete resources that would otherwise block stack removal. The README says it automatically cleans up resources blocking deletion, such as non empty S3 buckets, and points to a longer list of supported resource types in the documentation. Non empty buckets are the classic culprit: CloudFormation will not delete a bucket that still holds objects, so a stack stuck on one bucket can leave an entire deployment half alive. delstack's approach is to handle that cleanup itself rather than surfacing the error and stopping. The README emphasizes that this produces no orphaned resources, which is the property teams care about when they want a clean slate and a stopped bill. The tool is described as going beyond what the native force delete does, because the native path leaves the failed resources in place and marks the stack as deleted while the objects linger. For safety conscious operators, automatic deletion of data carrying resources is a double edged sword: it is convenient, but it means the tool must be used with care because it will remove content that a cautious process might want to preserve. The documentation's resource type list is where a user should check exactly which resources delstack knows how to force through, since coverage determines whether a given stack will reach zero remnants.

Parallel deletion and CDK support

delstack also addresses the operational side of tearing down many stacks at once. The README describes parallel deletion with dependency resolution, so multiple stacks can be removed while respecting the order their resources depend on. That matters in real environments where a single application spreads across several stacks, perhaps across regions, and deleting them in the wrong sequence fails or leaves dangling references. For AWS CDK users specifically, the tool provides a cdk subcommand: delstack cdk synthesizes the app, discovers all stacks including cross region ones, and deletes them with dependency resolution applied. This saves the user from manually running cdk synth, reading the stack set, and issuing deletes in the right order. Because the discovery happens from the synthesized output, it sees the same set of stacks the deployment would create, including ones a human might forget. The combination of CDK awareness and parallel execution is what lets delstack claim it can remove any CloudFormation stack rather than only the simple ones. The repository is published under the MIT license and its most recent commit was on 2026-08-26. A Go report card and a continuous integration workflow are shown in the README, indicating the project is built and tested in Go and treats deletion correctness as something to verify automatically.

Editorial conclusion

delstack is a command line tool for deleting AWS CloudFormation stacks. The README says it handles everything from routine deletions to stacks containing resources that fail to delete, and unlike CloudFormation's built in force delete it cleans up those resources with no orphaned leftovers. It works with stacks from AWS CDK, AWS SAM, AWS Amplify, the Serverless Framework, and any infrastructure as code tool that uses CloudFormation. The repository is published under the MIT license and its most recent commit was on 2026-08-26.

DEEP OPEN-SOURCE ANALYSIS

Official sources

Community notes

Community notes