A lightweight Flask microservice that generates AWS S3 presigned URLs for secure audio file uploads.
https://github.com/davidbmar/TranscriptionAPI-S3-backend · public · shipped
This project is a Python-based backend component designed to facilitate the upload of transcription content. It acts as an intermediary between a client application and an AWS S3 bucket. Instead of handling large binary data directly, the service authenticates requests and returns short-lived, presigned URLs. Clients use these URLs to upload audio files directly to S3, reducing server load and bandwidth usage while maintaining security through temporary credentials.
pip install flask boto3 python-dotenv export AWS_ACCESS_KEY_ID=your_key export AWS_SECRET_ACCESS_KEY=your_secret export S3_BUCKET_NAME=your-bucket-name python src/AudioTranscriptionAPI.py
flowchart TD
Client[Client App] -->|HTTP GET /upload-url| FlaskApp[Flask Service]
FlaskApp -->|Generate Presigned URL| Boto3[Boto3 SDK]
Boto3 -->|Sign Request| AWS_S3[AWS S3 Bucket]
Client -->|HTTP PUT Audio File| AWS_S3
subgraph Configuration
Env[Environment Variables]
end
Env --> FlaskApp
The application is built using Flask for the HTTP server layer and Boto3 for AWS SDK interactions. It relies on environment variables for configuration, including the target S3 bucket name, AWS region, and presigned URL expiration time. The core logic involves validating incoming requests, generating a unique key (UUID) for each upload, and using the Boto3 client to create a presigned PUT URL with a configurable timeout.
sequenceDiagram
participant C as Client
participant F as Flask App
participant B as Boto3
participant S as AWS S3
C->>F: GET /generate-presigned-url
F->>F: Generate UUID for filename
F->>B: generate_presigned_url('put_object')
B-->>F: Return Presigned URL
F-->>C: JSON { url: '...', key: '...' }
C->>S: PUT audio/file.mp3 (using Presigned URL)
S-->>C: 200 OK
Deploy this service in environments where you need to accept audio uploads without managing the storage infrastructure yourself. It is suitable for integration into larger transcription pipelines where the frontend or mobile app needs a secure way to push raw audio data to cloud storage before triggering processing jobs. Configure it with your specific AWS credentials and bucket details via environment variables.
✓ all on main — nothing unmerged.