Skip to main content

tool-aws

Build Status

Macro CMDs for managing AWS resources

Installation

$ pip install tool_aws

Usage

Batch delete files in S3 by listing content iteratively with a prefix.

$ s3rm --bucket-name ${BUCKET_NAME} --prefix ${PATH}

Batch delete tiles in S3 using a bbox in LV95:

$ s3rm --bucket-name ${BUCKET_NAME} --prefix /1.0.0/ch.swisstopo.fixpunkte-agnes/default/current/2056/* --bbox 2671000,1139000,2712250,1158500 --image-format png

You can always use the help function:

$ s3rm --help
usage: s3rm [-h] -b BUCKETNAME -p PREFIX [--profile PROFILENAME] [--bbox BBOX]
            [-n NBTHREADS] [-s CHUNKSIZE] [-i IMAGEFORMAT] [-lr LOWRES]
            [-hr HIGHRES] [-f]

Purpose:
    This script is intended for efficient and MASSIVE RECURSIVE
    DELETION of S3 'folders'. This mean that any resource matching with
    the PREFIX variable, will be DELETED IRREVERSIVELY.

    Use this script CAREFULLY.

optional arguments:
  -h, --help            show this help message and exit

Mandatory arguments:
  -b BUCKETNAME, --bucket-name BUCKETNAME
                        bucket name
  -p PREFIX, --prefix PREFIX
                        Prefix (string) relative to the bucket base path.

Program options:
  --profile PROFILENAME
                        AWS profile
  --bbox BBOX           a bounding box in lv95
  -n NBTHREADS, --threads-number NBTHREADS
                        Number of threads (subprocess), default: machine
                        number of CPUs
  -s CHUNKSIZE, --chunk-size CHUNKSIZE
                        Chunk size for S3 batch deletion, default is set to
                        1000 (maximal value for S3)
  -i IMAGEFORMAT, --image-format IMAGEFORMAT
                        The image format
  -lr LOWRES, --lowest-resolution LOWRES
                        The lowest resolution in meters
  -hr HIGHRES, --highest-resolution HIGHRES
                        The highest resolution in meters
  -f, --force           force the removal, i.e. no prompt for confirmation.

Disclaimer:
    This software is provided "as is" and
    is not granted to work in particular cases or without bugs.
    The author disclaims any responsability in case of data loss,
    computer damage or any other bad issue that could arise
    using this software.

Setup in dev mode

$ python3 -m env .venv $ source .venv/bin/activate $ pip install -e . $ pip install -r dev-requirements.txt

To launch the tests:

$ nosetests tests/

Style

Control styling:

$ flake8 tool_aws/ tests/

Autofix mistakes:

$ find tool_aws/* tests/* -type f -name '*.py' -print | xargs autopep8 --in-place --aggressive --aggressive --verbose

Metadata

Release files for tool-aws 0.2.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tool-aws 0.2.6
File Size Uploaded Provenance Actions
tool_aws-0.2.6.tar.gz 10.7 kB Without provenance Details for tool_aws-0.2.6.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for tool-aws 0.2.6
File Interpreter ABI Platform Actions
tool_aws-0.2.6-py3-none-any.whl Python 3 none any Details for tool_aws-0.2.6-py3-none-any.whl

Total release size: 20.9 kB

Release files / tool_aws-0.2.6.tar.gz

Download URL tool_aws-0.2.6.tar.gz
Size 10.7 kB
Tags Source
SHA-256 checksum
How to use checksums
0619360fedbbd91a60a824c27e73c3b5b88e2dbd6fe38c97ac98c9215efb8ec2
BLAKE2b-256 checksum
How to use checksums
e8229bb00e912128730d1fe5c085b27aeed9bf7e684f8ad8b139d2a219ec8d4f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.8.10

Release files / tool_aws-0.2.6-py3-none-any.whl

Download URL tool_aws-0.2.6-py3-none-any.whl
Size 10.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
54378265d89b71ff01694b14fbe4cf3c4f2d581979e3c3e79d5d07850bc3fb80
BLAKE2b-256 checksum
How to use checksums
3b2f7c128766a1c6b0562b631d4c90ce68981f2dd68f579845465fc3e7326b8d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.8.10

Security for tool-aws 0.2.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page