Skip to content

adarsh-agrawal123/Cloud-computing___EC2_S3

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

4 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿš€ 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)

# 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!).


โš™๏ธ 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

About

A Flask-based web app to securely upload files to AWS S3 and generate expiring shareable links.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published