FileSharing is a cloud-based file-sharing platform built on Amazon Web Services (AWS), designed to provide secure file uploads, downloads, and sharing, similar to Google Drive. The application features a React-based web interface for user authentication and file management, with a serverless backend for scalability and cost-efficiency. FileSharing leverages AWS services to ensure high availability, robust security, and seamless user experience, targeting general users like students and professionals.
- User Authentication: Register and log in securely using email and password, with email verification.
- File Upload: Upload files via a user-friendly UI, stored securely in the cloud.
- File Management: View, download, and delete uploaded files, with organized file lists.
- File Sharing: Share files via temporary pre-signed URLs sent through email notifications.
- Real-Time Notifications: Receive instant email updates for sign-ups, uploads, and shares.
- Security: Encrypt files at rest and in transit, restrict access with pre-signed URLs, and audit API calls.
- Scalability: Handle up to 1,000 daily active users with serverless architecture.
- Upload/download latency: <5 seconds for 10 MB files.
- API response time: <500 ms for authentication and URL generation.
- Availability: 99.9% uptime, leveraging AWS service SLAs.
FileSharing uses a hybrid architecture combining serverless and infrastructure-based AWS services in the us-east-2 region:
- Frontend: React application hosted on an EC2 instance in a Docker container, served via Nginx.
- Backend: Serverless AWS Lambda functions handle file operations, authentication, and notifications.
- Storage: Amazon S3 stores user files and backend code, with AES-256 encryption.
- Database: Amazon DynamoDB manages user credentials and file metadata.
- Networking: Amazon API Gateway routes frontend requests to Lambda, with CORS configured for security.
- Notifications: Amazon SNS sends real-time email notifications for user actions.
- Authentication: Amazon Cognito provides secure user sign-up and sign-in.
- Governance: AWS CloudTrail logs API calls for auditing.
- Deployment: AWS CloudFormation automates infrastructure setup.
Below is the architecture diagram created with Draw.io, illustrating the components and their interactions:
FileSharing/
├── frontend/ # React frontend code (Vite)
│ ├── src/
│ │ ├── components/
│ │ ├── Files.jsx # File management UI
│ │ └── App.jsx # Main app component
│ ├── public/
│ ├── Dockerfile # Docker configuration for frontend
│ ├── package.json # Frontend dependencies
│ └── vite.config.js # Vite configuration
├── lambda/ # AWS Lambda functions
│ ├── filesharing_upload.py # File upload logic
│ ├── filesharing_share.py # File sharing with pre-signed URLs
│ ├── filesharing_list.py # List user files
│ ├── filesharing_delete.py # Delete files
│ ├── filesharing_confirm.py# User verification
│ ├── filesharing_notify.py # SNS notifications
│ └── requirements.txt # Lambda dependencies
├── cloudformation/ # Infrastructure as Code
│ └── template.yaml # CloudFormation template
├── docs/ # Documentation
│ └── architecture-diagram.png # Architecture diagram
├── .gitignore # Git ignore file
└── README.md # This file
To deploy and run FileSharing, ensure you have:
- AWS Account: Configured with access to us-east-2 region.
- AWS CLI: Installed and configured with credentials (
aws configure
). - Node.js: Version 18.x or later for frontend development.
- Docker: Installed for building and running the frontend container.
- Python: Version 3.13 for Lambda functions, with
pip
for dependencies. - Git: For cloning the repository.
- Text Editor: VS Code or similar for code editing.
git clone https://github.com/<your-username>/FileSharing.git
cd FileSharing
Set up your AWS CLI credentials with a user having permissions for S3, Lambda, EC2, API Gateway, DynamoDB, SNS, Cognito, and CloudFormation.
aws configure
-
Navigate to the CloudFormation directory:
cd cloudformation
-
Deploy the stack (replace
<stack-name>
with your preferred name):aws cloudformation create-stack --stack-name <stack-name> --template-body file://template.yaml --capabilities CAPABILITY_NAMED_IAM
-
Wait for the stack to complete (check status in AWS Console or CLI):
aws cloudformation describe-stacks --stack-name <stack-name>
-
Note the outputs (e.g., EC2 public IP, API Gateway URL) for frontend configuration.
-
Navigate to the frontend directory:
cd ../frontend
-
Install dependencies:
npm install
-
Build the React app:
npm run build
-
Build the Docker image:
docker build -t filesharing-frontend .
-
Push the image to a registry (e.g., Docker Hub):
docker tag filesharing-frontend <your-dockerhub-username>/filesharing-frontend:latest docker push <your-dockerhub-username>/filesharing-frontend:latest
-
Update the EC2 instance (via SSH, using the public IP from CloudFormation outputs):
ssh -i <your-key.pem> ec2-user@<ec2-public-ip> sudo docker pull <your-dockerhub-username>/filesharing-frontend:latest sudo docker stop filesharing-container || true sudo docker rm filesharing-container || true sudo docker run -d --name filesharing-container -p 3000:3000 <your-dockerhub-username>/filesharing-frontend:latest
-
Configure the frontend to use the API Gateway URL (from CloudFormation outputs):
-
Create a
config.js
infrontend/src
:export const API_URL = process.env.REACT_APP_API_URL || 'https://<api-gateway-id>.execute-api.us-east-2.amazonaws.com';
-
Update the Dockerfile to inject the URL at runtime (see
frontend/Dockerfile
).
-
-
Navigate to the Lambda directory:
cd ../lambda
-
Install dependencies:
pip install -r requirements.txt -t .
-
Zip each Lambda function (e.g., for
filesharing_upload.py
):zip -r filesharing_upload.zip filesharing_upload.py .
-
Upload to S3 (replace
<code-bucket>
with the S3 bucket from CloudFormation outputs):aws s3 cp filesharing_upload.zip s3://<code-bucket>/lambda/
-
Repeat for other Lambda functions (
filesharing_share.py
, etc.). -
CloudFormation automatically deploys these functions using the S3 code.
- Open a browser and navigate to
http://<ec2-public-ip>:3000
. - Register a new account, verify your email, and log in.
- Upload files, view your file list, and share files via email links.
- Sign Up: Create an account with your email and password. Check your inbox for a verification code.
- Log In: Use your credentials to access the file management dashboard.
- Upload Files: Select files via the UI to upload to S3. Receive an email confirmation.
- View Files: See your uploaded files with options to download or share.
- Share Files: Generate a pre-signed URL for a file and send it via email using SNS.
- Delete Files: Remove unwanted files to manage storage.
FileSharing implements robust security measures:
- Encryption: S3 uses AES-256 for data at rest and in transit.
- Access Control: Pre-signed URLs (1-hour expiry) restrict file access.
- Authentication: Cognito secures user credentials with TLS.
- CORS: API Gateway restricts requests to the EC2 public IP and localhost.
- Auditing: CloudTrail logs all API calls for traceability.
- VPC: EC2 resides in a secure VPC with limited ports (22, 3000).
Note: The application uses a single S3 bucket with user-specific folders due to IAM restrictions in the development environment. In production, use separate buckets per user for enhanced isolation.
Contributions are welcome! To contribute:
- Fork the repository.
- Create a feature branch (
git checkout -b feature/your-feature
). - Commit changes (
git commit -m 'Add your feature'
). - Push to the branch (
git push origin feature/your-feature
). - Open a Pull Request.
Please follow the Code of Conduct and ensure tests pass before submitting.
- File Versioning: Store multiple file versions using S3 Versioning.
- Large File Uploads: Support multi-part uploads for files >100 MB.
- File Search: Enable metadata-based search with Amazon OpenSearch Service.
- Monitoring: Add Amazon CloudWatch for performance tracking.
This project is licensed under the MIT License. See the LICENSE file for details.
- Built with AWS services.
- Frontend powered by React and Vite.
- Architecture visualized with Draw.io.
For issues or questions, open a GitHub issue or contact the maintainer at [email protected]
.