https://github.com/adarsh-agrawal123/cloud-computing___ec2_s3
A Flask-based web app to securely upload files to AWS S3 and generate expiring shareable links.
https://github.com/adarsh-agrawal123/cloud-computing___ec2_s3
aws aws-ec2 aws-s3 boto3 cloud-storage file-sharing flask presigned-url python secure-file-transfer webapp
Last synced: about 2 months ago
JSON representation
A Flask-based web app to securely upload files to AWS S3 and generate expiring shareable links.
- Host: GitHub
- URL: https://github.com/adarsh-agrawal123/cloud-computing___ec2_s3
- Owner: adarsh-agrawal123
- Created: 2025-09-13T09:01:46.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2025-09-13T09:27:27.000Z (9 months ago)
- Last Synced: 2025-09-13T12:23:21.179Z (9 months ago)
- Topics: aws, aws-ec2, aws-s3, boto3, cloud-storage, file-sharing, flask, presigned-url, python, secure-file-transfer, webapp
- Language: Python
- Homepage:
- Size: 4.58 MB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# π Simple File Sharing (AWS EC2 + S3)
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.
---
## β¨ Features
- π€ 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
---
## π οΈ Run Locally (optional)
```bash
# 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/](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!).
---
## βοΈ Environment Variables
| 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 |
---
## π Security Notes
- 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)
---
## π¦ Tech Stack
- [Python 3](https://www.python.org/)
- [Flask](https://flask.palletsprojects.com/)
- [Boto3](https://boto3.amazonaws.com/)
- [AWS S3 + EC2](https://aws.amazon.com/)