# ๐Ÿ“ฆ Mini Dropbox โ€” Cloud File Storage on AWS > A fully functional cloud file storage platform built on AWS โ€” mimicking core Dropbox features including file upload, download, delete, and shareable links with Google OAuth authentication. > **App URL:** `https://dzn1pcqz3oqep.cloudfront.net/files/` > **Status: Not Live** on AWS EC2 (ap-south-1 ยท Mumbai) --- ## ๐Ÿ“ธ Screenshots > All build screenshots are available in the [`/images`](./images) folder, numbered `1` through `45` in chronological build order. ### Login Page ![Login](./images/mini-dropbox-24.png) -------- ### Dashboard ![Dashboard](./images/mini-dropbox-25.png) --- ### File upload ![File upload](./images/mini-dropbox-35.png) --- ### Dashboard view with files ![Dashboard view with uploaded files](./images/mini-dropbox-36.png) --- ### Share link ![Sharing PreSigned URL](./images/mini-dropbox-37.png) --- ### Preview Link Fron mini-dropbox ![Preview Link](./images/mini-dropbox-38.png) --- ## ๐Ÿงฐ Tech Stack | Layer | Technology | |---|---| | Backend | Python 3.11 + Flask | | Frontend | HTML5 + Tailwind CSS + Vanilla JS | | Auth | Google OAuth 2.0 (Authlib) | | File Storage | AWS S3 | | Database | AWS RDS PostgreSQL 16 | | CDN | AWS CloudFront | | Web Server | Nginx + Gunicorn | | Compute | AWS EC2 (Ubuntu 22.04) | | Monitoring | AWS CloudWatch | --- ## โ˜๏ธ AWS Architecture ``` โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ INTERNET โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ โ”‚ HTTPS / HTTP โ–ผ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ AWS CLOUD (ap-south-1 ยท Mumbai) โ”‚ โ”‚ โ”‚ โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ โ”‚ โ”‚ DEFAULT VPC โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ CloudFront (CDN) โ”‚ โ—„โ”€โ”€ Static files & previews โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ (Global Edge Cache) โ”‚ served globally โ”‚ โ”‚ โ”‚ โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ Origin request โ”‚ โ”‚ โ”‚ โ”‚ โ–ผ โ”‚ โ”‚ โ”‚ โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ EC2 (t2.micro ยท Ubuntu 22.04) โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ Security Group: mini-dropbox-ec2-sg โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ Ports: 22 (SSH) ยท 80 (HTTP) ยท 5000 โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ Nginx โ”‚โ”€โ”€โ”€โ”€โ”€โ”€โ–บโ”‚ Gunicorn (WSGI) โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ (Port 80) โ”‚ โ”‚ 2 workers ยท Port 5000 โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ Rev. Proxy โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ–ผ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ โ”‚ | โ”‚ โ”‚ โ”‚ โ”‚ Flask Application โ”‚ โ”‚ โ”‚ | โ”‚ โ”‚ โ”‚ โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ โ”‚ โ”‚ | โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ auth.py โ”‚ โ”‚ โ”‚ โ”‚ | โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ Google OAuth โ”‚ โ”‚ โ”‚ โ”‚ | โ”‚ โ”‚ โ”‚ โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ โ”‚ โ”‚ | โ”‚ โ”‚ โ”‚ โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ โ”‚ โ”‚ | โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ files.py โ”‚ โ”‚ โ”‚ โ”‚ | โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ upload/delete โ”‚ โ”‚ โ”‚ โ”‚ | โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ share/preview โ”‚ โ”‚ โ”‚ โ”‚ | โ”‚ โ”‚ โ”‚ โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ โ”‚ โ”‚ | โ”‚ โ”‚ โ”‚ โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ โ”‚ โ”‚ | โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ s3.py + db.py โ”‚ โ”‚ โ”‚ โ”‚ | โ”‚ โ”‚ โ”‚ โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ โ”‚ โ”‚ | โ”‚ โ”‚ โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ โ”‚ | โ”‚ โ”‚ โ”‚ IAM Role attached โ”‚ โ”‚ โ”‚ โ”‚ | โ”‚ โ”‚ โ”‚ (No hardcoded keys) โ”‚ โ”‚ โ”‚ โ”‚ | โ”‚ โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ | โ”‚ โ”‚ โ”‚ โ”‚ | โ”‚ โ”‚ โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”| | โ”‚ โ”‚ | | โ”‚ โ”‚ โ”‚ S3 API (boto3) psycopg2 :5432 โ”‚ โ”‚ โ”‚ โ”‚ โ–ผ โ–ผ โ”‚ โ”‚ โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ โ”‚ โ”‚ โ”‚ AWS S3 โ”‚ โ”‚ RDS PostgreSQL 16 โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ mini-dropbox-files โ”‚ โ”‚ mini-dropbox-db โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ (db.t3.micro) โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ โ”‚ SG: rds-sg โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ user_id/uuid_ โ”‚ โ”‚ โ”‚ (only EC2 SG allowed) โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ filename.ext โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ (private) โ”‚ โ”‚ โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ โ”‚ โ”‚ users table โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ files table โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ Access via: โ”‚ โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ Pre-signed URLs โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ โ”‚ โ”‚ โ”‚ (15min download) โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ (7day share link) โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ โ”‚ โ”‚ โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ โ”‚ โ”‚ IAM โ”‚ โ”‚ CloudWatch โ”‚ โ”‚ Google OAuth โ”‚ โ”‚ โ”‚ โ”‚ EC2 Role โ”‚ โ”‚ Monitoring โ”‚ โ”‚ (External ยท HTTPS) โ”‚ โ”‚ โ”‚ โ”‚ S3 Access โ”‚ โ”‚ Logs+Alarms โ”‚ โ”‚ email+profile+id โ”‚ โ”‚ โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ โ”‚ โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ ``` ### Request Flow ``` Upload File Download / Share โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Browser Browser โ”‚ POST /files/upload โ”‚ GET /files/download/ โ–ผ โ–ผ Nginx โ†’ Flask Nginx โ†’ Flask โ”‚ secure_filename() โ”‚ verify ownership (RDS) โ”‚ generate s3_key โ”‚ generate pre-signed URL โ–ผ โ–ผ S3 (store file) S3 (generate temp URL) โ”‚ โ”‚ โ–ผ โ–ผ RDS (store metadata) Redirect โ†’ Browser downloads ``` ### Security Design ``` Internet โ”‚ โ”‚ โœ… HTTP/HTTPS only โ–ผ EC2 (mini-dropbox-ec2-sg) โ”‚ Port 22 โ† Your IP only (SSH) โ”‚ Port 80 โ† Anyone (web traffic) โ”‚ โ”‚ โœ… IAM Role โ€” no AWS keys in code โ”‚ โœ… Pre-signed URLs โ€” S3 never public โ–ผ RDS (mini-dropbox-rds-sg) โ”‚ Port 5432 โ† EC2 Security Group ONLY โ”‚ (not open to internet) โ–ผ S3 Bucket โ”‚ Block All Public Access โœ… โ”‚ CORS configured โœ… โ”‚ SSE-S3 Encryption โœ… ``` --- ## โœจ Features | Feature | Description | |---|---| | ๐Ÿ” Google Sign In | OAuth 2.0 login โ€” no password needed | | ๐Ÿ“ค File Upload | Drag & drop or click to upload, up to 100MB | | ๐Ÿ“‹ File Dashboard | View all your files with type, size, and upload date | | โฌ‡๏ธ Download | Secure time-limited pre-signed S3 URL (15 min) | | ๐Ÿ—‘๏ธ Delete | Remove file from S3 and metadata from RDS instantly | | ๐Ÿ”— Share Link | Generate a 7-day shareable pre-signed URL | | ๐Ÿ‘๏ธ Preview | Open images and PDFs directly in browser via CloudFront | | ๐Ÿ“Š File Icons | Visual icons per file type (PDF, image, video, zip, etc.) | --- ## ๐Ÿ—‚๏ธ Project Structure ``` mini-dropbox/ |---CODE โ”œโ”€โ”€ app/ โ”‚ โ”œโ”€โ”€ __init__.py # Flask app factory โ”‚ โ”œโ”€โ”€ config.py # Environment config โ”‚ โ”œโ”€โ”€ auth.py # Google OAuth routes โ”‚ โ”œโ”€โ”€ files.py # Upload, download, delete, share routes โ”‚ โ”œโ”€โ”€ db.py # RDS PostgreSQL operations โ”‚ โ”œโ”€โ”€ s3.py # S3 operations + pre-signed URLs โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ templates/ โ”‚ โ”‚ โ”œโ”€โ”€ base.html # Base layout with navbar โ”‚ โ”‚ โ”œโ”€โ”€ login.html # Google Sign-In page โ”‚ โ”‚ โ””โ”€โ”€ dashboard.html # File manager UI โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ static/ โ”‚ โ”œโ”€โ”€ css/style.css # Custom styles โ”‚ โ””โ”€โ”€ js/dashboard.js # Upload, delete, share, preview logic โ”‚ โ”œโ”€โ”€ sql/ โ”‚ โ””โ”€โ”€ schema.sql # RDS table definitions โ”‚ โ”œโ”€โ”€ docs/ โ”‚ โ””โ”€โ”€ screenshots/ # UI screenshots โ”‚ โ”œโ”€โ”€ .env.example # Environment variable template โ”œโ”€โ”€ requirements.txt # Python dependencies โ”œโ”€โ”€ run.py # App entry point โ”œโ”€โ”€ gunicorn.conf.py # Production server config โ””โ”€โ”€ README.md ``` --- ## ๐Ÿ—„๏ธ Database Schema ```sql -- Users (from Google OAuth) users (id, google_id, email, name, profile_picture, created_at) -- Files (metadata only โ€” actual files live in S3) files (id, user_id, filename, original_name, s3_key, file_size, file_type, uploaded_at, share_token) ``` --- ## ๐Ÿš€ How to Deploy ### Prerequisites - AWS Account with Free Tier - Google Cloud Console account - EC2 instance (Ubuntu 22.04, t2.micro) - RDS PostgreSQL instance (db.t3.micro) - S3 bucket (private) ### 1. Clone the repo ```bash git clone https://github.com/ADITYANAIR01/AWS.git cd mini-dropbox ``` ### 2. Install dependencies ```bash sudo apt update && sudo apt install -y python3 python3-pip nginx postgresql-client sudo pip3 install -r requirements.txt ``` ### 3. Configure environment ```bash cp .env.example .env nano .env # Fill in all values ``` ### 4. Initialize database ```bash python3 -c " from app import create_app from app.db import init_db app = create_app() with app.app_context(): init_db() " ``` ### 5. Configure Nginx ```bash sudo nano /etc/nginx/sites-available/mini-dropbox # Paste nginx config (see docs below) sudo ln -s /etc/nginx/sites-available/mini-dropbox /etc/nginx/sites-enabled/ sudo systemctl restart nginx ``` ### 6. Run with Gunicorn ```bash sudo systemctl start mini-dropbox sudo systemctl enable mini-dropbox ``` --- ## ๐Ÿ”ง Environment Variables ```bash # Flask FLASK_SECRET_KEY=your-secret-key FLASK_ENV=production # Google OAuth GOOGLE_CLIENT_ID=xxxx.apps.googleusercontent.com GOOGLE_CLIENT_SECRET=GOCSPX-xxxx GOOGLE_REDIRECT_URI=http://YOUR-EC2-IP/auth/callback # AWS AWS_REGION=ap-south-1 S3_BUCKET_NAME=your-bucket-name CLOUDFRONT_DOMAIN=your-cloudfront-domain.cloudfront.net # RDS DB_HOST=your-rds-endpoint.amazonaws.com DB_PORT=5432 DB_NAME=minidropbox DB_USER=dbadmin DB_PASSWORD=your-password ``` --- ## ๐Ÿ” AWS IAM & Security Design - **IAM Role** (`mini-dropbox-ec2-role`) attached to EC2 โ€” no AWS keys in code - **S3 bucket** is fully private โ€” no public access allowed - **Files served** via pre-signed URLs with expiry (download: 15 min, share: 7 days) - **RDS** has no public access โ€” only reachable from EC2 via Security Group - **Security Groups** โ€” RDS SG allows inbound only from EC2 SG (not open to internet) --- ## ๐Ÿ“ก API Routes | Method | Route | Description | |---|---|---| | GET | `/auth/login` | Redirect to Google OAuth | | GET | `/auth/callback` | Handle Google OAuth callback | | GET | `/auth/logout` | Clear session + redirect to login | | GET | `/` | Dashboard โ€” list user's files | | POST | `/files/upload` | Upload file to S3 + save metadata | | GET | `/files/download/` | Generate pre-signed download URL | | POST | `/files/delete/` | Delete from S3 + RDS | | POST | `/files/share/` | Generate 7-day shareable link | | GET | `/files/preview/` | Get CloudFront preview URL | --- ## ๐Ÿ’ก Cloud Concepts Demonstrated - **Object Storage** โ€” S3 as scalable file storage (not server disk) - **Pre-signed URLs** โ€” Secure, temporary access to private S3 objects - **CDN** โ€” CloudFront for fast global file delivery - **Multi-tier architecture** โ€” EC2 (compute) + S3 (storage) + RDS (database) separated - **IAM Roles** โ€” EC2 to S3 auth without hardcoded credentials - **Security Groups** โ€” Network-level access control between services - **Managed Database** โ€” RDS handles backups, patching, availability - **Process Management** โ€” Gunicorn + systemd for production reliability - **Reverse Proxy** โ€” Nginx routing traffic to Flask app --- ## ๐Ÿ“Š AWS Services Used | Service | Purpose | Free Tier | |---|---|---| | EC2 t2.micro | App server | 750 hrs/month | | RDS db.t3.micro | PostgreSQL database | 750 hrs/month | | S3 | File storage | 5GB storage | | CloudFront | CDN / file delivery | 1TB transfer/month | | IAM | Roles & permissions | Always free | | CloudWatch | Monitoring & logs | 10 metrics free | GCP Google Oauth Client| for login with google --- ## ๐Ÿ‘จโ€๐Ÿ’ป Author **Aditya Nair** - GitHub: [@ADITYANAIR01](https://github.com/ADITYANAIR01) - LinkedIn: [linkedin.com/in/adityanair001](https://www.linkedin.com/in/adityanair001) ---