CloudBox is a cloud-based file storage and retrieval system that allows users to securely upload, store, and access files using AWS services like S3, CloudFront, Cognito, and more.
- Secure File Upload & Retrieval: Upload files to AWS S3 with metadata stored in DynamoDB.
- Pre-signed URLs: Generate time-limited URLs for secure file access.
- AWS Lambda Integration: Automate file processing and metadata management.
- Kinesis Firehose: Stream logs and events for monitoring.
CloudBox follows a serverless design using:
- Amazon Cognito for user authentication.
- API Gateway: Provides RESTful endpoints for file operations.
- Amazon S3 for file storage.
- Amazon DynamoDB for metadata storage.
- AWS Lambda for serverless compute.
- Amazon Kinesis Firehose for log processing.
To deploy CloudBox, ensure you have AWS CLI and Terraform installed. Then clone the repository:
git clone https://github.com/Stefanie-A/CloudBox.git
cd CloudBox
terraform init
terraform applyOnce deployed, Terraform will output relevant details like:
- Cognito Login URL
- API Gateway Endpoints
To start the app locally for development and testing purposes, follow these steps:
-
Install Dependencies:
- Ensure you have Python and pip installed.
- Navigate to the
appdirectory and install the required dependencies:cd app pip install -r requirements.txt
-
Set Environment Variables:
- Create a
.envfile in theappdirectory with the following content:DYNAMODB_TABLE=S3FileMetadata KINESIS_STREAM=your-kinesis-stream-name S3_BUCKET=your-s3-bucket-name
- Create a
-
Run the Flask App:
- Start the Flask development server:
flask run
- The app will be available at
http://127.0.0.1:5000.
- Start the Flask development server:
- Sign Up:
- Navigate to the Cognito Login URL provided by Terraform.
- Click on the "Sign Up" link.
- Enter your email, password, and other required details.
- Verify your email address by entering the verification code sent to your email.
-
Request a Pre-signed URL:
- Use Postman to send a POST request to the
/uploadendpoint. - Endpoint:
/upload - Method:
POST - Request Body:
{ "file": "example.txt", "user_id": "user@example.com", } - Response:
{ "message": "File uploaded successfully" }
- Use Postman to send a POST request to the
-
Upload Your File:
- Use the pre-signed URL provided in the response to upload your file.
-
Fetch the Pre-signed URL:
- Use Postman to send a GET request to the
/fetchendpoint. - Endpoint:
/fetch - Method:
GET - Query Parameters:
file_id: The ID of the file to fetch.user_id: The ID of the user who owns the file.
- Response:
{ "file_id": "YOUR-FILE-ID", "file_key": "YOUR-FILE-KEY", "file_name": "YOUR-FILE-NAME", "timestamp": "2025-03-24T18:20:51.056393", "user_id": "YOUR-USER-ID", "presigned_url": "https://example.com/presigned-url" }
- Use Postman to send a GET request to the
-
Download the File:
- Use the pre-signed URL provided in the response to download your file.
-
Monitor Logs:
- Check CloudWatch logs for AWS Lambda execution.
- Review Firehose streams for analytics.
-
Access Denied (403) on CloudFront:
- Ensure your S3 bucket policy allows public read access via CloudFront.
- Verify CloudFront is configured with the correct origin access control.
-
Pre-signed URL Expired:
- Ensure the URL is used before expiry.
- Regenerate the pre-signed URL if necessary.
Contributions are welcome! Feel free to submit pull requests or report issues in the GitHub repository.
This project is licensed under the MIT License.
