Use S3 storage instead of /data folder #49
Labels
enhancement
New feature or request
good first issue
Good for newcomers
python
Pull requests that update Python code
In the
WriteAndSaveProgram
skill, we utilize theagency_id
to construct a directory path for each agency. However, this is a bad practice and we need a persistent solution. We should establish an external storage solution for each user. Using S3-compliant storage and creating a bucket would be a viable approach.To integrate S3 storage into our FastAPI application, we can follow these steps:
[us] Choose an S3 Storage Provider: Since we've deployed the app on Heroku, supporting Amazon S3 for storage would be a straightforward choice due to its broad support, scalability, and integration with Heroku.
[end user] Set Up the S3 Bucket: Set up an S3 bucket in our preferred region. Ensure the bucket policy and IAM roles are set up accordingly to allow programmatic access.
[us] Install Boto3: Boto3 is the Amazon Web Services (AWS) SDK for Python, which allows Python developers to write software that uses services like Amazon S3.
[end user] Configure Access Credentials: End users need to securely store their access credentials (such as
AWS_ACCESS_KEY_ID
andAWS_SECRET_ACCESS_KEY
) in user variables.[us] Modify the Current File Handling Logic: We currently have the
WriteAndSaveProgram
skill in/backend/custom_skills/write_and_save_program.py
that manages file writing locally. We'll replace the logic in theFile
class'srun
method with code to upload files to S3. Here's a basic example of how we might upload files to S3:[us] Test the Integration: Before deploying the changes to production, ensure we've tested the S3 integration locally and on a staging environment to confirm that files are being uploaded correctly, and our application can retrieve them as needed.
[us] Update Documentation: Reflect these changes in both the main
README.md
and the backend'sREADME.md
, specifying the requirement for S3 storage and environment variables setup.Use this branch:
https://github.com/AI-in-Hand/platform/tree/feat/use_s3_storage_instead_of_data_folder
Need to apply the new approach to all the skills that read/write to the local drive.
The text was updated successfully, but these errors were encountered: