Skip to main content

Multi-service AWS resource cleanup automation with dry-run safety

Project description

AWS Automations - Multi-Service Cleanup

Portfolio-ready AWS cleanup tool with safe defaults, dry-run first, and a live CLI view.

Highlights

  • Multi-service cleanup for S3, EC2, Lambda, EBS, CloudWatch, and IAM
  • Dry-run by default; --apply required for deletions
  • Filters: prefixes, target/ignore lists, optional tag requirement
  • Age gates for buckets/objects; supports versioned buckets
  • Live Rich table (opt-out with --no-live) plus JSON output when needed
  • Safety switches to guard zero retention and delete-all modes
  • Interactive per-bucket approval and batched deletes

Setup

python3 -m venv .venv
source .venv/bin/activate
pip install -U pip
pip install -e ".[dev]"

Runtime-only (no dev tools):

pip install -e .

Configure

Copy config.example.yaml to config.yaml and adjust:

  • bucket_prefixes, target_buckets, ignore_buckets
  • bucket_retention_days, object_retention_days, delete_all_objects
  • include_versioned_objects, delete_empty_buckets
  • Optional require_tag: { key, value }

Run (S3 direct)

Dry-run (default):

python -m aws_automations.s3_cleanup --config config.yaml

Plan view (no apply) with live table on TTY:

python -m aws_automations.s3_cleanup --config config.yaml --plan --live

Apply deletions for specific buckets:

python -m aws_automations.s3_cleanup --config config.yaml --apply \
  --bucket sandbox-a --bucket sandbox-b

Interactive approval per bucket:

python -m aws_automations.s3_cleanup --config config.yaml --apply --interactive

JSON summary (suppresses live UI):

python -m aws_automations.s3_cleanup --config config.yaml --plan --json

One-off include/exclude without editing config:

python -m aws_automations.s3_cleanup --config config.yaml --include temp-bucket --exclude ignore-me

Toggle live rendering:

python -m aws_automations.s3_cleanup --config config.yaml --no-live

Run (Interactive Menu)

Start the interactive menu for guided cleanup:

aws-menu

Or run directly:

python -m aws_automations.start

Run (multi-service orchestrator)

Clean up one or all services with a live table (default on TTY):

aws-cleanup --config config.yaml --service all --live

Or run via module:

python -m aws_automations.main --config config.yaml --service all --live

Focus on a single service (e.g., EC2) in dry-run:

python -m aws_automations.main --config config.yaml --service ec2

Emit JSON summary (suppresses live UI):

python -m aws_automations.main --config config.yaml --service lambda --json

Safety switches:

  • --force-zero-retention required with --apply when object_retention_days <= 0
  • --force-delete-all required with --apply when delete_all_objects: true

Add --verbose for debug logs.

Tests

python -m pytest

Notes

  • Uses paginated, batched deletes (S3 limits batches to 1,000 objects).
  • Live UI is disabled automatically for JSON output or when stdout is not a TTY.
  • Keep AWS credentials scoped to the buckets you intend to manage.

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_automations-0.1.0.tar.gz (21.2 kB view details)

Uploaded Source

Built Distribution

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

aws_automations-0.1.0-py3-none-any.whl (26.1 kB view details)

Uploaded Python 3

File details

Details for the file aws_automations-0.1.0.tar.gz.

File metadata

  • Download URL: aws_automations-0.1.0.tar.gz
  • Upload date:
  • Size: 21.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for aws_automations-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b77dc32a76aec5660b328cca03b70c1caa75d059bef024b2497381a0ec49af24
MD5 5988b52c1a9d097ed3fedf6754ff9ea0
BLAKE2b-256 29c024f7681371bcb78b3301af653095b40cad70f1d8972a65c041a6a24b6a1f

See more details on using hashes here.

File details

Details for the file aws_automations-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for aws_automations-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c33a8481d0d825ae55d0de072d3549b34622f475361a57fc27508249c9bcb08c
MD5 18e4f5b601256c3b0a1bc7b0b6a4a7b4
BLAKE2b-256 eb13a9490351b98341126268d0a4040796a477f0c32ab7fdb49eaf6ae7f281fa

See more details on using hashes here.

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