Skip to main content

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

Project description

AWS Automations - Multi-Service Cleanup

CI PyPI

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

Smoke Test

Quick verification that install and CLI wiring are healthy:

python3 -m pip install --upgrade aws-automations
aws-cleanup --help
aws-menu --help
python3 -c "from importlib.metadata import version; print(version('aws-automations'))"

Security Checks

  • CI runs Bandit static security analysis on aws_automations (Python 3.11 job).
  • Failing threshold is set to medium-or-higher severity/confidence.
bandit -r aws_automations --severity-level medium --confidence-level medium

Changelog

See CHANGELOG.md for versioned release notes.

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.2.tar.gz (22.0 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.2-py3-none-any.whl (26.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: aws_automations-0.1.2.tar.gz
  • Upload date:
  • Size: 22.0 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.2.tar.gz
Algorithm Hash digest
SHA256 0b4f9faff87640c0179e20e660eda33a3f99db7ff598fabdba2bc48f818e6a29
MD5 9d1a4224a7b81a9b805e2a4221ca1353
BLAKE2b-256 b1adf6fe96207aa3c2c9086a2bb2e2fca174e6ab5f0181a6e429443599ee0f85

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for aws_automations-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a5723dc0ffe2bea00764e18bb930f42b7b8f3caf4c9dc0af78c505d35f615e71
MD5 f755f8df6951f41c9f865b8fbfbc5030
BLAKE2b-256 ae32773e7c16f13428ba549b65ef377e4c43fa61f6e33935a218a30bc5147e7b

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