Skip to main content

BucketIt is a CLI tool for uploading files to S3 bucket.

Project description

BucketIt

BucketIt is a command line interface (CLI) tool that simplifies uploading files to S3 bucket. It can be used for uploading a single file, multiple files in a directory, or all files in a directory recursively.

Prerequisites

  • Python 3
  • Boto3
  • An S3 account with credentials

Installation

Through PyPI:

pip3 install bucketit

Alternatively, you can clone the repository and install the dependencies manually.

Clone the repository:

git clone https://github.com/sazonovanton/BucketIt.git

To install the dependencies for BucketIt, run the following command from the BucketIt directory:

pip3 install -r requirements.txt

You can create a .bucketit_config file by running script once or copying and changing the bucketit_config.example file to your home directory (C:\Users\username on Windows, /home/username on Linux).

IMPORTANT: Access key and secret key stored in configuration file as a plain text.

Configuration

BucketIt requires a configuration file to run. The configuration file should be in INI file format and should contain the following fields:

[S3]
endpoint_url = <endpoint_url>
access_key = <access_key>
secret_key = <secret_key>
bucket_default = <bucket_default>
  • endpoint_url - The endpoint URL for your S3 service.
  • access_key - Your S3 access key.
  • secret_key - Your S3 secret key.
  • bucket_default - (Optional) The default bucket to use for uploads. If not specified, you will be prompted for the bucket name when you run BucketIt.

If the configuration file does not exist or cannot be read, BucketIt will prompt you to create a new configuration file. WARNING: Access key and secret key stored in configuration file as a plain text.

Usage

usage: bucketit [-h] [--filename FILENAME] [--date] [--folder FOLDER] [-r] [-b BUCKET] [-v] [--version] [--nofolder] file

BucketIt is a simple tool for uploading files to S3. 
See README for more details.

positional arguments:
  file                  Path to the file you want to upload

optional arguments:
  -h, --help            show this help message and exit
  --filename FILENAME   Filename to use in the bucket. If not specified, the original filename will be used
  --date                Add date in a format of YYYY/MM/DD before the filename in bucket
  --folder FOLDER       Folder to upload the file to. If not specified, the file will be uploaded to the root of the bucket
  -r, --recursive       Upload all files in the directory recursively
  -b BUCKET, --bucket BUCKET
                        Bucket name to upload the file to. If not specified, the default bucket will be used
  -v, --verbose         Verbose output
  --version             Tool version
  --nofolder            Do not create a folder with the same name as the folder with files if recursive is set

To upload a file to an S3 bucket, run the following command:

bucketit path/to/file

You can specify the following options:

  • --filename - Filename to use in the bucket. If not specified, the original filename will be used.
  • --date - Add date in a format of YYYY/MM/DD before the filename in bucket.
  • --folder - Folder to upload the file to. If not specified, the file will be uploaded to the root of the bucket.
  • -r or --recursive - Upload all files in the directory recursively.
  • --nofolder - Do not create a folder with the same name as the folder with files if recursive is set.
  • -b or --bucket - Bucket name to upload the file to. If not specified, the default bucket will be used.
  • -v or --verbose - Verbose output.

By default, the file will be uploaded to the default bucket specified in the configuration file. If no default bucket is specified, you will be prompted for the bucket name when you run BucketIt.

You can also use the --date option to enable adding the current date to the filename in the bucket. This is useful if you want to keep a history of your files. For example, if you run the following command:

python3 bucketit.py path/to/file --date

The file will be uploaded to the bucket with the following filename:

2020/01/01/file

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

bucketit-0.4.tar.gz (5.2 kB view details)

Uploaded Source

File details

Details for the file bucketit-0.4.tar.gz.

File metadata

  • Download URL: bucketit-0.4.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.10

File hashes

Hashes for bucketit-0.4.tar.gz
Algorithm Hash digest
SHA256 0112a1bd8a258b3dc951d7eb3f010425fd7b905969f50db7f0bcf0a53261b31a
MD5 7f9fc4d46f633f9ca73ce3cf9a144359
BLAKE2b-256 f0fc220bf42f996cb8cfe5c36dfbfe41fa8e26e158ef5f6735b1449c40074ff8

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