Skip to main content

A collection of natural language-like utility functions to intuitively and easily control AWS's cloud object storage resource, S3.

Project description

AWS S3 Controller

A collection of natural language-like utility functions to intuitively and easily control AWS's cloud object storage resource, S3.

  • Control S3. Manage, interact with, and handle S3 just like your local storage.
  • *AWS: Amazon Web Services
    *S3: Simple Storage Service in AWS

Features

  • File Scanning: Search files in S3 buckets and local directories using regex patterns
  • File Transfer: Upload, download, and relocate files between S3 buckets and local directories
  • Data Processing: Read CSV and Excel files directly from S3 into pandas DataFrames
  • Bucket Management: Create and manage S3 bucket structure
  • Special Operations: Handle specific use cases like timeseries data processing

Installation

pip install -r requirements.txt

Module Structure

The module is organized into several specialized components:

  • s3_scanner.py: File search functionality in S3 buckets and local directories
  • s3_transfer.py: File transfer operations between S3 and local storage
  • s3_dataframe_reader.py: Functions for reading files into pandas DataFrames
  • s3_structure.py: S3 bucket structure management
  • s3_special_operations.py: Special purpose functions for specific operations

Usage Examples

Scanning Files

from aws_s3_controller import scan_files_in_bucket_by_regex

# Find all CSV files in a bucket
files = scan_files_in_bucket_by_regex(
    bucket="my-bucket",
    bucket_prefix="data",
    regex=r".*\.csv$",
    option="key"
)

Transferring Files

from aws_s3_controller import download_files_from_s3, upload_files_to_s3

# Download files matching a pattern
download_files_from_s3(
    bucket="my-bucket",
    regex=r".*\.csv$",
    file_folder_local="./downloads",
    bucket_prefix="data"
)

# Upload files to S3
upload_files_to_s3(
    file_folder_local="./uploads",
    regex=r".*\.xlsx$",
    bucket="my-bucket",
    bucket_prefix="excel-files"
)

Reading Data

from aws_s3_controller import open_df_in_bucket, open_excel_in_bucket

# Read CSV file
df = open_df_in_bucket(
    bucket="my-bucket",
    bucket_prefix="data",
    file_name="example.csv"
)

# Read Excel file
df = open_excel_in_bucket(
    bucket="my-bucket",
    bucket_prefix="excel",
    file_name="example.xlsx"
)

Dependencies

  • boto3
  • pandas
  • python-dotenv
  • xlrd (for Excel file support)
  • shining_pebbles

Configuration

  1. Create a .env file in your project root
  2. Add your AWS credentials:
AWS_ACCESS_KEY_ID=your_access_key
AWS_SECRET_ACCESS_KEY=your_secret_key
AWS_DEFAULT_REGION=your_region

Contributing

  1. Fork the repository
  2. Create your feature branch
  3. Commit your changes with descriptive commit messages
  4. Push to your branch
  5. Create a Pull Request

Author

June Young Park
AI Management Development Team Lead & Quant Strategist at LIFE Asset Management

LIFE Asset Management is a hedge fund management firm that integrates value investing and engagement strategies with quantitative approaches and financial technology, headquartered in Seoul, South Korea.

Contact

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_s3_controller-0.7.5.tar.gz (9.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_s3_controller-0.7.5-py3-none-any.whl (10.8 kB view details)

Uploaded Python 3

File details

Details for the file aws_s3_controller-0.7.5.tar.gz.

File metadata

  • Download URL: aws_s3_controller-0.7.5.tar.gz
  • Upload date:
  • Size: 9.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.9

File hashes

Hashes for aws_s3_controller-0.7.5.tar.gz
Algorithm Hash digest
SHA256 d5b797c50e919569fb5e37c03310d68c7457c526edec19728e7328518274e8ca
MD5 e2e2f7decf958ea8e1feefdfb112b111
BLAKE2b-256 1fbe5b7560aa624854d9876b15c448c5e27b763941927bf237c7197b5da8b2ab

See more details on using hashes here.

File details

Details for the file aws_s3_controller-0.7.5-py3-none-any.whl.

File metadata

File hashes

Hashes for aws_s3_controller-0.7.5-py3-none-any.whl
Algorithm Hash digest
SHA256 dc977d57a94f8f3fbbafbb134f09c9ce63e6d3b2c26e702d4e6d69189a23b7fc
MD5 924316a16f964d0b5eba6ac5d1ab1b7c
BLAKE2b-256 6f4ca4a26dc6d350b5da17850056d4383d4368dc67082dc8c19eebc53135aeca

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