
Ask HN: What the best way to optimize images in S3? - hartator
Amazon services, third parties, or processing on your own server?<p>By optimising, I mean resizing and compression for web consumption.
======
dgelks
For this sort of work I found using a lambda function with a trigger on s3
upload works very well, aws-lambda-image seems like a popular project to use
instead of writing your own code [https://github.com/ysugimoto/aws-lambda-
image](https://github.com/ysugimoto/aws-lambda-image)

------
cjhanks
Personally, I prefer to perform such optimizations on 'load' rather than on
'store' (as recommended by dgelks). This is particularly useful if you may
want to change your optimized image format.

You would have a canonical lossless image stored in S3. When a user makes a
request to your CDN, it calls an origin server (assuming a cache miss) that
transforms the canonical images into an optimized form.

Any basic WSGI, FCGI, CGI application behind NGINX will probably be
sufficient.

------
savethefuture
I have a microservice setup to process my s3 images, on the fly and when
they're uploaded.

