Venkatesh
Venkatesh

Reputation: 103

How can I access the generated thumbnail in S3 in frontend?

I am created a lambda trigger , when a video file uploaded in a s3 input bucket, it will create a thumbnail in output bucket, but I don't know how to access it. Please help me.

Iam generating 3 thumbnail from a single video, in this bottom image 👇, there this 4 video.

But I have the name of the file as dfdf and treasersonthing and vijay.treaser.ve and vollyball , but I want all 3 images using this file name.

enter image description here

Upvotes: 0

Views: 1137

Answers (1)

Victor
Victor

Reputation: 14622

The question is quite open - do you want to access the generated thumbnails on the frontend of your website? If so, I will try and provide some ideas for the architecture, based on some assumptions.

Publicly Accessible Thumbnails

Assuming you want to make the thumbnails publicly accessible, S3 can expose them through its own HTTP endpoint. See AWS documentation. Please note that this involves enabling Public Access on your bucket, which can potentially be risky. See How can I secure files in my Amazon S3 bucket for more information. While this is an option, I'm not going to elaborate on it, as it's probably not the best.

The preferred way is to have a CloudFront distribution serve files from your S3 bucket. This has the advantages of a typical CDN - you can have edge locations caching your files across the globe, thus reducing the latencies your customers see. See this official guide on how to proceed with this CloudFront + S3 solution.

Restricted-access Thumbnails

If your thumbnails are not meant to be public, then you can consider two options:

  • implement your own service (hosted on any compute engine you prefer) to handle the authentication & authorization, then return the files to your customers, or
  • use the CloudFront + S3 solution and control the authentication and authorization with Lambda@Edge. See AWS docs.

Upvotes: 2

Related Questions