amazon-web-servicesamazon-s3content-encoding

Does content encoding only compress for transmission, or also for persistent storage in S3?


Does 'Content-Encoding': 'gzip' reduce the file size in AWS S3?

Documentation says: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Encoding

This lets the recipient know how to decode the representation in order to obtain the original payload format.

Does it mean if a file / image / GIF is sent to S3, AWS will decode it and save it in a decoded way? Or S3 will store it in a compressed way, and serve it also in a compressed way?

In my case we store GIF-s in S3, and they have to be smaller than 8 MB. So need some kind of compression.


Solution

  • content type is applied on the fly on the image. You can disable and enable the content type headers on the s3 and check the file size on s3. They will be the same in both the cases.