serverless-image-handler icon indicating copy to clipboard operation
serverless-image-handler copied to clipboard

Use Origin Shield Failover to improve cost efficiency and allow bigger images to be processed

Open Swahjak opened this issue 1 year ago • 1 comments

Is your feature request related to a problem? Please describe.

  1. If there is a miss on Cloudfront, Lambda will always be called to generate an image.
  2. Lambda limits the size of images that can be processed (returned to the client)

Describe the feature you'd like

There is another 'image optimization' project from AWS which describes a way to use Sharp to resize images. It's a lot less sophisticated on the transformations, but it does use a failover mechanism provided by Origin Shield which allows the 'transformed' image to be persisted to another S3 bucket (which solves 1).

It would also provide a mechanism for supporting larger images by persisting the image and returning a status code that tells te client to restart the request. At the time the client restarts the request the image will be available in S3 and can be served.

https://github.com/aws-samples/image-optimization.

From my perspective it would also make sense to combine these two repositories / solutions because of their similarities.

Additional context

https://github.com/aws-samples/image-optimization/compare/main...graceful-failover

Swahjak avatar Oct 12 '23 07:10 Swahjak

Thanks for the suggestion. We've added this to our backlog and will evaluate adding it to a future release.

kamyarz-aws avatar Oct 12 '23 14:10 kamyarz-aws