Skip to content

Repository files navigation

DropNote 📝☁️

Ephemeral Note & File Sharing Application for AWS High Availability

DropNote is a lightweight, responsive, single-page full-stack web application designed for cloud computing coursework and production deployment on Amazon Web Services (AWS).


🌟 Key Features

  • 🔐 Ephemeral Sharing: Generate 6-character human-readable codes (A7X9K2) with automatic 7-day expiration.
  • 📁 Direct S3 File Attachments: Supports attachments up to 10 MB with secure 15-minute pre-signed S3 download URLs.
  • Dynamic Auto-Scaling Ready: Includes an authenticated non-blocking CPU stress test generator to trigger CloudWatch High CPU alarms and demonstrate EC2 Auto Scaling.
  • 🌐 AWS IMDSv2 Diagnostics: Built-in /status subpage showcasing EC2 Instance ID and multi-AZ load balancing across Availability Zones.
  • 🩺 ALB Health Checks: Dedicated /health endpoint returning HTTP 200 for Application Load Balancer target group monitoring.
  • 🛡️ Zero-Secret Design: Uses AWS IAM Instance Profile (LabRole) and external environment configurations.

🏗️ Architecture

                 [ Internet Users ]
                         │
                         ▼
        [ Application Load Balancer (ALB) ]
                         │
        ┌────────────────┴────────────────┐
        ▼                                 ▼
[ EC2 Instance (AZ-1a) ]          [ EC2 Instance (AZ-1b) ]
(Gunicorn + Nginx + IMDSv2)       (Gunicorn + Nginx + IMDSv2)
        └────────────────┬────────────────┘
                         │ Auto Scaling Group (2 to 4 Instances)
        ┌────────────────┴────────────────┐
        ▼                                 ▼
[ Amazon RDS MySQL ]              [ Amazon S3 Bucket ]
 (Note Metadata & TTL)             (File Attachments)

📁 Repository Structure

.
├── app/
│   ├── __init__.py           # Package init & create_app
│   ├── main.py               # Flask API endpoints & admin auth
│   ├── config.py             # Environment configuration
│   ├── db.py                 # MySQL connection pooling & auto-migration
│   ├── s3_service.py         # AWS S3 client & pre-signed URL generator
│   ├── imds.py               # IMDSv2 EC2 metadata fetcher
│   ├── stress.py             # Multi-core CPU stress tester
│   ├── static/
│   │   ├── css/style.css     # Modern dark glassmorphism design
│   │   └── js/
│   │       ├── app.js        # Main Single Page App controller
│   │       └── status.js     # System diagnostics & stress testing UI
│   └── templates/
│       ├── index.html        # Clean Drop & Retrieve UI
│       └── status.html       # AWS System Diagnostics & Internal Tools
├── database/
│   └── schema.sql            # MySQL table definition
├── scripts/
│   ├── user-data.sh          # EC2 User Data script for ASG Launch Template
│   ├── setup_system.sh       # Manual Linux server setup script
│   ├── cleanup_cron.py       # Expired notes & S3 cleanup worker
│   └── verify_connection.py  # Diagnostic connectivity test script
├── .env.example              # Environment variables template
├── requirements.txt          # Production dependencies
├── wsgi.py                   # Gunicorn WSGI entrypoint
├── dropnote.service          # Systemd unit file
├── nginx.conf                # Nginx reverse proxy configuration
├── DEPLOYMENT_GUIDE.md       # Comprehensive step-by-step AWS deployment guide
└── README.md

🚀 Quick Deployment Guide

For full step-by-step instructions on setting up VPC, RDS MySQL, S3, ALB, and Auto Scaling Groups, please refer to the Deployment Guide.

Basic Setup on an EC2 Instance:

# 1. Clone repository
git clone https://github.com/PRSXFENG/cloud-computing-final.git /opt/dropnote
cd /opt/dropnote

# 2. Setup virtual environment
python3 -m venv venv
./venv/bin/pip install -r requirements.txt

# 3. Create .env from template
cp .env.example .env
# Edit .env with your RDS Endpoint and S3 Bucket Name:
nano .env

# 4. Verify connectivity
./venv/bin/python scripts/verify_connection.py

# 5. Run with Gunicorn
./venv/bin/gunicorn --bind 0.0.0.0:5000 wsgi:application

🔒 Security & Admin Tools

To protect against public abuse:

  • The /api/admin/stress endpoint and /api/admin/cleanup endpoint require authentication via the X-Admin-Key header or query parameter ?key=... matching ADMIN_SECRET_KEY in .env.
  • General users accessing / only see the note creation and retrieval interfaces.
  • System evaluators can visit /status to view instance metadata and unlock the CPU stress test.

About

Cloud Computing Final Project

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages