laconia
laconia copied to clipboard
How might we abstract S3?
S3 is an essential part of a serverless architecture in AWS. We write and read a lot from S3. Laconia encourages technologists to not be dependent on the cloud in their core application. At the same time, I'm also reluctant to introduce an unnecessary abstraction. Is there a middle ground that covers 80% of user's use cases? How will the API look like?
I have similar thoughts to #111 - essential avoiding premature abstraction in a framework for things that are likely to require specific implementation detail.
That said, one use case I've seen recently would be triggering a Lambda on file change event from S3
Lambda trigger -- Laconia actually already supports this. See: https://laconiajs.io/docs/guides/adapting-events. It retrieves object automatically for you on Lambda trigger.
On premature abstraction, I can say that on most of my cases, my operations on S3 object operation. I'd like to think that we can abstract object operation properly i.e. not prematurely?
This is one example abstraction from a tutorial from claudiajs:
const fileSystem = require('./s3-file-system')
inputStream = fileSystem.readAsStream(event.filePath, event.location);
fileSystem.writeFromStream(
outputFilePath,
event.location,
convertedStream,
callback
);
Is a file system a good abstraction for us?