Skip to main content

A script that concurrently deletes common AWS resources like S3 buckets, RDS instances, and EC2 instances across all AWS regions.

Project description

PyPI - Downloads PyPI version GitHub License GitHub commit activity Github Created At GitHub last commit

AWS Delete All Script

Introduction

This script is designed to clean up various resources within specific AWS regions in parallel using Python threading. This script uses boto3, the AWS SDK for Python, and checks the version of boto3 currently installed on your system against the latest available version.

Before deleting any resources, it will create threads for each AWS region, and perform the deletion of resources in each region concurrently.

Demo GIF

How to Use in AWS CloudShell

AWS CloudShell is a browser-based shell that you can use to manage your AWS resources. Here's how you can use this script in AWS CloudShell:

1- Open AWS CloudShell from the AWS Management Console.

pip install aws-delete-all

2- Run

aws-delete-all

AWS CLI Setup

Before you can use boto3, you need to set up authentication credentials for your AWS account using the AWS CLI.

You can install AWS CLI using pip:

pip install awscli
aws configure

AWS Access Key ID and AWS Secret Access Key: You can find these on your AWS account. If you don't have one, you can generate it from the AWS Management Console.

Default region name: The region to which AWS CLI directs its requests. You can set any region you want. For example, us-west-2.

Default output format: The output format for AWS CLI. You can set json.

Dependencies

pip install boto3 loguru

Usage

To use this script, simply run it.

python main.py

WARNING: Be very cautious when using this script as it deletes resources.

Resources Deleted This script deletes the following AWS resources in every AWS region:

Amazon EC2:

  • delete_instances
  • delete_key_pairs
  • delete_amis
  • delete_launch_templates
  • delete_efs_file_systems
  • delete_efs
  • delete_elastic_ip

Amazon VPC:

  • delete_peering_connection
  • delete_load_balancer_listener
  • delete_load_balancer
  • delete_target_groups
  • delete_route_tables
  • delete_network_interface
  • delete_sg
  • delete_sgr
  • delete_vpc
  • delete_subnets
  • delete_endpoint
  • delete_internet_gateway

Amazon Redshift:

  • delete_redshift_serverless_namespace
  • delete_all_redshift_clusters
  • delete_redshift_subnet_groups

Amazon RDS:

  • delete_db_instance_automated_backups
  • delete_db_cluster_snapshots
  • delete_all_rds_automated_backups
  • delete_rds_option_groups
  • delete_db_cluster_parameter_groups
  • delete_rds_parameter_groups
  • delete_rds_subnet_groups
  • delete_rds
  • delete_db_instances

AWS Lambda:

  • delete_lambda_layers
  • delete_lambda_functions

Amazon ECS:

  • delete_ecs_tasks
  • delete_ecs_cluster
  • delete_ecs_clusters

Amazon ECR:

  • delete_ecr

Amazon S3:

  • delete_s3_buckets
  • Amazon DynamoDB:

Amazon DynamoDB

  • delete_dynamodb_tables
  • delete_dynamodb_backup

Amazon Kinesis:

  • delete_all_kinesis_data_streams
  • delete_firehose_delivery_streams
  • delete_all_firehose_streams

Amazon SageMaker:

  • delete_all_notebook_instances

Amazon SQS:

Amazon IAM:

  • delete_all_roles(disabled)

AWS Cloud Map

  • delete_namespaces

AWS SNS

  • delete_sns_topics

AWS Cognito

  • delete_cognito_user_pools
  • delete_cognito_identity_pools

AWS Athena

  • delete_athena_saved_queries

AWS API Gateway

  • delete_api_gateways

AWS Config

  • delete_config_recorders_and_delivery_channels

License This project is licensed under the MIT License. See the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aws_delete_all-0.5.56.tar.gz (27.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aws_delete_all-0.5.56-py3-none-any.whl (27.7 kB view details)

Uploaded Python 3

File details

Details for the file aws_delete_all-0.5.56.tar.gz.

File metadata

  • Download URL: aws_delete_all-0.5.56.tar.gz
  • Upload date:
  • Size: 27.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for aws_delete_all-0.5.56.tar.gz
Algorithm Hash digest
SHA256 9e9d701c888d6832fddcc08b8415f1bcdb9fc71d77f7be918d8fa7e384980743
MD5 009913233c5aee00416ed395cf007e70
BLAKE2b-256 83fed1848acd1d3bdf65467e5e7d4fc13b2f373a96b6c55b63a87c61a9c406b1

See more details on using hashes here.

Provenance

The following attestation bundles were made for aws_delete_all-0.5.56.tar.gz:

Publisher: publish-to-pypi.yml on sinanartun/aws_delete_all

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file aws_delete_all-0.5.56-py3-none-any.whl.

File metadata

  • Download URL: aws_delete_all-0.5.56-py3-none-any.whl
  • Upload date:
  • Size: 27.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for aws_delete_all-0.5.56-py3-none-any.whl
Algorithm Hash digest
SHA256 14c83ec255890e22c8ecdcb1bf1e015a0977bca302d71ee8be642fba74d69cff
MD5 2b0a1275aa70cc7df6732c5e22c2989b
BLAKE2b-256 e8322eb97dc507aa89da47d6f32ff051f3f8b8cf15168efe5250dfbb8174044c

See more details on using hashes here.

Provenance

The following attestation bundles were made for aws_delete_all-0.5.56-py3-none-any.whl:

Publisher: publish-to-pypi.yml on sinanartun/aws_delete_all

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page