Last active
March 8, 2018 10:45
-
-
Save omerxx/f0869cfb1a24bcb4215eef2759d94a3d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import boto3 | |
| # Listing all stacks in the AWS account that are currently active | |
| def list_stacks(client): | |
| response = client.list_stacks( | |
| StackStatusFilter=['CREATE_COMPLETE', 'UPDATE_COMPLETE'] | |
| ) | |
| return response | |
| # Iterate through the list and delete everything | |
| def make_the_world_burn(client, response): | |
| for stack in response['StackSummaries']: | |
| client.delete_stack( | |
| StackName=stack['StackName'] | |
| ) | |
| def main(): | |
| client = boto3.client('cloudformation') | |
| make_the_world_burn(list_stacks(client)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment