A lightweight Flask web app that lets you upload files to Amazon S3 and instantly get a temporary (pre-signed) download link.
Perfect for sharing files securely without exposing your S3 bucket.
- ๐ค Upload files directly from your browser
- ๐ Files are stored in a private S3 bucket
- โฑ๏ธ Generates pre-signed download links with expiration
- โก Deployable on AWS EC2 in minutes
- ๐ Simple Python + Flask stack
# Create and activate a virtual environment
python3 -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Set environment variables
export BUCKET_NAME=your-bucket-name
export AWS_REGION=ap-south-1 # change if needed
# Run the app
python app.py
Now open ๐ http://127.0.0.1:5000/
โ ๏ธ If running locally, make sure AWS credentials are configured (aws configure
) or provided via environment variables.
On EC2, use an IAM instance role (no hardcoded keys!).
Variable | Required | Default | Description |
---|---|---|---|
BUCKET_NAME |
โ Yes | โ | Your S3 bucket name |
AWS_REGION |
โ No | ap-south-1 | AWS region |
DEFAULT_EXPIRY_SECONDS |
โ No | 3600 (1h) | Default link lifetime |
MAX_EXPIRY_SECONDS |
โ No | 86400 (24h) | Max link lifetime |
MAX_CONTENT_LENGTH |
โ No | 50MB | Max upload size |
- Keep the S3 bucket private (
Block Public Access = ON
) - Files are only accessible through pre-signed URLs
- For production:
- Use Gunicorn + Nginx (instead of Flaskโs dev server)
- Enable HTTPS (e.g., via Letโs Encrypt)