We're working on a backend project and we've started a move to microservices development. We already have a few services in place, one of which is a FileService which stores and fetches files (using underlying Amazon S3 storage). The FileService also provides file checksum, authentication and retry mechanism and is used to share files across services and with the clients.
We are now building a new service and part of this service's private data are files that the service stores and uses for its business logic, and we have a dilemma of whether we should use the FileService to store and fetch the files or handle the storage and fetching of the files internally in the service.
The reason to use the FileService is we're getting all the features implemented in the service for free (retry, checksum etc). The reason not to use it is we want the new service to be able to work autonomously and using the FileService ties the new service to it (it must handle OAuth2 authentication to fetch/upload files, it must deploy the FileService and the AuthService whenever this services is deployed etc).
I wanted to know if someone has best practices for storing private files in a microservices environment, and what is the best approach to it with the pros and cons.
Converting in-process FileService component to microservice will definitely have advantages as well as disadvantages. You've listed several of them, but most importantly you have to create a cost/benefit analysis matrix applicable to your business and domain specifically. There is no "best practices" approach here.
Costs:
Benefits:
Conclusion:
There is no way to answer those questions without actually talking with business people and discussing risks around such transition.