I am creating a Django application. The application allows the user to upload files and publish them to other users.
I am thinking of using S3 or CloudFront to manage and maintain these files. (Let me call it S3 for discussion.) What bothers me is that S3 will have many states on it. My Python code will create, rename and delete files in S3 based on user actions. But we already have the entire state in our database. Having state in two separate data stores can lead to synchronization and confusion issues. In other words, it should not "fail." For example, if someone had to delete a database entry from the django administrator, the s3 file will remain an orphan. (I could write code to handle this script, but I cannot catch all the scripts.)
So, I think: is there a solution for automatically synchronizing S3 with data in your Postgres database? (I have no problems storing files in the form of blocks in the database, they are small if they are not served directly from there.) I'm talking about the presence of an active program that always supports synchronization between them, so if someone deletes a record in the database , the corresponding file in s3 will be deleted, and if someone deletes the file from the S3 interface, it will be recreated from the database. Thus, my mind could calm down calmly in matters of synchronization.
Is there something similar? Most preferably in Python.
source
share