Update AWS S3 Video/Object Metadata With AWS Javascript SDK

335 Views Asked by At

My video files in S3 don't have any cache-control header and therefore my users have to reload/download videos on every refesh. I can manually update the cache-control metadata on the AWS website, but I need to do it programmatically on my node server.

Here is link to video landing page example. Here is screenshot of video with no cache-control.

screenshot of video network request

The challenge is I can't simply set the headers when I create the signedUrl or upload the video, because my final video comes from AWS Elastic Transcoder. Users upload a .mov file on my front end to AWS, which starts an Elastic Transcoder job on the backend that converts it to .mp4. I can't find a way to set a cache-control on Elastic Transcoder outputs, so I'm assuming I need to use a separate function to update the object metadata once the transcoder job is done.

Also, I'm not 100% sure I even need to take this step, do I need to manually set cache-control?

1

There are 1 best solutions below

0
On

Found a better solution, use AWS Cloudfront!