Skip to content

Instantly share code, notes, and snippets.

@omerxx
Last active March 8, 2018 10:45
Show Gist options
  • Select an option

  • Save omerxx/f0869cfb1a24bcb4215eef2759d94a3d to your computer and use it in GitHub Desktop.

Select an option

Save omerxx/f0869cfb1a24bcb4215eef2759d94a3d to your computer and use it in GitHub Desktop.
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