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 directoriess3_transfer.py: File transfer operations between S3 and local storages3_dataframe_reader.py: Functions for reading files into pandas DataFramess3_structure.py: S3 bucket structure managements3_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
- Create a
.envfile in your project root - Add your AWS credentials:
AWS_ACCESS_KEY_ID=your_access_key
AWS_SECRET_ACCESS_KEY=your_secret_key
AWS_DEFAULT_REGION=your_region
Contributing
- Fork the repository
- Create your feature branch
- Commit your changes with descriptive commit messages
- Push to your branch
- 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
- Email: juneyoungpaak@gmail.com
- Location: TWO IFC, Yeouido, Seoul
Metadata
Release files for aws-s3-controller 0.7.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| aws_s3_controller-0.7.5.tar.gz | 9.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| aws_s3_controller-0.7.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 20.5 kB
Release files / aws_s3_controller-0.7.5.tar.gz
| Download URL | aws_s3_controller-0.7.5.tar.gz |
|---|---|
| Size | 9.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d5b797c50e919569fb5e37c03310d68c7457c526edec19728e7328518274e8ca
|
|
BLAKE2b-256 checksum How to use checksums |
1fbe5b7560aa624854d9876b15c448c5e27b763941927bf237c7197b5da8b2ab
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.9
|
Release files / aws_s3_controller-0.7.5-py3-none-any.whl
| Download URL | aws_s3_controller-0.7.5-py3-none-any.whl |
|---|---|
| Size | 10.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
dc977d57a94f8f3fbbafbb134f09c9ce63e6d3b2c26e702d4e6d69189a23b7fc
|
|
BLAKE2b-256 checksum How to use checksums |
6f4ca4a26dc6d350b5da17850056d4383d4368dc67082dc8c19eebc53135aeca
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.9
|