DEV Community

Discussion on: How to Serve On-Demand Streaming Videos from AWS (Build Your Own Netflix)

Collapse
 
therealdanvega profile image
Dan Vega

Thanks for this video Andrew. I have one question about this setup. It sounds like you have 1 s3 bucket for all videos and customers either have access or they don't. What happens in a scenario where you had multiple videos courses and customers could purchase individual courses. Would this setup work for that scenario as well and if so any documentation anywhere that could help me with that? Thanks again for the awesome explanation!

Collapse
 
andrewbrown profile image
Andrew Brown 🇨🇦

The use-case you're describing is what we didn't cover in the talk due to time constraist. It was something we did have to solve.

CloudFront has a feature called Lambda@Edge which allows all incoming requests to pass through a Lambda function. So when a user requests to view content via our Rails app we generate out our own access token that uniquely identifies that user. We then pass than token along with the request to CloudFront, we ensure that we whitelist that header in the behaviours. We than use that token to validate that user against our database with that custom lambda function.

A single bucket solutions works great because its all our own content for a single platform. If lets say we had whitelabeled our LMS so multiple clients used it we could still use one bucket and lock down subdirectories to specific clients.