[RFC] File Storage #9
Replies: 5 comments 9 replies
-
Hey, Anyway, I know lift's objective is to provide out-of-the-box solutions, but for me, it must be also configurable to be usable. Do you plan to provide a param to change each of the options (encryption, versioning, tiering)? VersioningI would for sure like to change versioning settings - your defaults seem nice, but add one param to change how long old versions are kept or disable removal at all? storage:
thumbnails:
versioning: 30 / true / false where:
I know I could do it all by myself with raw CF, but if I start using lift, I would like to use it for all buckets, even if one of them must have versioning disabled. TieringMoving to Glacier by default is a big no-no for me. Using Glacier is a special case, not a regular one. I would rather see that as an optional feature, enabled with a param rather than disabled with one. Many developers will be surprised after using lift without reading the details, that their applications cannot simply retrieve some object from S3. Apart from that, using Intelligent Tiering seems good by default, I think. Auto-removalWhenever I have S3 buckets, I need to add @purple/serverless-s3-remover sls plugin to automatically clean the bucket on Of course, losing all the files in the S3 bucket when you, let's say, accidentally remove the stack, is probably something that not everyone expects. I could argue that the DynamoDB does not have the same protection by default and the table will be removed even if you have some items in it. But would be nice if the lift would take care not only for the creation of buckets but also for cleaning them in order to remove with the stack. Maybe by some additional parameter? storage:
thumbnails:
clean: true # false is default Having cleaning enabled would basically do the same as the plugin I linked above - in pre-remove hook would remove everything from the bucket. I don't know if you will like this idea. But if so, I can help and migrate this behavior to the lift. NamingBtw, I assume the CF resources naming will be consistent and based on the provided name, like I really like your idea of making serverless easier, to bring the same that it does to Lambda functions also to other bits of the architecture. I hope my feedback helps, even if you disagree with it 😉 let me know if I can help, I have some experience with serverless plugins, I can help with smaller parts (as I have other things that I work on in the free time at the same time, probably as we all). |
Beta Was this translation helpful? Give feedback.
-
I guess it might need a name parameter? Given buckets are globally unique you have to pick a unique name but you'll want to refer to it locally with a simple use-based key. I'd suggest actually making name required as a field for that reason. |
Beta Was this translation helpful? Give feedback.
-
This construct looks like a good solution to quickly deploy an "upload" bucket for users, to gather User Generated Content for example. Maybe a parameter to autogenerate an endpoint to fetch a signed "put" request would be nice? With a possible Authorizer lambda? In the lifecycle policy declared, should the "delete incomplete multipart uploads" be enabled by default? Maybe enabled with a parameter? (in the case of a bucket used to upload large videos) |
Beta Was this translation helpful? Give feedback.
-
I like this construct. Quickly can create a fully configurable bucket, and that's all I need in most of the scenarios ❤️ . Some example which I've created https://github.com/Pigius/s3-event-notifications-lambda-dynamodb. |
Beta Was this translation helpful? Give feedback.
-
Hi @fredericbarthelet! This construct is SUPER useful! Two things may make it better IMO:
|
Beta Was this translation helpful? Give feedback.
-
The goal of this discussion is to get feedback on the "File Storage" component.
If you are new to Lift, a quick intro: it's a Serverless plugin that can be installed via npm and enabled in any
serverless.yml
file.Here is what we are planning so far.
Use case
Providing file storage solution with S3.
Quick start
This exemple will create an S3 bucket.
What's included
Encryption
There are 4 different solutions to provide encryption at rest of the data stored in S3:
SSE-S3
- S3 manages the key to encrypt the data at rest, after its being encryptedSSE-KMS
- KMS is used to generate a master key that will be used to encrypt the data at restSSE-C
- you provide your own encryption keySSE-S3
is the preferred option, activated by default, as it provides a mechanism of data encryption at rest, fully managed by AWS, at no additional cost, without requiring any additional development.Encryption method can be updated to
SSE-KMS
using theencryption: kms
configuration.Encryption method can be updated to
SSE-C
using theencryption: <myKmsKeyId>
configuration.Versioning
Versioning enabled bucket ensures no accidental deletion or overwrite operations result in data loss.
Deleting a file will result in the addition of a delete marker.
Overwriting a file will result in the addition of a new version containing the file, without deleting the previously existing file content
Versioning comes at a cost - each version of the file is billed according to normal S3 costs.
In order to provide versioning without impacting cost, the lifecycle configuration
NoncurrentVersionExpiration
with a value of 30 days is added. This will automatically perform cleanup of non-current versions of file (wether it be a delete marker or a old version of a file) 30 days after its creation, giving you the opportunity to recover the file for a month before permanent deletion.Intelligent Tiering
By default, Lift provisions an S3 bucket with an intelligent tiering configuration.
Files will be moved to IA storage class 30 days after last access.
Glacier is a special storage class requiring an interaction with the Initiate Job API before actually being able to retrive the file. Not sure if this is a good idea to implement this storage class by default, WDYT ?
Moving files to Glacier can be enabled using
archive: 180
configuration (180 is the number of day without access at which point files are moved to Glacier).Not sure yet if IA duration should be configurable as well.
Security
All lambdas defined within your serverless.yml file will be allowed the following actions by default:
This behavior can be disabled with the following configuration:
deploy
command will trigger a post-deploy hook that will analyse S3 lens data and give recommendation to change the IA and glacier duration.Feedback is welcome, just post a reply to this discussion 🙏
Beta Was this translation helpful? Give feedback.
All reactions